@camstack/server 1.2.731 → 1.2.733

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 (104) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/api/core/cap-providers.js +1 -0
  3. package/dist/api/core/logging-settings.js +88 -1
  4. package/dist/api/trpc/generated-cap-routers.js +49 -0
  5. package/dist/core/addon/addon-registry.service.js +61 -59
  6. package/package.json +11 -19
  7. package/system/dist/addon-runner.js +1 -0
  8. package/system/dist/addon-runner.mjs +2 -1
  9. package/system/dist/addon-utils.mjs +1 -1
  10. package/system/dist/{agent-https-AJPmB73W.mjs → agent-https-D3dptveB.mjs} +1 -1
  11. package/system/dist/{agent-https-CLJhq0GZ.js → agent-https-v5uyVgpk.js} +1 -1
  12. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  13. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +4 -4
  14. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  15. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +5 -5
  16. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  17. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  18. package/system/dist/builtins/autotrack/index.js +1 -1
  19. package/system/dist/builtins/autotrack/index.mjs +1 -1
  20. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  21. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -5
  22. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  23. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  24. package/system/dist/builtins/camera-grid/index.js +1 -1
  25. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  26. package/system/dist/builtins/composer/composer.addon.js +3 -3
  27. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  28. package/system/dist/builtins/console-logging/index.js +1 -1
  29. package/system/dist/builtins/console-logging/index.mjs +1 -1
  30. package/system/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  31. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  32. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  33. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  34. package/system/dist/builtins/device-manager/device-manager.addon.js +220 -16
  35. package/system/dist/builtins/device-manager/device-manager.addon.mjs +220 -16
  36. package/system/dist/builtins/device-manager/discovery-proposal-service.d.ts +38 -0
  37. package/system/dist/builtins/device-manager/discovery-proposal-store.d.ts +28 -0
  38. package/system/dist/builtins/device-manager/record-kinds.d.ts +2 -1
  39. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  40. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  41. package/system/dist/builtins/keychain/index.js +3 -3
  42. package/system/dist/builtins/keychain/index.mjs +3 -3
  43. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  44. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  45. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  46. package/system/dist/builtins/local-auth/local-auth.addon.mjs +5 -5
  47. package/system/dist/builtins/local-network/local-network.addon.d.ts +10 -0
  48. package/system/dist/builtins/local-network/local-network.addon.js +297 -190
  49. package/system/dist/builtins/local-network/local-network.addon.mjs +294 -187
  50. package/system/dist/builtins/local-network/passive/discovery-watcher.d.ts +60 -0
  51. package/system/dist/builtins/local-network/passive/passive-io-node.d.ts +2 -0
  52. package/system/dist/builtins/local-network/passive/passive-packets.d.ts +10 -0
  53. package/system/dist/builtins/local-network/scan/dns-wire.d.ts +6 -2
  54. package/system/dist/builtins/local-network/scan/scan-engine.d.ts +1 -1
  55. package/system/dist/builtins/local-network/scan/scan-io.d.ts +6 -0
  56. package/system/dist/builtins/loki-logging/index.js +1 -1
  57. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  58. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  59. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +10 -10
  60. package/system/dist/builtins/platform-probe/index.js +1 -1
  61. package/system/dist/builtins/platform-probe/index.mjs +10 -10
  62. package/system/dist/builtins/record-entries/index.js +1 -1
  63. package/system/dist/builtins/record-entries/index.mjs +1 -1
  64. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  65. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  66. package/system/dist/builtins/snapshot/index.js +1 -1
  67. package/system/dist/builtins/snapshot/index.mjs +1 -1
  68. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  69. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +20 -20
  70. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  71. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  72. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  73. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  74. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  75. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  76. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  77. package/system/dist/builtins/system-config/system-config.addon.mjs +115 -115
  78. package/system/dist/builtins/winston-logging/index.js +1 -1
  79. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  80. package/system/dist/{composition-sources-D-S2hhdw.mjs → composition-sources-Dnyu7-1p.mjs} +1 -1
  81. package/system/dist/{composition-sources-BNBlJAgu.js → composition-sources-j_bFq7Tx.js} +1 -1
  82. package/system/dist/{constants-CKwdQTnw.js → constants-C6zJ_38f.js} +1 -1
  83. package/system/dist/{constants-DmithOex.mjs → constants-GDBin8zB.mjs} +1 -1
  84. package/system/dist/{coral-accelerators-BW3OcrLD.mjs → coral-accelerators-DBlgWB8k.mjs} +6 -6
  85. package/system/dist/{custom-action-registry-BIJZBObd.mjs → custom-action-registry-oHl1xltx.mjs} +37 -37
  86. package/system/dist/{device-ca-D-Cvxobt.mjs → device-ca-Bpqrad00.mjs} +1 -1
  87. package/system/dist/{device-ca-TbdQfW4d.js → device-ca-CV9QZvoy.js} +1 -1
  88. package/system/dist/{dist-dQKZfa3-.js → dist-CwYYyGAB.js} +227 -3
  89. package/system/dist/{dist-yrk6fm65.mjs → dist-DcHvuBfD.mjs} +210 -4
  90. package/system/dist/dns-wire-CqgMi_uB.js +202 -0
  91. package/system/dist/dns-wire-DO56tOHL.mjs +173 -0
  92. package/system/dist/file-host-worker.js +1 -1
  93. package/system/dist/file-host-worker.mjs +1 -1
  94. package/system/dist/{hub-mdns-ciao-Cae5VWUc.mjs → hub-mdns-ciao-D2sU6sKd.mjs} +2 -2
  95. package/system/dist/{hub-mdns-ciao-DP3_GNZw.js → hub-mdns-ciao-DNLnbJNG.js} +2 -2
  96. package/system/dist/index.js +24 -7
  97. package/system/dist/index.mjs +236 -219
  98. package/system/dist/{restore-archive-BJ5gxMvf.mjs → restore-archive-BGK6EnYj.mjs} +94 -94
  99. package/system/dist/{restore-archive-X9c_wEBY.js → restore-archive-xTqhDFkW.js} +1 -1
  100. package/system/dist/{retention-DBrdAv12.mjs → retention-CXu8PB2L.mjs} +1 -1
  101. package/system/dist/{retention-DRT2wUyB.js → retention-gQ3GIUA3.js} +1 -1
  102. package/system/dist/{wal-maintenance-Bi4yImEY.mjs → wal-maintenance-D7XmFaUD.mjs} +0 -0
  103. package/system/dist/{wal-maintenance-hsgNGrjh.js → wal-maintenance-Hwzm3DCe.js} +0 -0
  104. package/system/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.733] - 2026-11-02
11
+
12
+ ### Changed
13
+
14
+ - Rebuilt against updated dependencies.
15
+
16
+ ## [1.2.732] - 2026-11-02
17
+
18
+ ### Changed
19
+
20
+ - New devices on the network are proposed on the Integrations page without a manual scan, and dismissed proposals stay dismissed across restarts
21
+ - The hub holds debug watches and pushes the interest to every node; a debug channel cannot be armed from the Levels page.
22
+
10
23
  ## [1.2.731] - 2026-11-02
11
24
 
12
25
  ### Changed
@@ -167,6 +167,7 @@ function buildSystemProvider(feature, registry, logger, census = (0, http_reques
167
167
  getRequestCensus: async () => requestCensus.status(),
168
168
  getLoggingSettings: async (input) => loggingSettings.get(input.scopeNodeId, input.scopeComponent),
169
169
  setLoggingSettings: async (input) => loggingSettings.set(input.patch, input.scopeNodeId, input.scopeComponent),
170
+ debugWatch: async (input) => loggingSettings.debugWatch(input),
170
171
  };
171
172
  }
172
173
  /**
@@ -151,6 +151,8 @@ function buildLogChannelPlane(source, onProviderError) {
151
151
  * for the same reason: a diagnostic you can leave on becomes a tax nobody
152
152
  * remembers enabling.
153
153
  */
154
+ /** How often the hub sweeps lapsed debug watches. */
155
+ const WATCH_SWEEP_MS = 5_000;
154
156
  exports.MAX_CHANNEL_WINDOW_MS = 30 * 60_000;
155
157
  class LoggingSettingsService {
156
158
  store;
@@ -160,6 +162,10 @@ class LoggingSettingsService {
160
162
  logger;
161
163
  now;
162
164
  channels;
165
+ /** The live debug watches. Memory only: a restart is a stop. */
166
+ watches = new types_1.DebugWatchTable();
167
+ watchTimer = null;
168
+ lastRecord = {};
163
169
  constructor(deps) {
164
170
  this.store = deps.store;
165
171
  this.gate = deps.gate;
@@ -244,6 +250,74 @@ class LoggingSettingsService {
244
250
  }
245
251
  return this.describe(stored, scope, component);
246
252
  }
253
+ /**
254
+ * Start, re-arm, stop or list debug watches, then push the interest to every
255
+ * node. A refusal (an undeclared channel, no device) changes nothing.
256
+ */
257
+ async debugWatch(input) {
258
+ const nowMs = this.now();
259
+ const lapsed = [];
260
+ if (input.action === 'start') {
261
+ if (input.deviceIds.length === 0) {
262
+ throw new Error('debug watch refused: name at least one device');
263
+ }
264
+ const declared = await this.channels.declarations();
265
+ const debugNames = new Set(declared.filter((d) => d.kind === 'debug').map((d) => d.name));
266
+ const unknown = input.channels.filter((name) => !debugNames.has(name));
267
+ if (unknown.length > 0) {
268
+ throw new Error(`debug watch refused: not a declared debug channel: ${unknown.join(', ')}`);
269
+ }
270
+ for (const channel of input.channels)
271
+ this.watches.start(channel, input.deviceIds, nowMs);
272
+ }
273
+ else if (input.action === 'rearm') {
274
+ for (const channel of input.channels) {
275
+ if (this.watches.rearm(channel, nowMs) === 'lapsed')
276
+ lapsed.push(channel);
277
+ }
278
+ }
279
+ else if (input.action === 'stop') {
280
+ for (const channel of input.channels)
281
+ this.watches.stop(channel);
282
+ }
283
+ if (input.action !== 'list') {
284
+ // The push is the FULL set, so it carries the document's windows too: read
285
+ // them, and on a failed read fall back to the last value that was read (D49).
286
+ await this.pushChannels((await this.read()) ?? this.lastRecord);
287
+ this.logger?.info('debug watch changed', {
288
+ meta: {
289
+ action: input.action,
290
+ channels: input.channels,
291
+ deviceIds: input.deviceIds,
292
+ lapsed,
293
+ },
294
+ });
295
+ }
296
+ this.ensureWatchTimer();
297
+ return { nowMs, watches: this.watches.states(nowMs), lapsed };
298
+ }
299
+ /** Close lapsed watches here and push, so every node drops them even if its own timer is late. */
300
+ ensureWatchTimer() {
301
+ const live = this.watches.states(this.now()).length > 0;
302
+ if (!live) {
303
+ if (this.watchTimer !== null)
304
+ clearInterval(this.watchTimer);
305
+ this.watchTimer = null;
306
+ return;
307
+ }
308
+ if (this.watchTimer !== null)
309
+ return;
310
+ this.watchTimer = setInterval(() => {
311
+ const closed = this.watches.expire(this.now());
312
+ (0, types_1.getDebugInterest)().tick(this.now());
313
+ if (closed.length > 0) {
314
+ this.logger?.info('debug watch lapsed', { meta: { channels: closed } });
315
+ void this.pushChannels(this.lastRecord);
316
+ }
317
+ this.ensureWatchTimer();
318
+ }, WATCH_SWEEP_MS);
319
+ this.watchTimer.unref();
320
+ }
247
321
  /**
248
322
  * Re-establish the mirror and re-arm any diagnostic window that outlived the
249
323
  * last shutdown. Called once at boot, before the socket opens.
@@ -288,8 +362,14 @@ class LoggingSettingsService {
288
362
  * into a failed write for the whole cluster.
289
363
  */
290
364
  async pushChannels(record) {
365
+ this.lastRecord = record;
366
+ const nowMs = this.now();
367
+ // The document's windows and the debug watches travel as ONE full set: an
368
+ // apply that left the watches out would disarm them.
369
+ const windows = [...liveChannelWindows(record, nowMs), ...this.watches.windows(nowMs)];
370
+ (0, types_1.getDebugInterest)().apply(windows, nowMs);
291
371
  try {
292
- await this.channels.apply(liveChannelWindows(record, this.now()));
372
+ await this.channels.apply(windows);
293
373
  }
294
374
  catch (err) {
295
375
  this.logger?.warn('log channel windows written but NOT pushed to every gate', {
@@ -522,6 +602,13 @@ function validateChannelPatch(patches, declared) {
522
602
  (known.length > 0 ? ` (declared: ${known})` : ''));
523
603
  continue;
524
604
  }
605
+ if (descriptor.kind === 'debug' && patch.armMs > 0) {
606
+ // A debug channel is watched, never armed: the watch carries the 10
607
+ // minute window and the 60 minute cap, and an armed window would carry
608
+ // neither.
609
+ reasons.push(`"${patch.channel}" is a debug channel — watch it from Logs → Watch`);
610
+ continue;
611
+ }
525
612
  const ids = patch.deviceIds;
526
613
  if (ids !== undefined && ids !== null && ids.length > 0 && !descriptor.perDevice) {
527
614
  reasons.push(`"${patch.channel}" is declared perDevice: false — its lines carry no ` +
@@ -4199,6 +4199,46 @@ function createCapRouter_deviceManager(getProvider, createRemoteProxy) {
4199
4199
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4200
4200
  return p.discoverProvider(methodInput);
4201
4201
  }),
4202
+ listDiscoveryProposals: trpc_middleware_js_1.adminProcedure
4203
+ .input(types_53.deviceManagerCapability.methods.listDiscoveryProposals.input.loose())
4204
+ .output(types_53.deviceManagerCapability.methods.listDiscoveryProposals.output)
4205
+ .query(async ({ input, ctx }) => {
4206
+ const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
4207
+ const { nodeId, ...methodInput } = parsedInput;
4208
+ const p = resolveProvider('device-manager', nodeId, () => getProvider(ctx), createRemoteProxy);
4209
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4210
+ return p.listDiscoveryProposals(methodInput);
4211
+ }),
4212
+ dismissDiscoveryProposal: trpc_middleware_js_1.adminProcedure
4213
+ .input(types_53.deviceManagerCapability.methods.dismissDiscoveryProposal.input.loose())
4214
+ .output(types_53.deviceManagerCapability.methods.dismissDiscoveryProposal.output)
4215
+ .mutation(async ({ input, ctx }) => {
4216
+ const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
4217
+ const { nodeId, ...methodInput } = parsedInput;
4218
+ const p = resolveProvider('device-manager', nodeId, () => getProvider(ctx), createRemoteProxy);
4219
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4220
+ return p.dismissDiscoveryProposal(methodInput);
4221
+ }),
4222
+ reportDiscoveryObservations: trpc_middleware_js_1.adminProcedure
4223
+ .input(types_53.deviceManagerCapability.methods.reportDiscoveryObservations.input.loose())
4224
+ .output(types_53.deviceManagerCapability.methods.reportDiscoveryObservations.output)
4225
+ .mutation(async ({ input, ctx }) => {
4226
+ const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
4227
+ const { nodeId, ...methodInput } = parsedInput;
4228
+ const p = resolveProvider('device-manager', nodeId, () => getProvider(ctx), createRemoteProxy);
4229
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4230
+ return p.reportDiscoveryObservations(methodInput);
4231
+ }),
4232
+ runDiscoverySweep: trpc_middleware_js_1.adminProcedure
4233
+ .input(types_53.deviceManagerCapability.methods.runDiscoverySweep.input.loose())
4234
+ .output(types_53.deviceManagerCapability.methods.runDiscoverySweep.output)
4235
+ .mutation(async ({ input, ctx }) => {
4236
+ const parsedInput = ctx.req !== undefined ? (0, types_3.withoutCallerStamp)(input) : input;
4237
+ const { nodeId, ...methodInput } = parsedInput;
4238
+ const p = resolveProvider('device-manager', nodeId, () => getProvider(ctx), createRemoteProxy);
4239
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
4240
+ return p.runDiscoverySweep(methodInput);
4241
+ }),
4202
4242
  providerCreationType: trpc_middleware_js_1.adminProcedure
4203
4243
  .input(types_53.deviceManagerCapability.methods.providerCreationType.input.loose())
4204
4244
  .output(types_53.deviceManagerCapability.methods.providerCreationType.output)
@@ -12870,6 +12910,15 @@ function createCapRouter_system(getProvider, createRemoteProxy) {
12870
12910
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
12871
12911
  return p.setLoggingSettings(methodInput);
12872
12912
  }),
12913
+ debugWatch: trpc_middleware_js_1.adminProcedure
12914
+ .input(types_149.systemCapability.methods.debugWatch.input.loose())
12915
+ .output(types_149.systemCapability.methods.debugWatch.output)
12916
+ .mutation(async ({ input, ctx }) => {
12917
+ const { nodeId, ...methodInput } = input;
12918
+ const p = resolveProvider('system', nodeId, () => getProvider(ctx), createRemoteProxy);
12919
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
12920
+ return p.debugWatch(methodInput);
12921
+ }),
12873
12922
  });
12874
12923
  }
12875
12924
  function createCapRouter_tamper(getProvider, createRemoteProxy) {