@camstack/server 1.2.730 → 1.2.732

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 (105) hide show
  1. package/CHANGELOG.md +15 -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/core/server-management.provider.js +10 -3
  5. package/dist/api/trpc/generated-cap-mounts.js +2 -1
  6. package/dist/api/trpc/generated-cap-routers.js +1850 -1777
  7. package/dist/boot/boot-config.js +2 -46
  8. package/dist/core/addon/addon-registry.service.js +61 -59
  9. package/dist/launch-args.js +72 -34
  10. package/dist/main.js +2 -1
  11. package/package.json +14 -19
  12. package/system/dist/addon-runner.js +82911 -12
  13. package/system/dist/addon-runner.mjs +82910 -11
  14. package/system/dist/{agent-https-DZq8uf8L.mjs → agent-https-CDtAIEne.mjs} +1 -1
  15. package/system/dist/{agent-https-C8Gz2jjS.js → agent-https-DKMO-__h.js} +1 -1
  16. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  17. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  18. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  19. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  20. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  21. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  22. package/system/dist/builtins/autotrack/index.js +1 -1
  23. package/system/dist/builtins/autotrack/index.mjs +1 -1
  24. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  25. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  26. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  27. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  28. package/system/dist/builtins/camera-grid/index.js +1 -1
  29. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  30. package/system/dist/builtins/composer/composer.addon.js +3 -3
  31. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  32. package/system/dist/builtins/console-logging/index.js +1 -1
  33. package/system/dist/builtins/console-logging/index.mjs +1 -1
  34. package/system/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  35. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  36. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  37. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  38. package/system/dist/builtins/device-manager/device-manager.addon.js +220 -16
  39. package/system/dist/builtins/device-manager/device-manager.addon.mjs +220 -16
  40. package/system/dist/builtins/device-manager/discovery-proposal-service.d.ts +38 -0
  41. package/system/dist/builtins/device-manager/discovery-proposal-store.d.ts +28 -0
  42. package/system/dist/builtins/device-manager/record-kinds.d.ts +2 -1
  43. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  44. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  45. package/system/dist/builtins/keychain/index.js +3 -3
  46. package/system/dist/builtins/keychain/index.mjs +3 -3
  47. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  48. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  49. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  50. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  51. package/system/dist/builtins/local-network/local-network.addon.d.ts +10 -0
  52. package/system/dist/builtins/local-network/local-network.addon.js +250 -181
  53. package/system/dist/builtins/local-network/local-network.addon.mjs +244 -175
  54. package/system/dist/builtins/local-network/passive/discovery-watcher.d.ts +60 -0
  55. package/system/dist/builtins/local-network/passive/passive-io-node.d.ts +2 -0
  56. package/system/dist/builtins/local-network/passive/passive-packets.d.ts +10 -0
  57. package/system/dist/builtins/loki-logging/index.js +1 -1
  58. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  59. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  60. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  61. package/system/dist/builtins/platform-probe/index.js +1 -1
  62. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  63. package/system/dist/builtins/record-entries/index.js +1 -1
  64. package/system/dist/builtins/record-entries/index.mjs +1 -1
  65. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  66. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  67. package/system/dist/builtins/snapshot/index.js +1 -1
  68. package/system/dist/builtins/snapshot/index.mjs +1 -1
  69. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  70. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  71. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  72. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  73. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  74. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  75. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  76. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  77. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  78. package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
  79. package/system/dist/builtins/winston-logging/index.js +1 -1
  80. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  81. package/system/dist/{composition-sources-4M_NnTnV.mjs → composition-sources-Ca7JEbmu.mjs} +1 -1
  82. package/system/dist/{composition-sources-hokiaS3J.js → composition-sources-UQohOHgd.js} +1 -1
  83. package/system/dist/{constants-B0L3suFC.js → constants-CLA4ogvA.js} +1 -1
  84. package/system/dist/{constants-DTVU00LZ.mjs → constants-iG57sUNp.mjs} +1 -1
  85. package/system/dist/{device-ca-C_y2GrU5.mjs → device-ca--iHw76cR.mjs} +1 -1
  86. package/system/dist/{device-ca-DaTT1Y9v.js → device-ca-BUcHAAew.js} +1 -1
  87. package/system/dist/{dist-9lvgpcnm.mjs → dist-C_cZ9rGK.mjs} +404 -18
  88. package/system/dist/{dist-B3S0ruBa.js → dist-qO48FNMZ.js} +427 -17
  89. package/system/dist/dns-wire-CHXO1qSl.js +199 -0
  90. package/system/dist/dns-wire-DcL6a0L-.mjs +170 -0
  91. package/system/dist/file-host-worker.js +1 -1
  92. package/system/dist/file-host-worker.mjs +1 -1
  93. package/system/dist/{hub-mdns-ciao-xgLfZIVx.mjs → hub-mdns-ciao-9wPOmsXd.mjs} +2 -2
  94. package/system/dist/{hub-mdns-ciao-Dkw38L-g.js → hub-mdns-ciao-DDmMPZCN.js} +2 -2
  95. package/system/dist/index.d.ts +1 -1
  96. package/system/dist/index.js +36 -9
  97. package/system/dist/index.mjs +36 -10
  98. package/system/dist/kernel/heap-watch.d.ts +7 -2
  99. package/system/dist/{restore-archive-cxnuWxQM.mjs → restore-archive-BHVjOlza.mjs} +1 -1
  100. package/system/dist/{restore-archive-orP6eHBd.js → restore-archive-Cravj5LG.js} +1 -1
  101. package/system/dist/{retention-CB2cyW9k.js → retention-B_eloRtb.js} +1 -1
  102. package/system/dist/{retention-Me4u6zMp.mjs → retention-C_9dxCQn.mjs} +1 -1
  103. package/system/dist/{wal-maintenance-_PXj626-.js → wal-maintenance-CfKeIQAG.js} +0 -0
  104. package/system/dist/{wal-maintenance-De7Ifvph.mjs → wal-maintenance-Dw7rplkv.mjs} +0 -0
  105. package/system/package.json +4 -1
@@ -0,0 +1,199 @@
1
+ //#region src/builtins/local-network/scan/dns-wire.ts
2
+ /**
3
+ * DNS-SD wire format for the scan engine: one PTR question per service type,
4
+ * and a parser that turns an answer into services (instance, host, port, TXT).
5
+ */
6
+ /** Top bit of the question class: ask for a unicast reply (RFC 6762). */
7
+ var MDNS_QU_CLASS = 32769;
8
+ var A = 1;
9
+ var PTR = 12;
10
+ var TXT = 16;
11
+ var SRV = 33;
12
+ var SRV_FIXED = 6;
13
+ var MAX_NAME_HOPS = 16;
14
+ var MDNS_PORT = 5353;
15
+ var MDNS_GROUP = "224.0.0.251";
16
+ /** `_esphomelib._tcp` and `_esphomelib._tcp.local.` name the same service. */
17
+ function normalizeServiceType(serviceType) {
18
+ const lower = serviceType.trim().toLowerCase().replace(/\.$/, "");
19
+ return lower.endsWith(".local") ? lower.slice(0, -6) : lower;
20
+ }
21
+ function readName(buf, start) {
22
+ const labels = [];
23
+ let pos = start;
24
+ let end = start;
25
+ let jumped = false;
26
+ for (let hops = 0; hops < MAX_NAME_HOPS; hops++) {
27
+ if (pos < 0 || pos >= buf.length) return null;
28
+ const len = buf[pos] ?? 0;
29
+ if (len === 0) {
30
+ if (!jumped) end = pos + 1;
31
+ return {
32
+ name: labels.join("."),
33
+ end
34
+ };
35
+ }
36
+ if ((len & 192) === 192) {
37
+ if (pos + 1 >= buf.length) return null;
38
+ if (!jumped) end = pos + 2;
39
+ jumped = true;
40
+ pos = (len & 63) << 8 | (buf[pos + 1] ?? 0);
41
+ continue;
42
+ }
43
+ if ((len & 192) !== 0 || pos + 1 + len > buf.length) return null;
44
+ labels.push(buf.subarray(pos + 1, pos + 1 + len).toString("utf8"));
45
+ pos += 1 + len;
46
+ if (!jumped) end = pos;
47
+ }
48
+ return null;
49
+ }
50
+ function readRecords(buf, offset, count) {
51
+ const records = [];
52
+ let pos = offset;
53
+ for (let i = 0; i < count; i++) {
54
+ const name = readName(buf, pos);
55
+ if (name === null || name.end + 10 > buf.length) return null;
56
+ const type = buf.readUInt16BE(name.end);
57
+ const dataLength = buf.readUInt16BE(name.end + 8);
58
+ const dataOffset = name.end + 10;
59
+ if (dataOffset + dataLength > buf.length) return null;
60
+ records.push({
61
+ name: name.name,
62
+ type,
63
+ dataOffset,
64
+ dataLength
65
+ });
66
+ pos = dataOffset + dataLength;
67
+ }
68
+ return {
69
+ records,
70
+ next: pos
71
+ };
72
+ }
73
+ function parseTxt(buf, offset, length) {
74
+ const out = {};
75
+ let pos = offset;
76
+ const end = offset + length;
77
+ while (pos < end) {
78
+ const len = buf[pos] ?? 0;
79
+ pos += 1;
80
+ if (len === 0 || pos + len > end) break;
81
+ const entry = buf.subarray(pos, pos + len).toString("utf8");
82
+ pos += len;
83
+ const eq = entry.indexOf("=");
84
+ if (eq < 0) out[entry] = "";
85
+ else out[entry.slice(0, eq)] = entry.slice(eq + 1);
86
+ }
87
+ return out;
88
+ }
89
+ /** One PTR question per service type, all with the unicast-reply bit. */
90
+ function buildPtrQuery(serviceTypes) {
91
+ const header = Buffer.alloc(12);
92
+ header.writeUInt16BE(serviceTypes.length, 4);
93
+ const questions = serviceTypes.map((type) => {
94
+ const encoded = `${normalizeServiceType(type)}.local`.split(".").filter((part) => part.length > 0).map((l) => Buffer.concat([Buffer.from([l.length]), Buffer.from(l)]));
95
+ const tail = Buffer.alloc(4);
96
+ tail.writeUInt16BE(PTR, 0);
97
+ tail.writeUInt16BE(MDNS_QU_CLASS, 2);
98
+ return Buffer.concat([
99
+ ...encoded,
100
+ Buffer.from([0]),
101
+ tail
102
+ ]);
103
+ });
104
+ return Buffer.concat([header, ...questions]);
105
+ }
106
+ /** The services advertised on one mDNS message; a malformed packet yields none. */
107
+ function parseMdnsMessage(buf) {
108
+ if (buf.length < 12) return [];
109
+ const [questions = 0, answers = 0, authorities = 0, extra = 0] = [
110
+ 4,
111
+ 6,
112
+ 8,
113
+ 10
114
+ ].map((o) => buf.readUInt16BE(o));
115
+ let pos = 12;
116
+ for (let i = 0; i < questions; i++) {
117
+ const name = readName(buf, pos);
118
+ if (name === null) return [];
119
+ pos = name.end + 4;
120
+ if (pos > buf.length) return [];
121
+ }
122
+ const records = [];
123
+ for (const count of [
124
+ answers,
125
+ authorities,
126
+ extra
127
+ ]) {
128
+ const read = readRecords(buf, pos, count);
129
+ if (read === null) return [];
130
+ records.push(...read.records);
131
+ pos = read.next;
132
+ }
133
+ const ptrs = [];
134
+ const srv = /* @__PURE__ */ new Map();
135
+ const txt = /* @__PURE__ */ new Map();
136
+ const addresses = /* @__PURE__ */ new Map();
137
+ for (const rec of records) {
138
+ const key = rec.name.toLowerCase();
139
+ if (rec.type === PTR) {
140
+ const target = readName(buf, rec.dataOffset);
141
+ if (target !== null) ptrs.push({
142
+ serviceType: rec.name,
143
+ instance: target.name
144
+ });
145
+ } else if (rec.type === SRV && rec.dataLength >= SRV_FIXED) {
146
+ const target = readName(buf, rec.dataOffset + SRV_FIXED);
147
+ if (target !== null) srv.set(key, {
148
+ target: target.name,
149
+ port: buf.readUInt16BE(rec.dataOffset + 4)
150
+ });
151
+ } else if (rec.type === TXT) txt.set(key, parseTxt(buf, rec.dataOffset, rec.dataLength));
152
+ else if (rec.type === A && rec.dataLength === 4) addresses.set(key, `${buf[rec.dataOffset]}.${buf[rec.dataOffset + 1]}.${buf[rec.dataOffset + 2]}.${buf[rec.dataOffset + 3]}`);
153
+ }
154
+ const out = [];
155
+ for (const { serviceType, instance } of ptrs) {
156
+ const service = srv.get(instance.toLowerCase());
157
+ const target = service?.target ?? instance;
158
+ out.push({
159
+ serviceType: normalizeServiceType(serviceType),
160
+ instance,
161
+ address: addresses.get(target.toLowerCase()) ?? addresses.get(instance.toLowerCase()) ?? null,
162
+ host: target,
163
+ port: service?.port ?? 0,
164
+ txt: txt.get(instance.toLowerCase()) ?? {}
165
+ });
166
+ }
167
+ return out;
168
+ }
169
+ //#endregion
170
+ Object.defineProperty(exports, "MDNS_GROUP", {
171
+ enumerable: true,
172
+ get: function() {
173
+ return MDNS_GROUP;
174
+ }
175
+ });
176
+ Object.defineProperty(exports, "MDNS_PORT", {
177
+ enumerable: true,
178
+ get: function() {
179
+ return MDNS_PORT;
180
+ }
181
+ });
182
+ Object.defineProperty(exports, "buildPtrQuery", {
183
+ enumerable: true,
184
+ get: function() {
185
+ return buildPtrQuery;
186
+ }
187
+ });
188
+ Object.defineProperty(exports, "normalizeServiceType", {
189
+ enumerable: true,
190
+ get: function() {
191
+ return normalizeServiceType;
192
+ }
193
+ });
194
+ Object.defineProperty(exports, "parseMdnsMessage", {
195
+ enumerable: true,
196
+ get: function() {
197
+ return parseMdnsMessage;
198
+ }
199
+ });
@@ -0,0 +1,170 @@
1
+ //#region src/builtins/local-network/scan/dns-wire.ts
2
+ /**
3
+ * DNS-SD wire format for the scan engine: one PTR question per service type,
4
+ * and a parser that turns an answer into services (instance, host, port, TXT).
5
+ */
6
+ /** Top bit of the question class: ask for a unicast reply (RFC 6762). */
7
+ var MDNS_QU_CLASS = 32769;
8
+ var A = 1;
9
+ var PTR = 12;
10
+ var TXT = 16;
11
+ var SRV = 33;
12
+ var SRV_FIXED = 6;
13
+ var MAX_NAME_HOPS = 16;
14
+ var MDNS_PORT = 5353;
15
+ var MDNS_GROUP = "224.0.0.251";
16
+ /** `_esphomelib._tcp` and `_esphomelib._tcp.local.` name the same service. */
17
+ function normalizeServiceType(serviceType) {
18
+ const lower = serviceType.trim().toLowerCase().replace(/\.$/, "");
19
+ return lower.endsWith(".local") ? lower.slice(0, -6) : lower;
20
+ }
21
+ function readName(buf, start) {
22
+ const labels = [];
23
+ let pos = start;
24
+ let end = start;
25
+ let jumped = false;
26
+ for (let hops = 0; hops < MAX_NAME_HOPS; hops++) {
27
+ if (pos < 0 || pos >= buf.length) return null;
28
+ const len = buf[pos] ?? 0;
29
+ if (len === 0) {
30
+ if (!jumped) end = pos + 1;
31
+ return {
32
+ name: labels.join("."),
33
+ end
34
+ };
35
+ }
36
+ if ((len & 192) === 192) {
37
+ if (pos + 1 >= buf.length) return null;
38
+ if (!jumped) end = pos + 2;
39
+ jumped = true;
40
+ pos = (len & 63) << 8 | (buf[pos + 1] ?? 0);
41
+ continue;
42
+ }
43
+ if ((len & 192) !== 0 || pos + 1 + len > buf.length) return null;
44
+ labels.push(buf.subarray(pos + 1, pos + 1 + len).toString("utf8"));
45
+ pos += 1 + len;
46
+ if (!jumped) end = pos;
47
+ }
48
+ return null;
49
+ }
50
+ function readRecords(buf, offset, count) {
51
+ const records = [];
52
+ let pos = offset;
53
+ for (let i = 0; i < count; i++) {
54
+ const name = readName(buf, pos);
55
+ if (name === null || name.end + 10 > buf.length) return null;
56
+ const type = buf.readUInt16BE(name.end);
57
+ const dataLength = buf.readUInt16BE(name.end + 8);
58
+ const dataOffset = name.end + 10;
59
+ if (dataOffset + dataLength > buf.length) return null;
60
+ records.push({
61
+ name: name.name,
62
+ type,
63
+ dataOffset,
64
+ dataLength
65
+ });
66
+ pos = dataOffset + dataLength;
67
+ }
68
+ return {
69
+ records,
70
+ next: pos
71
+ };
72
+ }
73
+ function parseTxt(buf, offset, length) {
74
+ const out = {};
75
+ let pos = offset;
76
+ const end = offset + length;
77
+ while (pos < end) {
78
+ const len = buf[pos] ?? 0;
79
+ pos += 1;
80
+ if (len === 0 || pos + len > end) break;
81
+ const entry = buf.subarray(pos, pos + len).toString("utf8");
82
+ pos += len;
83
+ const eq = entry.indexOf("=");
84
+ if (eq < 0) out[entry] = "";
85
+ else out[entry.slice(0, eq)] = entry.slice(eq + 1);
86
+ }
87
+ return out;
88
+ }
89
+ /** One PTR question per service type, all with the unicast-reply bit. */
90
+ function buildPtrQuery(serviceTypes) {
91
+ const header = Buffer.alloc(12);
92
+ header.writeUInt16BE(serviceTypes.length, 4);
93
+ const questions = serviceTypes.map((type) => {
94
+ const encoded = `${normalizeServiceType(type)}.local`.split(".").filter((part) => part.length > 0).map((l) => Buffer.concat([Buffer.from([l.length]), Buffer.from(l)]));
95
+ const tail = Buffer.alloc(4);
96
+ tail.writeUInt16BE(PTR, 0);
97
+ tail.writeUInt16BE(MDNS_QU_CLASS, 2);
98
+ return Buffer.concat([
99
+ ...encoded,
100
+ Buffer.from([0]),
101
+ tail
102
+ ]);
103
+ });
104
+ return Buffer.concat([header, ...questions]);
105
+ }
106
+ /** The services advertised on one mDNS message; a malformed packet yields none. */
107
+ function parseMdnsMessage(buf) {
108
+ if (buf.length < 12) return [];
109
+ const [questions = 0, answers = 0, authorities = 0, extra = 0] = [
110
+ 4,
111
+ 6,
112
+ 8,
113
+ 10
114
+ ].map((o) => buf.readUInt16BE(o));
115
+ let pos = 12;
116
+ for (let i = 0; i < questions; i++) {
117
+ const name = readName(buf, pos);
118
+ if (name === null) return [];
119
+ pos = name.end + 4;
120
+ if (pos > buf.length) return [];
121
+ }
122
+ const records = [];
123
+ for (const count of [
124
+ answers,
125
+ authorities,
126
+ extra
127
+ ]) {
128
+ const read = readRecords(buf, pos, count);
129
+ if (read === null) return [];
130
+ records.push(...read.records);
131
+ pos = read.next;
132
+ }
133
+ const ptrs = [];
134
+ const srv = /* @__PURE__ */ new Map();
135
+ const txt = /* @__PURE__ */ new Map();
136
+ const addresses = /* @__PURE__ */ new Map();
137
+ for (const rec of records) {
138
+ const key = rec.name.toLowerCase();
139
+ if (rec.type === PTR) {
140
+ const target = readName(buf, rec.dataOffset);
141
+ if (target !== null) ptrs.push({
142
+ serviceType: rec.name,
143
+ instance: target.name
144
+ });
145
+ } else if (rec.type === SRV && rec.dataLength >= SRV_FIXED) {
146
+ const target = readName(buf, rec.dataOffset + SRV_FIXED);
147
+ if (target !== null) srv.set(key, {
148
+ target: target.name,
149
+ port: buf.readUInt16BE(rec.dataOffset + 4)
150
+ });
151
+ } else if (rec.type === TXT) txt.set(key, parseTxt(buf, rec.dataOffset, rec.dataLength));
152
+ else if (rec.type === A && rec.dataLength === 4) addresses.set(key, `${buf[rec.dataOffset]}.${buf[rec.dataOffset + 1]}.${buf[rec.dataOffset + 2]}.${buf[rec.dataOffset + 3]}`);
153
+ }
154
+ const out = [];
155
+ for (const { serviceType, instance } of ptrs) {
156
+ const service = srv.get(instance.toLowerCase());
157
+ const target = service?.target ?? instance;
158
+ out.push({
159
+ serviceType: normalizeServiceType(serviceType),
160
+ instance,
161
+ address: addresses.get(target.toLowerCase()) ?? addresses.get(instance.toLowerCase()) ?? null,
162
+ host: target,
163
+ port: service?.port ?? 0,
164
+ txt: txt.get(instance.toLowerCase()) ?? {}
165
+ });
166
+ }
167
+ return out;
168
+ }
169
+ //#endregion
170
+ export { parseMdnsMessage as a, normalizeServiceType as i, MDNS_PORT as n, buildPtrQuery as r, MDNS_GROUP as t };
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Cek0wNdY.js");
2
- const require_wal_maintenance = require("./wal-maintenance-_PXj626-.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-CfKeIQAG.js");
3
3
  let node_worker_threads = require("node:worker_threads");
4
4
  //#region src/builtins/sqlite-storage/file-host-worker.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-De7Ifvph.mjs";
1
+ import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-Dw7rplkv.mjs";
2
2
  import { parentPort, threadId, workerData } from "node:worker_threads";
3
3
  //#region src/builtins/sqlite-storage/file-host-worker.ts
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
2
- import { Rs as userError } from "./dist-9lvgpcnm.mjs";
2
+ import { Hs as userError } from "./dist-C_cZ9rGK.mjs";
3
3
  import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
4
- import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-DZq8uf8L.mjs";
4
+ import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-CDtAIEne.mjs";
5
5
  import { X509Certificate, createPrivateKey } from "node:crypto";
6
6
  import { writeOwnerOnlyFileSync } from "@camstack/types/node";
7
7
  import { mkdir, writeFile } from "node:fs/promises";
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-B3S0ruBa.js");
2
+ const require_dist = require("./dist-qO48FNMZ.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
- const require_agent_https = require("./agent-https-C8Gz2jjS.js");
4
+ const require_agent_https = require("./agent-https-DKMO-__h.js");
5
5
  let node_crypto = require("node:crypto");
6
6
  let _camstack_types_node = require("@camstack/types/node");
7
7
  let node_fs_promises = require("node:fs/promises");
@@ -87,7 +87,7 @@ export { DECISIVE_HEAP_SPACES, emitHeapDiagnosticReport, formatHeapSpaces, HEAP_
87
87
  export type { ArrayBufferCensus, ArrayBufferCensusContext, ArrayBufferCensusGate, ArrayBufferCensusGateOptions, ArrayBufferCensusReport, ArrayBufferCensusVerdict, ArrayBufferExactSize, ArrayBufferSizeBucket } from "./kernel/array-buffer-census.js";
88
88
  export { ARRAY_BUFFER_CENSUS_COOLDOWN_MS, ARRAY_BUFFER_CENSUS_SUSTAIN_MS, ARRAY_BUFFER_CENSUS_THRESHOLD_MB, ARRAY_BUFFER_RELEASE_MIN_DROP_RATIO, createArrayBufferCensusGate, createInspectorArrayBufferCensus, formatArrayBufferCensus, isArrayBufferCensusReport } from "./kernel/array-buffer-census.js";
89
89
  export type { ArrayBufferCensusProbe, DeferredHeapWatchSink, HeapReclaimer, HeapReclaimOptions, HeapSample, HeapWatchProbes, HeapWatchSink, LoopDelayMeter, LoopDelaySample, RssBreakdown, RssBudgetOptions, RssBudgetState, RssGrowthShape, RunnerHeapWatchOptions } from "./kernel/heap-watch.js";
90
- export { AGENT_MAIN_HEAP_WATCH_LABEL, buildHeapSample, createDeferredHeapWatchSink, createLoopDelayMeter, createV8Reclaimer, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_STEADY_STATE_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_MAIN_HEAP_WATCH_LABEL, HUB_MAIN_RSS_BUDGET_MB, HUB_RSS_BUDGET_ENV, hubMainRssBudget, describeRss, nextRssBudgetState, parseRssBudgetMb, reclaimIntervalMs, RSS_BUDGET_REANNOUNCE_MIN_MS, RSS_BUDGET_RELEASE_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, RUNNER_RSS_BUDGET_ENV, shouldReclaim, startHeapWatch, startRunnerHeapWatch, strandedMb, ZERO_LOOP_DELAY } from "./kernel/heap-watch.js";
90
+ export { AGENT_MAIN_HEAP_WATCH_LABEL, buildHeapSample, createDeferredHeapWatchSink, createLoopDelayMeter, createV8Reclaimer, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_STEADY_STATE_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_MAIN_HEAP_WATCH_LABEL, HUB_MAIN_RSS_BUDGET_MB, HUB_RSS_BUDGET_ENV, HUB_RSS_BUDGET_OVERRIDE_SOURCE, hubMainRssBudget, describeRss, nextRssBudgetState, parseRssBudgetMb, reclaimIntervalMs, RSS_BUDGET_REANNOUNCE_MIN_MS, RSS_BUDGET_RELEASE_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, RUNNER_RSS_BUDGET_ENV, shouldReclaim, startHeapWatch, startRunnerHeapWatch, strandedMb, ZERO_LOOP_DELAY } from "./kernel/heap-watch.js";
91
91
  export type { StallVerdict } from "./kernel/event-loop-stall-monitor.js";
92
92
  export { attributeStall, STALL_REPORT_MS, STALL_TICK_MS, startEventLoopStallMonitor } from "./kernel/event-loop-stall-monitor.js";
93
93
  export type { AddonDataPlaneFacility, DataPlaneSink } from "./kernel/moleculer/addon-data-plane-facility.js";
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
- const require_dist = require("./dist-B3S0ruBa.js");
4
- const require_device_ca = require("./device-ca-DaTT1Y9v.js");
3
+ const require_dist = require("./dist-qO48FNMZ.js");
4
+ const require_device_ca = require("./device-ca-BUcHAAew.js");
5
5
  const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
6
6
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
7
7
  require("./builtins/alerts/index.js");
@@ -26,21 +26,21 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
26
26
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
27
27
  const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
28
28
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
29
- const require_wal_maintenance = require("./wal-maintenance-_PXj626-.js");
29
+ const require_wal_maintenance = require("./wal-maintenance-CfKeIQAG.js");
30
30
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
31
31
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
32
32
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
33
33
  require("./builtins/storage-orchestrator/index.js");
34
- const require_agent_https = require("./agent-https-C8Gz2jjS.js");
35
- const require_constants = require("./constants-B0L3suFC.js");
34
+ const require_agent_https = require("./agent-https-DKMO-__h.js");
35
+ const require_constants = require("./constants-CLA4ogvA.js");
36
36
  const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
37
37
  require("./builtins/system-config/index.js");
38
38
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
39
39
  const require_custom_action_registry = require("./custom-action-registry-JuMHGKEc.js");
40
- const require_hub_mdns_ciao = require("./hub-mdns-ciao-Dkw38L-g.js");
40
+ const require_hub_mdns_ciao = require("./hub-mdns-ciao-DDmMPZCN.js");
41
41
  const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
42
42
  const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
43
- const require_restore_archive = require("./restore-archive-orP6eHBd.js");
43
+ const require_restore_archive = require("./restore-archive-Cravj5LG.js");
44
44
  const require_coral_accelerators = require("./coral-accelerators-BSVsBVzt.js");
45
45
  let zod = require("zod");
46
46
  let node_crypto = require("node:crypto");
@@ -2991,8 +2991,17 @@ var HUB_RSS_BUDGET_ENV = "CAMSTACK_HUB_RSS_BUDGET_MB";
2991
2991
  * instead of being absorbed by a threshold nobody set.
2992
2992
  */
2993
2993
  var HUB_MAIN_RSS_BUDGET_MB = 4096;
2994
- /** hub-main's budget: the declared number, or the operator's override. */
2995
- function hubMainRssBudget(env = process.env) {
2994
+ /** Source label when the budget comes from the node's launch-overrides setting. */
2995
+ var HUB_RSS_BUDGET_OVERRIDE_SOURCE = "node setting (launch-overrides.json rssBudgetMb)";
2996
+ /**
2997
+ * hub-main's budget: the node setting (`overrideMb`, from `launch-overrides.json`),
2998
+ * else the operator's env override, else the declared number.
2999
+ */
3000
+ function hubMainRssBudget(env = process.env, overrideMb = null) {
3001
+ if (overrideMb !== null) return {
3002
+ budgetMb: overrideMb,
3003
+ source: HUB_RSS_BUDGET_OVERRIDE_SOURCE
3004
+ };
2996
3005
  const override = env[HUB_RSS_BUDGET_ENV];
2997
3006
  if (override !== void 0) return {
2998
3007
  budgetMb: parseRssBudgetMb(override),
@@ -3980,6 +3989,17 @@ function matchesLogTags(entryTags, filterTags) {
3980
3989
  }
3981
3990
  return true;
3982
3991
  }
3992
+ /**
3993
+ * A `debug.<channel>` line enters the ring only while somebody is watching
3994
+ * that device — a disabled channel never costs ring space. Every other line
3995
+ * is admitted unchanged.
3996
+ */
3997
+ function admitsDebugLine(entry) {
3998
+ const channel = entry.tags?.logChannel;
3999
+ if (channel === void 0 || !require_dist.isDebugChannelName(channel)) return true;
4000
+ const deviceId = entry.tags?.deviceId;
4001
+ return typeof deviceId === "number" && require_dist.getDebugInterest().wants(channel, deviceId);
4002
+ }
3983
4003
  var LogRingBuffer = class {
3984
4004
  capacity;
3985
4005
  buffer;
@@ -3990,6 +4010,7 @@ var LogRingBuffer = class {
3990
4010
  this.buffer = Array.from({ length: capacity });
3991
4011
  }
3992
4012
  push(entry) {
4013
+ if (!admitsDebugLine(entry)) return;
3993
4014
  this.buffer[this.head] = entry;
3994
4015
  this.head = (this.head + 1) % this.capacity;
3995
4016
  if (this.count < this.capacity) this.count++;
@@ -24124,6 +24145,7 @@ async function buildAddonContext(runtime, declaration, dataDir, options) {
24124
24145
  id: addonId,
24125
24146
  logger: scopedLogger,
24126
24147
  eventBus: scopedEventBus,
24148
+ debug: require_dist.createDebugEmitter(scopedLogger),
24127
24149
  addonConfig: options?.addonConfig ?? {},
24128
24150
  dataDir: addonDataDir,
24129
24151
  nodeDataDir,
@@ -27538,6 +27560,8 @@ var en_default = {
27538
27560
  "globalSettings.s_local-access.httpPort.description": "Dedicated listener. Must not equal the HTTPS port (4443 by default).",
27539
27561
  "globalSettings.s_local-access.mdnsAdvertise.label": "Announce this hub on the LAN (mDNS)",
27540
27562
  "globalSettings.s_local-access.mdnsAdvertise.description": "Lets `camstack login` find the hub without an address. Advertises only the HTTPS address, never a secret. Needs UDP 5353 multicast to reach the LAN (host networking or a dedicated container IP).",
27563
+ "globalSettings.s_local-access.passiveDiscovery.label": "Find new devices on the LAN by listening",
27564
+ "globalSettings.s_local-access.passiveDiscovery.description": "On by default. Listens for mDNS and SSDP announcements and proposes the devices an integration can adopt; a low-cost scan also runs every 30 minutes. It never sends a probe of its own. Needs UDP multicast to reach the LAN (host networking or a dedicated container IP).",
27541
27565
  "globalSettings.s_local-access.localHostname.label": "Local hostname",
27542
27566
  "globalSettings.s_local-access.localHostname.description": "Advertised to the viewer instead of the raw LAN IP, and added to the certificate SAN. Requires this name to resolve on the LAN (router DNS, mDNS, or a hosts file). Leave empty to keep using the IP.",
27543
27567
  "globalSettings.s_loki-logging.title": "Loki",
@@ -27801,6 +27825,8 @@ var it_default = {
27801
27825
  "globalSettings.s_local-access.httpPort.description": "Listener dedicato. Non deve coincidere con la porta HTTPS (4443 per impostazione predefinita).",
27802
27826
  "globalSettings.s_local-access.mdnsAdvertise.label": "Annuncia questo hub sulla LAN (mDNS)",
27803
27827
  "globalSettings.s_local-access.mdnsAdvertise.description": "Permette a `camstack login` di trovare l'hub senza indirizzo. Annuncia solo l'indirizzo HTTPS, mai un segreto. Richiede il multicast UDP 5353 per raggiungere la LAN (rete host o IP dedicato del container).",
27828
+ "globalSettings.s_local-access.passiveDiscovery.label": "Trova nuovi dispositivi in rete restando in ascolto",
27829
+ "globalSettings.s_local-access.passiveDiscovery.description": "Attivo di default. Ascolta gli annunci mDNS e SSDP e propone i dispositivi che un'integrazione puo' adottare; ogni 30 minuti parte anche una scansione leggera. Non invia mai sonde proprie. Richiede che il multicast UDP raggiunga la LAN (rete host o IP dedicato al container).",
27804
27830
  "globalSettings.s_local-access.localHostname.label": "Nome host locale",
27805
27831
  "globalSettings.s_local-access.localHostname.description": "Annunciato al visualizzatore al posto dell'IP LAN grezzo e aggiunto al SAN del certificato. Richiede che questo nome si risolva sulla LAN (DNS del router, mDNS o file hosts). Lascia vuoto per continuare a usare l'IP.",
27806
27832
  "globalSettings.s_loki-logging.title": "Loki",
@@ -28117,6 +28143,7 @@ exports.HUB_CAP_FWD_SERVICE = require_builtins_storage_orchestrator_storage_orch
28117
28143
  exports.HUB_MAIN_HEAP_WATCH_LABEL = HUB_MAIN_HEAP_WATCH_LABEL;
28118
28144
  exports.HUB_MAIN_RSS_BUDGET_MB = HUB_MAIN_RSS_BUDGET_MB;
28119
28145
  exports.HUB_RSS_BUDGET_ENV = HUB_RSS_BUDGET_ENV;
28146
+ exports.HUB_RSS_BUDGET_OVERRIDE_SOURCE = HUB_RSS_BUDGET_OVERRIDE_SOURCE;
28120
28147
  exports.HubForwarderAddon = require_builtins_hub_forwarder_index.HubForwarderAddon$1;
28121
28148
  exports.HubForwarderDestination = require_builtins_hub_forwarder_index.HubForwarderDestination$1;
28122
28149
  exports.HubLogForwarder = HubLogForwarder;