@camstack/server 1.2.718 → 1.2.720

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 (970) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/addon-root-inventory.js +1 -1
  3. package/dist/agent/addon-scan.js +11 -7
  4. package/dist/agent/agent-addon-updates.js +1 -1
  5. package/dist/agent/agent-cap-dispatch-service.js +1 -1
  6. package/dist/agent/agent-heap-watch.js +1 -1
  7. package/dist/agent/agent-http.js +1 -1
  8. package/dist/agent/agent-hub-addon-update.js +1 -1
  9. package/dist/agent/agent-hub-registration.js +1 -1
  10. package/dist/agent/agent-infra-capabilities.js +2 -2
  11. package/dist/agent/agent-mesh-gate.js +1 -1
  12. package/dist/agent/agent-node-certificates.js +1 -1
  13. package/dist/agent/agent-pairing-routes.js +1 -1
  14. package/dist/agent/agent-pairing-store.js +1 -1
  15. package/dist/agent/agent-service.js +6 -2
  16. package/dist/agent/agent-update-service.js +3 -1
  17. package/dist/agent/hub-membership-client.js +1 -1
  18. package/dist/agent/infra-boot-guard.js +2 -2
  19. package/dist/agent/main.js +9 -9
  20. package/dist/api/addon-upload.js +1 -1
  21. package/dist/api/core/addon-settings.router.js +1 -1
  22. package/dist/api/core/agent-pairing.router.js +1 -1
  23. package/dist/api/core/auth-device-cert.procedures.js +1 -1
  24. package/dist/api/core/cap-providers.js +6 -6
  25. package/dist/api/core/certificates.router.js +1 -1
  26. package/dist/api/core/lifecycle-job-runner.js +1 -1
  27. package/dist/api/core/logging-settings.js +1 -1
  28. package/dist/api/core/logs.router.js +2 -2
  29. package/dist/api/core/notifications.router.js +1 -1
  30. package/dist/api/core/preferences.router.js +1 -1
  31. package/dist/api/core/repl.router.js +1 -1
  32. package/dist/api/cors/cors-policy.js +1 -1
  33. package/dist/api/mesh-membership-routes.js +1 -1
  34. package/dist/api/model-distributor.js +1 -1
  35. package/dist/api/trpc/cap-route-error-formatter.js +1 -1
  36. package/dist/api/trpc/cap-router-runtime.js +2 -2
  37. package/dist/api/trpc/core-cap-bridge.js +1 -1
  38. package/dist/api/trpc/device-collection-dispatch.js +1 -1
  39. package/dist/api/trpc/generated-cap-routers.js +1 -1
  40. package/dist/api/trpc/principal-authorization.js +1 -1
  41. package/dist/api/trpc/principal-visibility.js +1 -1
  42. package/dist/api/trpc/scope-access.js +1 -1
  43. package/dist/api/trpc/trpc.context.js +1 -1
  44. package/dist/api/trpc/trpc.middleware.js +1 -1
  45. package/dist/api/trpc/trpc.router.js +3 -3
  46. package/dist/auth/auth-network-policy.js +1 -1
  47. package/dist/auth/client-address.js +1 -1
  48. package/dist/auth/hub-sessions.js +1 -1
  49. package/dist/auth/session-lifetimes.js +1 -1
  50. package/dist/auth/sso-finish-deps.js +1 -1
  51. package/dist/boot/boot-config.js +53 -133
  52. package/dist/boot/platform-keychain-key.js +1 -1
  53. package/dist/boot/post-boot.service.js +1 -1
  54. package/dist/bootstrap-packages.js +3 -3
  55. package/dist/core/addon/addon-call-gateway.js +1 -1
  56. package/dist/core/addon/addon-package.service.js +140 -21
  57. package/dist/core/addon/addon-registry.service.js +36 -32
  58. package/dist/core/addon/addon-requirements.js +81 -0
  59. package/dist/core/addon/hub-addon-api.js +1 -1
  60. package/dist/core/addon/installed-addon-versions.js +82 -0
  61. package/dist/core/addon/package-dir-utils.js +11 -1
  62. package/dist/core/addon/settings-door-wiring.js +1 -1
  63. package/dist/core/addon-bridge/addon-bridge.service.js +3 -3
  64. package/dist/core/addon-pages/addon-pages.service.js +1 -1
  65. package/dist/core/agent/agent-desired-set.js +1 -1
  66. package/dist/core/agent/agent-pairing-http.js +1 -1
  67. package/dist/core/agent/agent-registry.service.js +41 -7
  68. package/dist/core/agent/cluster-node-history-store.js +1 -1
  69. package/dist/core/agent/delivery-requirements.js +36 -0
  70. package/dist/core/agent/forgotten-node-revoker.js +1 -1
  71. package/dist/core/agent/node-removal-hooks.js +6 -2
  72. package/dist/core/auth/auth.service.js +1 -1
  73. package/dist/core/config/config.schema.js +2 -2
  74. package/dist/core/config/config.service.js +1 -1
  75. package/dist/core/events/event-bus.service.js +1 -1
  76. package/dist/core/feature/feature.service.js +1 -1
  77. package/dist/core/lifecycle/lifecycle-state-machine.js +2 -2
  78. package/dist/core/logging/log-history.js +1 -1
  79. package/dist/core/logging/log-ring-buffer.js +2 -2
  80. package/dist/core/logging/logging.service.js +2 -2
  81. package/dist/core/logging/scoped-logger.js +2 -2
  82. package/dist/core/moleculer/cap-route-authority.js +2 -2
  83. package/dist/core/moleculer/hub-mesh-guard.js +1 -1
  84. package/dist/core/moleculer/moleculer.service.js +1 -1
  85. package/dist/core/network/network-quality.service.js +1 -1
  86. package/dist/core/notification/notification-wrapper.service.js +1 -1
  87. package/dist/core/notification/toast-wrapper.service.js +1 -1
  88. package/dist/core/repl/repl-engine.service.js +1 -1
  89. package/dist/core/server-update/server-update.service.js +3 -0
  90. package/dist/core/server-update/system-ensure-prebuilds.js +3 -3
  91. package/dist/core/server-update/system-exec-npm.js +2 -2
  92. package/dist/core/storage/fs-storage-backend.js +2 -2
  93. package/dist/core/storage/storage-location-manager.js +2 -2
  94. package/dist/core/storage/storage.service.js +1 -1
  95. package/dist/framework-nodepath.js +14 -1
  96. package/dist/launcher.js +23 -23
  97. package/dist/legacy-package-names.js +15 -0
  98. package/dist/main.js +2 -2
  99. package/dist/manual-boot.js +4 -3
  100. package/dist/package-inventory.js +6 -3
  101. package/dist/server-root/index.js +182 -30
  102. package/dist/single-copy-cleanup-runner.js +3 -3
  103. package/dist/single-copy-cleanup.js +19 -14
  104. package/package.json +53 -19
  105. package/scripts/closure-postinstall.mjs +1 -1
  106. package/system/assets/addon-pages-aggregator/icon.svg +5 -0
  107. package/system/assets/addon-widgets-aggregator/icon.svg +6 -0
  108. package/system/assets/alert-center/icon.svg +5 -0
  109. package/system/assets/autotrack/icon.svg +5 -0
  110. package/system/assets/backup-orchestrator/icon.svg +5 -0
  111. package/system/assets/calendars/icon.svg +5 -0
  112. package/system/assets/camera-grid/icon.svg +10 -0
  113. package/system/assets/composer/icon.svg +7 -0
  114. package/system/assets/console-logging/icon.svg +4 -0
  115. package/system/assets/core-blocks/icon.svg +6 -0
  116. package/system/assets/device-history/icon.svg +4 -0
  117. package/system/assets/device-manager/icon.svg +6 -0
  118. package/system/assets/filesystem-storage/icon.svg +6 -0
  119. package/system/assets/hub-forwarder/icon.svg +7 -0
  120. package/system/assets/keychain/icon.svg +6 -0
  121. package/system/assets/liveness-monitor/icon.svg +4 -0
  122. package/system/assets/local-auth/icon.svg +5 -0
  123. package/system/assets/local-network/icon.svg +7 -0
  124. package/system/assets/loki-logging/icon.svg +7 -0
  125. package/system/assets/metrics-native/icon.svg +3 -0
  126. package/system/assets/platform-probe/icon.svg +5 -0
  127. package/system/assets/record-entries/icon.svg +8 -0
  128. package/system/assets/remote-access-orchestrator/icon.svg +5 -0
  129. package/system/assets/snapshot/icon.svg +4 -0
  130. package/system/assets/sqlite-settings/icon.svg +5 -0
  131. package/system/assets/storage-orchestrator/icon.svg +8 -0
  132. package/system/assets/system-config/icon.svg +4 -0
  133. package/system/assets/winston-logging/icon.svg +6 -0
  134. package/system/dist/addon/addon-api-factory.d.ts +35 -0
  135. package/system/dist/addon-routes/addon-route-registry.d.ts +37 -0
  136. package/system/dist/addon-runner.js +11894 -0
  137. package/system/dist/addon-runner.mjs +11840 -0
  138. package/system/dist/addon-utils.d.ts +23 -0
  139. package/system/dist/addon-utils.js +27 -0
  140. package/system/dist/addon-utils.mjs +3 -0
  141. package/system/dist/agent-https-BMbnmX5u.mjs +1042 -0
  142. package/system/dist/agent-https-DslXCDRW.js +1289 -0
  143. package/system/dist/amd-accelerators-CEuPFBBK.js +36 -0
  144. package/system/dist/amd-accelerators-U_RsoEDd.mjs +35 -0
  145. package/system/dist/auth/auth-audit-log.d.ts +45 -0
  146. package/system/dist/auth/auth-manager.d.ts +155 -0
  147. package/system/dist/auth/cidr.d.ts +22 -0
  148. package/system/dist/auth/device-ca-store.d.ts +57 -0
  149. package/system/dist/auth/device-ca.d.ts +65 -0
  150. package/system/dist/auth/device-credential-manager.d.ts +158 -0
  151. package/system/dist/auth/external-identity-manager.d.ts +42 -0
  152. package/system/dist/auth/jwt-signing-key.d.ts +42 -0
  153. package/system/dist/auth/legacy-token-tables.d.ts +16 -0
  154. package/system/dist/auth/login-session-manager.d.ts +140 -0
  155. package/system/dist/auth/origin.d.ts +34 -0
  156. package/system/dist/auth/parse-record.d.ts +18 -0
  157. package/system/dist/auth/scope-matcher.d.ts +8 -0
  158. package/system/dist/auth/session-revocation-bus.d.ts +32 -0
  159. package/system/dist/auth/token-expiry.d.ts +62 -0
  160. package/system/dist/auth/totp-manager.d.ts +107 -0
  161. package/system/dist/auth/user-management-internal.d.ts +90 -0
  162. package/system/dist/auth/user-manager.d.ts +69 -0
  163. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts +57 -0
  164. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +271 -0
  165. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +263 -0
  166. package/system/dist/builtins/addon-pages-aggregator/dedupe-pages.d.ts +24 -0
  167. package/system/dist/builtins/addon-pages-aggregator/index.d.ts +1 -0
  168. package/system/dist/builtins/addon-pages-aggregator/index.js +8 -0
  169. package/system/dist/builtins/addon-pages-aggregator/index.mjs +2 -0
  170. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts +57 -0
  171. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +257 -0
  172. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +249 -0
  173. package/system/dist/builtins/addon-widgets-aggregator/index.d.ts +1 -0
  174. package/system/dist/builtins/addon-widgets-aggregator/index.js +8 -0
  175. package/system/dist/builtins/addon-widgets-aggregator/index.mjs +2 -0
  176. package/system/dist/builtins/alerts/alert-episode-policy.d.ts +39 -0
  177. package/system/dist/builtins/alerts/alert-store.d.ts +32 -0
  178. package/system/dist/builtins/alerts/alerts.addon.d.ts +148 -0
  179. package/system/dist/builtins/alerts/alerts.addon.js +1566 -0
  180. package/system/dist/builtins/alerts/alerts.addon.mjs +1559 -0
  181. package/system/dist/builtins/alerts/device-label.d.ts +8 -0
  182. package/system/dist/builtins/alerts/emit-alert-policy.d.ts +15 -0
  183. package/system/dist/builtins/alerts/index.d.ts +1 -0
  184. package/system/dist/builtins/alerts/index.js +4 -0
  185. package/system/dist/builtins/alerts/index.mjs +2 -0
  186. package/system/dist/builtins/alerts/migration-alerts.d.ts +13 -0
  187. package/system/dist/builtins/alerts/prune-policy.d.ts +44 -0
  188. package/system/dist/builtins/alerts/record-kinds.d.ts +15 -0
  189. package/system/dist/builtins/alerts/runner-alert.d.ts +58 -0
  190. package/system/dist/builtins/autotrack/autotrack-cameras.d.ts +125 -0
  191. package/system/dist/builtins/autotrack/autotrack-config.d.ts +89 -0
  192. package/system/dist/builtins/autotrack/autotrack-decision.d.ts +86 -0
  193. package/system/dist/builtins/autotrack/autotrack-loop.d.ts +95 -0
  194. package/system/dist/builtins/autotrack/autotrack.addon.d.ts +108 -0
  195. package/system/dist/builtins/autotrack/frame-error.d.ts +50 -0
  196. package/system/dist/builtins/autotrack/frame-measurements.d.ts +97 -0
  197. package/system/dist/builtins/autotrack/index.d.ts +2 -0
  198. package/system/dist/builtins/autotrack/index.js +1018 -0
  199. package/system/dist/builtins/autotrack/index.mjs +1012 -0
  200. package/system/dist/builtins/autotrack/ptz-mirror.d.ts +54 -0
  201. package/system/dist/builtins/autotrack/target-selection.d.ts +46 -0
  202. package/system/dist/builtins/backup-orchestrator/backup-databases.d.ts +51 -0
  203. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +291 -0
  204. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +3213 -0
  205. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +3204 -0
  206. package/system/dist/builtins/backup-orchestrator/cron-helpers.d.ts +23 -0
  207. package/system/dist/builtins/backup-orchestrator/destination-policy.d.ts +91 -0
  208. package/system/dist/builtins/backup-orchestrator/download-helpers.d.ts +12 -0
  209. package/system/dist/builtins/backup-orchestrator/encryption-key-store.d.ts +49 -0
  210. package/system/dist/builtins/backup-orchestrator/index.d.ts +2 -0
  211. package/system/dist/builtins/backup-orchestrator/index.js +8 -0
  212. package/system/dist/builtins/backup-orchestrator/index.mjs +2 -0
  213. package/system/dist/builtins/backup-orchestrator/manifest-store.d.ts +134 -0
  214. package/system/dist/builtins/backup-orchestrator/record-kinds.d.ts +56 -0
  215. package/system/dist/builtins/backup-orchestrator/restore-archive.d.ts +24 -0
  216. package/system/dist/builtins/backup-orchestrator/run-queue.d.ts +106 -0
  217. package/system/dist/builtins/backup-orchestrator/schedule-store.d.ts +59 -0
  218. package/system/dist/builtins/backup-orchestrator/seed-marker-store.d.ts +26 -0
  219. package/system/dist/builtins/backup-orchestrator/staging-paths.d.ts +36 -0
  220. package/system/dist/builtins/backup-orchestrator/write-targets.d.ts +63 -0
  221. package/system/dist/builtins/calendars/calendar-color.d.ts +9 -0
  222. package/system/dist/builtins/calendars/calendar-prefs-store.d.ts +34 -0
  223. package/system/dist/builtins/calendars/calendars.addon.d.ts +19 -0
  224. package/system/dist/builtins/calendars/calendars.addon.js +227 -0
  225. package/system/dist/builtins/calendars/calendars.addon.mjs +220 -0
  226. package/system/dist/builtins/calendars/index.d.ts +1 -0
  227. package/system/dist/builtins/calendars/index.js +8 -0
  228. package/system/dist/builtins/calendars/index.mjs +2 -0
  229. package/system/dist/builtins/calendars/record-kinds.d.ts +18 -0
  230. package/system/dist/builtins/camera-grid/acquire-retry.d.ts +30 -0
  231. package/system/dist/builtins/camera-grid/addon.d.ts +205 -0
  232. package/system/dist/builtins/camera-grid/flv-join.d.ts +40 -0
  233. package/system/dist/builtins/camera-grid/grid-activity-mirror.d.ts +42 -0
  234. package/system/dist/builtins/camera-grid/grid-activity.d.ts +91 -0
  235. package/system/dist/builtins/camera-grid/grid-camera-declarations.d.ts +59 -0
  236. package/system/dist/builtins/camera-grid/grid-camera-device.d.ts +68 -0
  237. package/system/dist/builtins/camera-grid/grid-canvas-derivation.d.ts +54 -0
  238. package/system/dist/builtins/camera-grid/grid-canvas-seed.d.ts +112 -0
  239. package/system/dist/builtins/camera-grid/grid-canvas.d.ts +85 -0
  240. package/system/dist/builtins/camera-grid/grid-child.d.ts +32 -0
  241. package/system/dist/builtins/camera-grid/grid-compositor-child.d.ts +3 -0
  242. package/system/dist/builtins/camera-grid/grid-compositor-invocation.d.ts +47 -0
  243. package/system/dist/builtins/camera-grid/grid-compositor.d.ts +54 -0
  244. package/system/dist/builtins/camera-grid/grid-detection-mapping.d.ts +61 -0
  245. package/system/dist/builtins/camera-grid/grid-device-settings.d.ts +35 -0
  246. package/system/dist/builtins/camera-grid/grid-filter-graph.d.ts +53 -0
  247. package/system/dist/builtins/camera-grid/grid-frame-sample.d.ts +53 -0
  248. package/system/dist/builtins/camera-grid/grid-instances.d.ts +22 -0
  249. package/system/dist/builtins/camera-grid/grid-last-frame-store.d.ts +58 -0
  250. package/system/dist/builtins/camera-grid/grid-layout-native-provider.d.ts +34 -0
  251. package/system/dist/builtins/camera-grid/grid-plan.d.ts +34 -0
  252. package/system/dist/builtins/camera-grid/grid-profiles.d.ts +104 -0
  253. package/system/dist/builtins/camera-grid/grid-row-normalization.d.ts +10 -0
  254. package/system/dist/builtins/camera-grid/grid-sentry-sources.d.ts +64 -0
  255. package/system/dist/builtins/camera-grid/grid-snapshot.d.ts +62 -0
  256. package/system/dist/builtins/camera-grid/grid-stream-descriptor.d.ts +53 -0
  257. package/system/dist/builtins/camera-grid/grid-stream-invocation.d.ts +44 -0
  258. package/system/dist/builtins/camera-grid/grid-stream-relay.d.ts +35 -0
  259. package/system/dist/builtins/camera-grid/grid-stream-session.d.ts +143 -0
  260. package/system/dist/builtins/camera-grid/grid-tile-feed.d.ts +50 -0
  261. package/system/dist/builtins/camera-grid/grid-tile-plan.d.ts +66 -0
  262. package/system/dist/builtins/camera-grid/grid-wire-format.d.ts +30 -0
  263. package/system/dist/builtins/camera-grid/index.d.ts +45 -0
  264. package/system/dist/builtins/camera-grid/index.js +3994 -0
  265. package/system/dist/builtins/camera-grid/index.mjs +3961 -0
  266. package/system/dist/builtins/camera-grid/silence-analysis.d.ts +37 -0
  267. package/system/dist/builtins/cluster-agent/record-kinds.d.ts +49 -0
  268. package/system/dist/builtins/composer/actuator-dispatch.d.ts +13 -0
  269. package/system/dist/builtins/composer/actuator-groups.d.ts +68 -0
  270. package/system/dist/builtins/composer/actuator-invoke.d.ts +32 -0
  271. package/system/dist/builtins/composer/claim-gate.d.ts +59 -0
  272. package/system/dist/builtins/composer/composed-device-set.d.ts +52 -0
  273. package/system/dist/builtins/composer/composed-device.d.ts +57 -0
  274. package/system/dist/builtins/composer/composer-apply-waits.d.ts +28 -0
  275. package/system/dist/builtins/composer/composer-grafts.d.ts +73 -0
  276. package/system/dist/builtins/composer/composer-live-set.d.ts +30 -0
  277. package/system/dist/builtins/composer/composer-plan.d.ts +112 -0
  278. package/system/dist/builtins/composer/composer-runtime-factory.d.ts +30 -0
  279. package/system/dist/builtins/composer/composer-seeds.d.ts +28 -0
  280. package/system/dist/builtins/composer/composer-verdict.d.ts +33 -0
  281. package/system/dist/builtins/composer/composer.addon.d.ts +26 -0
  282. package/system/dist/builtins/composer/composer.addon.js +6229 -0
  283. package/system/dist/builtins/composer/composer.addon.mjs +6223 -0
  284. package/system/dist/builtins/composer/composer.d.ts +208 -0
  285. package/system/dist/builtins/composer/composition-declarations.d.ts +64 -0
  286. package/system/dist/builtins/composer/composition-evaluation.d.ts +53 -0
  287. package/system/dist/builtins/composer/composition-runtime.d.ts +203 -0
  288. package/system/dist/builtins/composer/composition-target.d.ts +60 -0
  289. package/system/dist/builtins/composer/confirmed-seed.d.ts +44 -0
  290. package/system/dist/builtins/composer/deadline-timer.d.ts +18 -0
  291. package/system/dist/builtins/composer/existing-target.d.ts +131 -0
  292. package/system/dist/builtins/composer/field-record.d.ts +64 -0
  293. package/system/dist/builtins/composer/forward-commands.d.ts +61 -0
  294. package/system/dist/builtins/composer/graft-host.d.ts +71 -0
  295. package/system/dist/builtins/composer/held-claims.d.ts +29 -0
  296. package/system/dist/builtins/composer/history-helpers.d.ts +67 -0
  297. package/system/dist/builtins/composer/index.d.ts +1 -0
  298. package/system/dist/builtins/composer/index.js +8 -0
  299. package/system/dist/builtins/composer/index.mjs +2 -0
  300. package/system/dist/builtins/composer/math-quantity.d.ts +20 -0
  301. package/system/dist/builtins/composer/own-field-reads.d.ts +30 -0
  302. package/system/dist/builtins/composer/owned-fields-target.d.ts +95 -0
  303. package/system/dist/builtins/composer/pulse-seed-resolve.d.ts +59 -0
  304. package/system/dist/builtins/composer/pulse-seed.d.ts +75 -0
  305. package/system/dist/builtins/composer/slice-assembler.d.ts +26 -0
  306. package/system/dist/builtins/composer/source-readings.d.ts +128 -0
  307. package/system/dist/builtins/composer/source-tracker.d.ts +135 -0
  308. package/system/dist/builtins/console-logging/console-destination.d.ts +19 -0
  309. package/system/dist/builtins/console-logging/console-logging.addon.d.ts +26 -0
  310. package/system/dist/builtins/console-logging/index.d.ts +3 -0
  311. package/system/dist/builtins/console-logging/index.js +108 -0
  312. package/system/dist/builtins/console-logging/index.mjs +99 -0
  313. package/system/dist/builtins/core-blocks/actions-service.d.ts +113 -0
  314. package/system/dist/builtins/core-blocks/actions-store.d.ts +32 -0
  315. package/system/dist/builtins/core-blocks/actions-wiring.d.ts +32 -0
  316. package/system/dist/builtins/core-blocks/block-package.d.ts +54 -0
  317. package/system/dist/builtins/core-blocks/block-settings-store.d.ts +93 -0
  318. package/system/dist/builtins/core-blocks/block-supervisor.d.ts +176 -0
  319. package/system/dist/builtins/core-blocks/block-type-defs.d.ts +29 -0
  320. package/system/dist/builtins/core-blocks/blocks-integration.d.ts +89 -0
  321. package/system/dist/builtins/core-blocks/compile-block.d.ts +52 -0
  322. package/system/dist/builtins/core-blocks/composition-api.d.ts +50 -0
  323. package/system/dist/builtins/core-blocks/composition-peers.d.ts +31 -0
  324. package/system/dist/builtins/core-blocks/composition-sources.d.ts +40 -0
  325. package/system/dist/builtins/core-blocks/core-block-store.d.ts +120 -0
  326. package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +108 -0
  327. package/system/dist/builtins/core-blocks/core-blocks.addon.js +6374 -0
  328. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +6355 -0
  329. package/system/dist/builtins/core-blocks/extract-settings-schema.d.ts +6 -0
  330. package/system/dist/builtins/core-blocks/index.d.ts +8 -0
  331. package/system/dist/builtins/core-blocks/index.js +21 -0
  332. package/system/dist/builtins/core-blocks/index.mjs +2 -0
  333. package/system/dist/builtins/core-blocks/lock-door-gate.d.ts +31 -0
  334. package/system/dist/builtins/core-blocks/lock-door-sensor.d.ts +35 -0
  335. package/system/dist/builtins/core-blocks/power-source-service.d.ts +70 -0
  336. package/system/dist/builtins/core-blocks/record-kinds.d.ts +83 -0
  337. package/system/dist/builtins/core-blocks/remote-call-redirect.d.ts +23 -0
  338. package/system/dist/builtins/core-blocks/remote-components-service.d.ts +10 -0
  339. package/system/dist/builtins/core-blocks/remote-service.d.ts +85 -0
  340. package/system/dist/builtins/core-blocks/remote-wiring.d.ts +49 -0
  341. package/system/dist/builtins/core-blocks/runs-api.d.ts +30 -0
  342. package/system/dist/builtins/core-blocks/runs-ledger.d.ts +64 -0
  343. package/system/dist/builtins/core-blocks/scheduler/scheduler-engine.d.ts +91 -0
  344. package/system/dist/builtins/core-blocks/scheduler/scheduler-holds.d.ts +54 -0
  345. package/system/dist/builtins/core-blocks/scheduler/scheduler-service.d.ts +76 -0
  346. package/system/dist/builtins/core-blocks/scheduler/scheduler-store.d.ts +23 -0
  347. package/system/dist/builtins/core-blocks/scheduler/scheduler-timeline.d.ts +53 -0
  348. package/system/dist/builtins/core-blocks/scheduler/scheduler-trace.d.ts +17 -0
  349. package/system/dist/builtins/core-blocks/scheduler/scheduler-types.d.ts +20 -0
  350. package/system/dist/builtins/core-blocks/scheduler/scheduler-wiring.d.ts +41 -0
  351. package/system/dist/builtins/core-blocks/templates-service.d.ts +24 -0
  352. package/system/dist/builtins/device-history/capture/capture-engine.d.ts +113 -0
  353. package/system/dist/builtins/device-history/capture/capture-filter.d.ts +37 -0
  354. package/system/dist/builtins/device-history/capture/device-directory.d.ts +47 -0
  355. package/system/dist/builtins/device-history/capture/field-path.d.ts +10 -0
  356. package/system/dist/builtins/device-history/capture/point-writer.d.ts +63 -0
  357. package/system/dist/builtins/device-history/device-history.addon.d.ts +53 -0
  358. package/system/dist/builtins/device-history/device-history.addon.js +2885 -0
  359. package/system/dist/builtins/device-history/device-history.addon.mjs +2878 -0
  360. package/system/dist/builtins/device-history/index.d.ts +3 -0
  361. package/system/dist/builtins/device-history/ingest/producer-ingest.d.ts +99 -0
  362. package/system/dist/builtins/device-history/query/history-query.d.ts +116 -0
  363. package/system/dist/builtins/device-history/query/point-shape.d.ts +31 -0
  364. package/system/dist/builtins/device-history/retention/departure-tracker.d.ts +33 -0
  365. package/system/dist/builtins/device-history/retention/orphans.d.ts +50 -0
  366. package/system/dist/builtins/device-history/retention/retention.d.ts +74 -0
  367. package/system/dist/builtins/device-history/rollup/rollup-engine.d.ts +74 -0
  368. package/system/dist/builtins/device-history/rollup/rollup-math.d.ts +50 -0
  369. package/system/dist/builtins/device-history/runtime/history-runtime.d.ts +118 -0
  370. package/system/dist/builtins/device-history/status/counters.d.ts +55 -0
  371. package/system/dist/builtins/device-history/store/history-door.d.ts +7 -0
  372. package/system/dist/builtins/device-history/store/history-schema.d.ts +28 -0
  373. package/system/dist/builtins/device-history/store/history-store.d.ts +109 -0
  374. package/system/dist/builtins/device-history/store/row-readers.d.ts +11 -0
  375. package/system/dist/builtins/device-history/store/series-registry.d.ts +64 -0
  376. package/system/dist/builtins/device-history/store/series-scale.d.ts +37 -0
  377. package/system/dist/builtins/device-history/time/bucket-time.d.ts +25 -0
  378. package/system/dist/builtins/device-manager/adoption-job-engine.d.ts +153 -0
  379. package/system/dist/builtins/device-manager/claimed-status-overlay.d.ts +45 -0
  380. package/system/dist/builtins/device-manager/contribution-cache.d.ts +85 -0
  381. package/system/dist/builtins/device-manager/day-night-config-schema.d.ts +30 -0
  382. package/system/dist/builtins/device-manager/device-aggregation-merge.d.ts +22 -0
  383. package/system/dist/builtins/device-manager/device-aggregation.d.ts +335 -0
  384. package/system/dist/builtins/device-manager/device-bindings-store.d.ts +278 -0
  385. package/system/dist/builtins/device-manager/device-config-contribution.d.ts +45 -0
  386. package/system/dist/builtins/device-manager/device-config-secrets.d.ts +40 -0
  387. package/system/dist/builtins/device-manager/device-event-propagator.d.ts +26 -0
  388. package/system/dist/builtins/device-manager/device-extension-linked-slot.d.ts +27 -0
  389. package/system/dist/builtins/device-manager/device-form-secrets.d.ts +25 -0
  390. package/system/dist/builtins/device-manager/device-linked-devices.d.ts +201 -0
  391. package/system/dist/builtins/device-manager/device-manager.addon.d.ts +234 -0
  392. package/system/dist/builtins/device-manager/device-manager.addon.js +11369 -0
  393. package/system/dist/builtins/device-manager/device-manager.addon.mjs +11358 -0
  394. package/system/dist/builtins/device-manager/device-meta-actions.d.ts +338 -0
  395. package/system/dist/builtins/device-manager/device-meta-store.d.ts +103 -0
  396. package/system/dist/builtins/device-manager/device-meta-types.d.ts +277 -0
  397. package/system/dist/builtins/device-manager/device-online-fallback.d.ts +35 -0
  398. package/system/dist/builtins/device-manager/device-projection.d.ts +71 -0
  399. package/system/dist/builtins/device-manager/device-provider-context.d.ts +126 -0
  400. package/system/dist/builtins/device-manager/device-queries.d.ts +67 -0
  401. package/system/dist/builtins/device-manager/device-removal-hooks.d.ts +92 -0
  402. package/system/dist/builtins/device-manager/device-row-store.d.ts +449 -0
  403. package/system/dist/builtins/device-manager/device-source-activation.d.ts +103 -0
  404. package/system/dist/builtins/device-manager/device-state-claim-views.d.ts +92 -0
  405. package/system/dist/builtins/device-manager/device-state-claims.d.ts +66 -0
  406. package/system/dist/builtins/device-manager/device-state-mirror.d.ts +267 -0
  407. package/system/dist/builtins/device-manager/device-sync-resolvers.d.ts +30 -0
  408. package/system/dist/builtins/device-manager/device-tombstone-store.d.ts +29 -0
  409. package/system/dist/builtins/device-manager/discovery-orchestrator.d.ts +45 -0
  410. package/system/dist/builtins/device-manager/field-claims-index.d.ts +96 -0
  411. package/system/dist/builtins/device-manager/field-ownership.d.ts +71 -0
  412. package/system/dist/builtins/device-manager/fleet-read-census.d.ts +104 -0
  413. package/system/dist/builtins/device-manager/image-settings-config-schema.d.ts +22 -0
  414. package/system/dist/builtins/device-manager/index.d.ts +2 -0
  415. package/system/dist/builtins/device-manager/index.js +8 -0
  416. package/system/dist/builtins/device-manager/index.mjs +2 -0
  417. package/system/dist/builtins/device-manager/linked-devices-manual-backfill.d.ts +27 -0
  418. package/system/dist/builtins/device-manager/location-alignment.d.ts +61 -0
  419. package/system/dist/builtins/device-manager/migrate-device.d.ts +192 -0
  420. package/system/dist/builtins/device-manager/migrate-guard.d.ts +78 -0
  421. package/system/dist/builtins/device-manager/migrate-hardware-state.d.ts +79 -0
  422. package/system/dist/builtins/device-manager/migrate-reload.d.ts +46 -0
  423. package/system/dist/builtins/device-manager/migration-refused.d.ts +23 -0
  424. package/system/dist/builtins/device-manager/mirror-row-writer.d.ts +222 -0
  425. package/system/dist/builtins/device-manager/record-kinds.d.ts +14 -0
  426. package/system/dist/builtins/device-manager/recording-onboard-config-schema.d.ts +65 -0
  427. package/system/dist/builtins/device-manager/removal-cleanup.d.ts +50 -0
  428. package/system/dist/builtins/device-manager/removal-fence.d.ts +58 -0
  429. package/system/dist/builtins/device-manager/running-flip.d.ts +11 -0
  430. package/system/dist/builtins/device-manager/runtime-state-persist-gate.d.ts +64 -0
  431. package/system/dist/builtins/device-manager/secret-config-paths.d.ts +24 -0
  432. package/system/dist/builtins/device-manager/stale-wrapper-activations.d.ts +59 -0
  433. package/system/dist/builtins/device-manager/write-lock.d.ts +17 -0
  434. package/system/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts +43 -0
  435. package/system/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts +16 -0
  436. package/system/dist/builtins/hub-forwarder/index.d.ts +3 -0
  437. package/system/dist/builtins/hub-forwarder/index.js +151 -0
  438. package/system/dist/builtins/hub-forwarder/index.mjs +142 -0
  439. package/system/dist/builtins/keychain/index.d.ts +1 -0
  440. package/system/dist/builtins/keychain/index.js +2059 -0
  441. package/system/dist/builtins/keychain/index.mjs +2052 -0
  442. package/system/dist/builtins/keychain/key-sources.d.ts +37 -0
  443. package/system/dist/builtins/keychain/keychain-crypto.d.ts +28 -0
  444. package/system/dist/builtins/keychain/keychain-reset-trigger.d.ts +25 -0
  445. package/system/dist/builtins/keychain/keychain-service.d.ts +180 -0
  446. package/system/dist/builtins/keychain/keychain-store.d.ts +125 -0
  447. package/system/dist/builtins/keychain/keychain-usage.d.ts +17 -0
  448. package/system/dist/builtins/keychain/keychain.addon.d.ts +36 -0
  449. package/system/dist/builtins/keychain/platform-key-source.d.ts +24 -0
  450. package/system/dist/builtins/keychain/record-kinds.d.ts +16 -0
  451. package/system/dist/builtins/keychain/system-held-secrets.d.ts +25 -0
  452. package/system/dist/builtins/liveness-monitor/index.d.ts +2 -0
  453. package/system/dist/builtins/liveness-monitor/index.js +6 -0
  454. package/system/dist/builtins/liveness-monitor/index.mjs +2 -0
  455. package/system/dist/builtins/liveness-monitor/liveness-checks.d.ts +85 -0
  456. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.d.ts +46 -0
  457. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +443 -0
  458. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +437 -0
  459. package/system/dist/builtins/liveness-monitor/liveness-reporter.d.ts +28 -0
  460. package/system/dist/builtins/liveness-monitor/storage-root-access.d.ts +53 -0
  461. package/system/dist/builtins/local-auth/admin-account-boot.d.ts +27 -0
  462. package/system/dist/builtins/local-auth/auth-config-reader.d.ts +39 -0
  463. package/system/dist/builtins/local-auth/auth-schema.d.ts +93 -0
  464. package/system/dist/builtins/local-auth/index.d.ts +1 -0
  465. package/system/dist/builtins/local-auth/index.js +4 -0
  466. package/system/dist/builtins/local-auth/index.mjs +2 -0
  467. package/system/dist/builtins/local-auth/jwt-signing-key-keeper.d.ts +30 -0
  468. package/system/dist/builtins/local-auth/local-auth.addon.d.ts +48 -0
  469. package/system/dist/builtins/local-auth/local-auth.addon.js +12418 -0
  470. package/system/dist/builtins/local-auth/local-auth.addon.mjs +12388 -0
  471. package/system/dist/builtins/local-auth/oauth-grants.d.ts +71 -0
  472. package/system/dist/builtins/local-auth/oauth-session-manager.d.ts +44 -0
  473. package/system/dist/builtins/local-auth/person-scopes.d.ts +7 -0
  474. package/system/dist/builtins/local-auth/preferences-record-kinds.d.ts +27 -0
  475. package/system/dist/builtins/local-auth/record-kinds.d.ts +137 -0
  476. package/system/dist/builtins/local-auth/user-preferences-store.d.ts +56 -0
  477. package/system/dist/builtins/local-network/address-book.d.ts +128 -0
  478. package/system/dist/builtins/local-network/agent-mdns.d.ts +56 -0
  479. package/system/dist/builtins/local-network/hub-mdns-ciao.d.ts +7 -0
  480. package/system/dist/builtins/local-network/hub-mdns.d.ts +58 -0
  481. package/system/dist/builtins/local-network/index.d.ts +1 -0
  482. package/system/dist/builtins/local-network/index.js +10 -0
  483. package/system/dist/builtins/local-network/index.mjs +2 -0
  484. package/system/dist/builtins/local-network/ipv6-lan.d.ts +21 -0
  485. package/system/dist/builtins/local-network/local-hostname.d.ts +15 -0
  486. package/system/dist/builtins/local-network/local-network.addon.d.ts +334 -0
  487. package/system/dist/builtins/local-network/local-network.addon.js +2487 -0
  488. package/system/dist/builtins/local-network/local-network.addon.mjs +2466 -0
  489. package/system/dist/builtins/local-network/scan/dns-wire.d.ts +17 -0
  490. package/system/dist/builtins/local-network/scan/scan-engine.d.ts +31 -0
  491. package/system/dist/builtins/local-network/scan/scan-io-node.d.ts +2 -0
  492. package/system/dist/builtins/local-network/scan/scan-io.d.ts +56 -0
  493. package/system/dist/builtins/local-network/scan/subnets.d.ts +57 -0
  494. package/system/dist/builtins/loki-logging/index.d.ts +4 -0
  495. package/system/dist/builtins/loki-logging/index.js +915 -0
  496. package/system/dist/builtins/loki-logging/index.mjs +901 -0
  497. package/system/dist/builtins/loki-logging/loki-destination.d.ts +142 -0
  498. package/system/dist/builtins/loki-logging/loki-logging.addon.d.ts +66 -0
  499. package/system/dist/builtins/loki-logging/loki-payload.d.ts +100 -0
  500. package/system/dist/builtins/loki-logging/loki-read.d.ts +51 -0
  501. package/system/dist/builtins/loki-logging/retire-enabled-flag.d.ts +48 -0
  502. package/system/dist/builtins/native-metrics/cgroup-memory.d.ts +240 -0
  503. package/system/dist/builtins/native-metrics/cgroup-pids.d.ts +159 -0
  504. package/system/dist/builtins/native-metrics/container-memory-ring.d.ts +18 -0
  505. package/system/dist/builtins/native-metrics/darwin-memory.d.ts +26 -0
  506. package/system/dist/builtins/native-metrics/gpu-probe.d.ts +18 -0
  507. package/system/dist/builtins/native-metrics/index.d.ts +2 -0
  508. package/system/dist/builtins/native-metrics/load-series-config.d.ts +83 -0
  509. package/system/dist/builtins/native-metrics/load-series-reader.d.ts +63 -0
  510. package/system/dist/builtins/native-metrics/load-series-types.d.ts +14 -0
  511. package/system/dist/builtins/native-metrics/native-metrics-provider.d.ts +49 -0
  512. package/system/dist/builtins/native-metrics/native-metrics.addon.d.ts +233 -0
  513. package/system/dist/builtins/native-metrics/native-metrics.addon.js +3116 -0
  514. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +3106 -0
  515. package/system/dist/builtins/native-metrics/node-load-ring.d.ts +212 -0
  516. package/system/dist/builtins/native-metrics/node-metrics-history-recorder.d.ts +155 -0
  517. package/system/dist/builtins/native-metrics/proc-process-table.d.ts +25 -0
  518. package/system/dist/builtins/native-metrics/process-classification.d.ts +110 -0
  519. package/system/dist/builtins/native-metrics/thread-cpu-sampler.d.ts +116 -0
  520. package/system/dist/builtins/platform-probe/accelerator-facts-probe.d.ts +24 -0
  521. package/system/dist/builtins/platform-probe/accelerator-reprobe.d.ts +23 -0
  522. package/system/dist/builtins/platform-probe/amd-accelerators.d.ts +15 -0
  523. package/system/dist/builtins/platform-probe/amd-npu.d.ts +35 -0
  524. package/system/dist/builtins/platform-probe/coral-accelerators.d.ts +87 -0
  525. package/system/dist/builtins/platform-probe/index.d.ts +57 -0
  526. package/system/dist/builtins/platform-probe/index.js +1151 -0
  527. package/system/dist/builtins/platform-probe/index.mjs +1140 -0
  528. package/system/dist/builtins/platform-probe/inference-config-resolver.d.ts +29 -0
  529. package/system/dist/builtins/platform-probe/intel-accelerators.d.ts +14 -0
  530. package/system/dist/builtins/platform-probe/intel-npu.d.ts +38 -0
  531. package/system/dist/builtins/platform-probe/platform-scorer.d.ts +66 -0
  532. package/system/dist/builtins/platform-probe/runtime-packages.d.ts +6 -0
  533. package/system/dist/builtins/platform-probe/windows-hardware.d.ts +77 -0
  534. package/system/dist/builtins/record-entries/entries-service.d.ts +42 -0
  535. package/system/dist/builtins/record-entries/index.d.ts +1 -0
  536. package/system/dist/builtins/record-entries/index.js +162 -0
  537. package/system/dist/builtins/record-entries/index.mjs +156 -0
  538. package/system/dist/builtins/record-entries/record-entries.addon.d.ts +13 -0
  539. package/system/dist/builtins/records-isolated.d.ts +10 -0
  540. package/system/dist/builtins/remote-access-orchestrator/enabled-providers-reconcile.d.ts +96 -0
  541. package/system/dist/builtins/remote-access-orchestrator/index.d.ts +1 -0
  542. package/system/dist/builtins/remote-access-orchestrator/index.js +8 -0
  543. package/system/dist/builtins/remote-access-orchestrator/index.mjs +2 -0
  544. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +71 -0
  545. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +214 -0
  546. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +208 -0
  547. package/system/dist/builtins/shared/device-state-changed.d.ts +16 -0
  548. package/system/dist/builtins/shared/settle-sources.d.ts +22 -0
  549. package/system/dist/builtins/snapshot/index.d.ts +2 -0
  550. package/system/dist/builtins/snapshot/index.js +2720 -0
  551. package/system/dist/builtins/snapshot/index.mjs +2713 -0
  552. package/system/dist/builtins/snapshot/snapshot-cache.d.ts +108 -0
  553. package/system/dist/builtins/snapshot/snapshot-coalescing.d.ts +135 -0
  554. package/system/dist/builtins/snapshot/snapshot-courtesy.d.ts +68 -0
  555. package/system/dist/builtins/snapshot/snapshot-durable-store.d.ts +36 -0
  556. package/system/dist/builtins/snapshot/snapshot-fatigue.d.ts +41 -0
  557. package/system/dist/builtins/snapshot/snapshot-grab-pick.d.ts +20 -0
  558. package/system/dist/builtins/snapshot/snapshot-link-url.d.ts +66 -0
  559. package/system/dist/builtins/snapshot/snapshot-media-handler.d.ts +121 -0
  560. package/system/dist/builtins/snapshot/snapshot-resize.d.ts +75 -0
  561. package/system/dist/builtins/snapshot/snapshot.addon.d.ts +581 -0
  562. package/system/dist/builtins/sqlite-storage/analyze-stats.d.ts +83 -0
  563. package/system/dist/builtins/sqlite-storage/config-store.d.ts +8 -0
  564. package/system/dist/builtins/sqlite-storage/database-snapshot-provider.d.ts +18 -0
  565. package/system/dist/builtins/sqlite-storage/device-store.d.ts +23 -0
  566. package/system/dist/builtins/sqlite-storage/file-host-client.d.ts +75 -0
  567. package/system/dist/builtins/sqlite-storage/file-host-handlers.d.ts +27 -0
  568. package/system/dist/builtins/sqlite-storage/file-host-protocol.d.ts +167 -0
  569. package/system/dist/builtins/sqlite-storage/file-host-worker.d.ts +1 -0
  570. package/system/dist/builtins/sqlite-storage/filesystem-browse-provider.d.ts +25 -0
  571. package/system/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts +83 -0
  572. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts +33 -0
  573. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +419 -0
  574. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +411 -0
  575. package/system/dist/builtins/sqlite-storage/filter-compiler.d.ts +126 -0
  576. package/system/dist/builtins/sqlite-storage/index.d.ts +12 -0
  577. package/system/dist/builtins/sqlite-storage/index.js +82 -0
  578. package/system/dist/builtins/sqlite-storage/index.mjs +50 -0
  579. package/system/dist/builtins/sqlite-storage/integration-record-kinds.d.ts +31 -0
  580. package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +34 -0
  581. package/system/dist/builtins/sqlite-storage/migrations/migration-actions.d.ts +12 -0
  582. package/system/dist/builtins/sqlite-storage/migrations/migration-edits.d.ts +35 -0
  583. package/system/dist/builtins/sqlite-storage/migrations/migration-engine.d.ts +125 -0
  584. package/system/dist/builtins/sqlite-storage/migrations/migration-hold.d.ts +23 -0
  585. package/system/dist/builtins/sqlite-storage/migrations/migration-pass.d.ts +48 -0
  586. package/system/dist/builtins/sqlite-storage/migrations/migration-restore-marker.d.ts +3 -0
  587. package/system/dist/builtins/sqlite-storage/migrations/migration-types.d.ts +151 -0
  588. package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +61 -0
  589. package/system/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +173 -0
  590. package/system/dist/builtins/sqlite-storage/path-guard.d.ts +11 -0
  591. package/system/dist/builtins/sqlite-storage/placement-errors.d.ts +60 -0
  592. package/system/dist/builtins/sqlite-storage/placement-router.d.ts +85 -0
  593. package/system/dist/builtins/sqlite-storage/prefix-range.d.ts +50 -0
  594. package/system/dist/builtins/sqlite-storage/query-bounds.d.ts +110 -0
  595. package/system/dist/builtins/sqlite-storage/query-profiler.d.ts +242 -0
  596. package/system/dist/builtins/sqlite-storage/records/records-catalog.d.ts +27 -0
  597. package/system/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +48 -0
  598. package/system/dist/builtins/sqlite-storage/records/records-engine.d.ts +115 -0
  599. package/system/dist/builtins/sqlite-storage/records/records-explain.d.ts +18 -0
  600. package/system/dist/builtins/sqlite-storage/records/records-plan.d.ts +95 -0
  601. package/system/dist/builtins/sqlite-storage/records/records-probe.d.ts +33 -0
  602. package/system/dist/builtins/sqlite-storage/records/records-provider.d.ts +72 -0
  603. package/system/dist/builtins/sqlite-storage/records/records-rows.d.ts +46 -0
  604. package/system/dist/builtins/sqlite-storage/records/records-sql.d.ts +39 -0
  605. package/system/dist/builtins/sqlite-storage/retired-settings-keys.d.ts +276 -0
  606. package/system/dist/builtins/sqlite-storage/shm-lock-canary.d.ts +60 -0
  607. package/system/dist/builtins/sqlite-storage/sqlite-pragmas.d.ts +191 -0
  608. package/system/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +583 -0
  609. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +52 -0
  610. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2960 -0
  611. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2952 -0
  612. package/system/dist/builtins/sqlite-storage/sqlite-snapshot-protocol.d.ts +54 -0
  613. package/system/dist/builtins/sqlite-storage/sqlite-snapshot-worker.d.ts +33 -0
  614. package/system/dist/builtins/sqlite-storage/sqlite-snapshotter.d.ts +118 -0
  615. package/system/dist/builtins/sqlite-storage/stale-data/stale-data-audit.d.ts +81 -0
  616. package/system/dist/builtins/sqlite-storage/stale-data/stale-data-ports.d.ts +17 -0
  617. package/system/dist/builtins/sqlite-storage/statement-shape.d.ts +64 -0
  618. package/system/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +33 -0
  619. package/system/dist/builtins/sqlite-storage/table-sizes.d.ts +95 -0
  620. package/system/dist/builtins/sqlite-storage/vector-index-shared.d.ts +81 -0
  621. package/system/dist/builtins/sqlite-storage/vector-index-vec.d.ts +143 -0
  622. package/system/dist/builtins/sqlite-storage/vector-provider.d.ts +30 -0
  623. package/system/dist/builtins/sqlite-storage/wal-checkpoint-policy.d.ts +196 -0
  624. package/system/dist/builtins/sqlite-storage/wal-checkpoint-worker.d.ts +1 -0
  625. package/system/dist/builtins/sqlite-storage/wal-checkpointer.d.ts +76 -0
  626. package/system/dist/builtins/sqlite-storage/wal-maintenance.d.ts +130 -0
  627. package/system/dist/builtins/storage-orchestrator/access-guards.d.ts +43 -0
  628. package/system/dist/builtins/storage-orchestrator/data-store-dispatch.d.ts +39 -0
  629. package/system/dist/builtins/storage-orchestrator/drain-ratchet.d.ts +104 -0
  630. package/system/dist/builtins/storage-orchestrator/drain-state-store.d.ts +26 -0
  631. package/system/dist/builtins/storage-orchestrator/hub-settings-forward.d.ts +128 -0
  632. package/system/dist/builtins/storage-orchestrator/index.d.ts +7 -0
  633. package/system/dist/builtins/storage-orchestrator/index.js +11 -0
  634. package/system/dist/builtins/storage-orchestrator/index.mjs +2 -0
  635. package/system/dist/builtins/storage-orchestrator/location-class-paths.d.ts +13 -0
  636. package/system/dist/builtins/storage-orchestrator/location-history-recorder.d.ts +76 -0
  637. package/system/dist/builtins/storage-orchestrator/location-occupancy-slice.d.ts +71 -0
  638. package/system/dist/builtins/storage-orchestrator/location-occupancy.d.ts +19 -0
  639. package/system/dist/builtins/storage-orchestrator/location-protection.d.ts +20 -0
  640. package/system/dist/builtins/storage-orchestrator/location-repoint-move.d.ts +57 -0
  641. package/system/dist/builtins/storage-orchestrator/location-repointer.d.ts +97 -0
  642. package/system/dist/builtins/storage-orchestrator/location-root-collision.d.ts +80 -0
  643. package/system/dist/builtins/storage-orchestrator/location-secrets.d.ts +114 -0
  644. package/system/dist/builtins/storage-orchestrator/location-store.d.ts +82 -0
  645. package/system/dist/builtins/storage-orchestrator/location-volume-capacity.d.ts +58 -0
  646. package/system/dist/builtins/storage-orchestrator/provider-discovery.d.ts +24 -0
  647. package/system/dist/builtins/storage-orchestrator/record-kinds.d.ts +43 -0
  648. package/system/dist/builtins/storage-orchestrator/storage-cleanup-coordinator.d.ts +68 -0
  649. package/system/dist/builtins/storage-orchestrator/storage-location-band-monitor.d.ts +77 -0
  650. package/system/dist/builtins/storage-orchestrator/storage-migration-coordinator.d.ts +241 -0
  651. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +318 -0
  652. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +5280 -0
  653. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +5264 -0
  654. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +475 -0
  655. package/system/dist/builtins/storage-orchestrator/storage-pressure-manager.d.ts +115 -0
  656. package/system/dist/builtins/system-backup/backup-encryption.d.ts +94 -0
  657. package/system/dist/builtins/system-backup/system-backup.service.d.ts +308 -0
  658. package/system/dist/builtins/system-config/index.d.ts +2 -0
  659. package/system/dist/builtins/system-config/index.js +10 -0
  660. package/system/dist/builtins/system-config/index.mjs +2 -0
  661. package/system/dist/builtins/system-config/mesh-actions.d.ts +3 -0
  662. package/system/dist/builtins/system-config/record-kinds.d.ts +32 -0
  663. package/system/dist/builtins/system-config/system-config.addon.d.ts +56 -0
  664. package/system/dist/builtins/system-config/system-config.addon.js +89334 -0
  665. package/system/dist/builtins/system-config/system-config.addon.mjs +89233 -0
  666. package/system/dist/builtins/winston-logging/index.d.ts +3 -0
  667. package/system/dist/builtins/winston-logging/index.js +324 -0
  668. package/system/dist/builtins/winston-logging/index.mjs +313 -0
  669. package/system/dist/builtins/winston-logging/log-file-cursor.d.ts +12 -0
  670. package/system/dist/builtins/winston-logging/log-file-index-store.d.ts +11 -0
  671. package/system/dist/builtins/winston-logging/log-file-index.d.ts +77 -0
  672. package/system/dist/builtins/winston-logging/log-file-read-client.d.ts +44 -0
  673. package/system/dist/builtins/winston-logging/log-file-read-protocol.d.ts +41 -0
  674. package/system/dist/builtins/winston-logging/log-file-read-worker.d.ts +1 -0
  675. package/system/dist/builtins/winston-logging/log-file-reader.d.ts +51 -0
  676. package/system/dist/builtins/winston-logging/winston-destination.d.ts +39 -0
  677. package/system/dist/builtins/winston-logging/winston-logging.addon.d.ts +20 -0
  678. package/system/dist/chunk-CNf5ZN-e.mjs +37 -0
  679. package/system/dist/chunk-Cek0wNdY.js +64 -0
  680. package/system/dist/composition-sources-C14epb_m.js +155 -0
  681. package/system/dist/composition-sources-EXNuxmGQ.mjs +132 -0
  682. package/system/dist/constants-DIGWBiNC.mjs +20 -0
  683. package/system/dist/constants-M7NtSiRo.js +66 -0
  684. package/system/dist/coral-accelerators-BSVsBVzt.js +250 -0
  685. package/system/dist/coral-accelerators-DBlgWB8k.mjs +231 -0
  686. package/system/dist/custom-action-registry-JuMHGKEc.js +1638 -0
  687. package/system/dist/custom-action-registry-oHl1xltx.mjs +1482 -0
  688. package/system/dist/device-ca-3vmBP1i0.js +474 -0
  689. package/system/dist/device-ca-DZlvNBWU.mjs +367 -0
  690. package/system/dist/dist-DcMqHB_N.mjs +108095 -0
  691. package/system/dist/dist-M9yHiIY7.js +110554 -0
  692. package/system/dist/download/hosted-model-revisions.d.ts +10 -0
  693. package/system/dist/download/model-download-service.d.ts +35 -0
  694. package/system/dist/download/model-downloader.d.ts +156 -0
  695. package/system/dist/events/event-bus.d.ts +10 -0
  696. package/system/dist/events/system-event-bus.d.ts +14 -0
  697. package/system/dist/feature/feature-manager.d.ts +11 -0
  698. package/system/dist/file-host-worker.js +160 -0
  699. package/system/dist/file-host-worker.mjs +160 -0
  700. package/system/dist/formatter-DkYZ4LXp.mjs +162 -0
  701. package/system/dist/formatter-xbxeV4GD.js +167 -0
  702. package/system/dist/framework-resolver-hook.mjs +49 -0
  703. package/system/dist/http/asset-compression.d.ts +55 -0
  704. package/system/dist/http/authenticated-file-server.d.ts +53 -0
  705. package/system/dist/http/data-plane-registry.d.ts +58 -0
  706. package/system/dist/http/file-data-plane.d.ts +18 -0
  707. package/system/dist/http/lan-http-bind.d.ts +41 -0
  708. package/system/dist/http/reverse-proxy.d.ts +42 -0
  709. package/system/dist/hub-mdns-ciao-CpCKuQnK.js +1163 -0
  710. package/system/dist/hub-mdns-ciao-Czz2ssit.mjs +942 -0
  711. package/system/dist/i18n/catalog-registry.d.ts +35 -0
  712. package/system/dist/i18n/index.d.ts +2 -0
  713. package/system/dist/index.d.ts +156 -0
  714. package/system/dist/index.js +28736 -0
  715. package/system/dist/index.mjs +28065 -0
  716. package/system/dist/intel-accelerators-BvBjZn4j.js +16 -0
  717. package/system/dist/intel-accelerators-idEumqk1.mjs +15 -0
  718. package/system/dist/intel-npu-C8HKvRQF.mjs +27 -0
  719. package/system/dist/intel-npu-DYF5hO5K.js +28 -0
  720. package/system/dist/kernel/addon-class-resolver.d.ts +4 -0
  721. package/system/dist/kernel/addon-engine-manager.d.ts +22 -0
  722. package/system/dist/kernel/addon-health-monitor.d.ts +163 -0
  723. package/system/dist/kernel/addon-installer.d.ts +651 -0
  724. package/system/dist/kernel/addon-loader.d.ts +144 -0
  725. package/system/dist/kernel/addon-manifest.d.ts +128 -0
  726. package/system/dist/kernel/addon-refused-error.d.ts +30 -0
  727. package/system/dist/kernel/addon-residue.d.ts +45 -0
  728. package/system/dist/kernel/addon-settings-store.d.ts +43 -0
  729. package/system/dist/kernel/addon-version-policy.d.ts +34 -0
  730. package/system/dist/kernel/anon-rss.d.ts +12 -0
  731. package/system/dist/kernel/array-buffer-census.d.ts +118 -0
  732. package/system/dist/kernel/bootstrap-config.d.ts +7 -0
  733. package/system/dist/kernel/cap-router-builder.d.ts +180 -0
  734. package/system/dist/kernel/capability-handle.d.ts +46 -0
  735. package/system/dist/kernel/capability-registry.d.ts +621 -0
  736. package/system/dist/kernel/config-manager.d.ts +174 -0
  737. package/system/dist/kernel/config-schema.d.ts +37 -0
  738. package/system/dist/kernel/custom-action-registry.d.ts +32 -0
  739. package/system/dist/kernel/deps/addon-deps-manager.d.ts +28 -0
  740. package/system/dist/kernel/deps/closure-dedupe.d.ts +105 -0
  741. package/system/dist/kernel/deps/ensure-addon-natives.d.ts +41 -0
  742. package/system/dist/kernel/deps/ensure-native-prebuilds.d.ts +40 -0
  743. package/system/dist/kernel/deps/manifest-native-deps.d.ts +42 -0
  744. package/system/dist/kernel/deps/manifest-python-deps.d.ts +20 -0
  745. package/system/dist/kernel/deps/manifest-system-deps.d.ts +18 -0
  746. package/system/dist/kernel/deps/npm-command.d.ts +60 -0
  747. package/system/dist/kernel/deps/system-package-allowlist.d.ts +12 -0
  748. package/system/dist/kernel/deps/system-package-broker.d.ts +31 -0
  749. package/system/dist/kernel/deps/system-package-client.d.ts +9 -0
  750. package/system/dist/kernel/device-call-redirect.d.ts +18 -0
  751. package/system/dist/kernel/device-registry.d.ts +29 -0
  752. package/system/dist/kernel/device-settings-store.d.ts +74 -0
  753. package/system/dist/kernel/event-loop-stall-monitor.d.ts +41 -0
  754. package/system/dist/kernel/event-plane-report.d.ts +225 -0
  755. package/system/dist/kernel/fs-utils.d.ts +88 -0
  756. package/system/dist/kernel/gc-census.d.ts +161 -0
  757. package/system/dist/kernel/heap-spaces.d.ts +112 -0
  758. package/system/dist/kernel/heap-watch.d.ts +816 -0
  759. package/system/dist/kernel/host-externals.d.ts +12 -0
  760. package/system/dist/kernel/hwaccel/hwaccel-resolver.d.ts +56 -0
  761. package/system/dist/kernel/hwaccel/vaapi-init-probe.d.ts +29 -0
  762. package/system/dist/kernel/index.d.ts +116 -0
  763. package/system/dist/kernel/inference/inference-resolver.d.ts +22 -0
  764. package/system/dist/kernel/inference/local-python-runtimes.d.ts +2 -0
  765. package/system/dist/kernel/infra-capabilities.d.ts +13 -0
  766. package/system/dist/kernel/isolated-builtin-phase.d.ts +57 -0
  767. package/system/dist/kernel/lifecycle/job-journal.d.ts +19 -0
  768. package/system/dist/kernel/lifecycle/lifecycle-job-engine.d.ts +106 -0
  769. package/system/dist/kernel/lifecycle/staging-area.d.ts +31 -0
  770. package/system/dist/kernel/moleculer/accessory-prune-gate.d.ts +55 -0
  771. package/system/dist/kernel/moleculer/addon-context-factory.d.ts +104 -0
  772. package/system/dist/kernel/moleculer/addon-data-plane-facility.d.ts +19 -0
  773. package/system/dist/kernel/moleculer/addon-deploy-source.d.ts +16 -0
  774. package/system/dist/kernel/moleculer/addon-peer-bytes-facility.d.ts +25 -0
  775. package/system/dist/kernel/moleculer/addon-runner.d.ts +1 -0
  776. package/system/dist/kernel/moleculer/addon-service-factory.d.ts +50 -0
  777. package/system/dist/kernel/moleculer/agent-event-scope.d.ts +49 -0
  778. package/system/dist/kernel/moleculer/agent-ui-unlock.d.ts +67 -0
  779. package/system/dist/kernel/moleculer/broker-factory.d.ts +95 -0
  780. package/system/dist/kernel/moleculer/broker-transport-swap.d.ts +60 -0
  781. package/system/dist/kernel/moleculer/cap-usage-registry.d.ts +126 -0
  782. package/system/dist/kernel/moleculer/capabilities-access.d.ts +21 -0
  783. package/system/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +53 -0
  784. package/system/dist/kernel/moleculer/child-cap-descriptors.d.ts +34 -0
  785. package/system/dist/kernel/moleculer/child-cap-dispatch.d.ts +59 -0
  786. package/system/dist/kernel/moleculer/children-batch-loader.d.ts +98 -0
  787. package/system/dist/kernel/moleculer/core-cap-service.d.ts +65 -0
  788. package/system/dist/kernel/moleculer/crash-supervisor.d.ts +50 -0
  789. package/system/dist/kernel/moleculer/device-cap-proxy.d.ts +70 -0
  790. package/system/dist/kernel/moleculer/device-event-ring.d.ts +155 -0
  791. package/system/dist/kernel/moleculer/event-bus-core.d.ts +198 -0
  792. package/system/dist/kernel/moleculer/event-bus.d.ts +106 -0
  793. package/system/dist/kernel/moleculer/hub-log-forwarder.d.ts +36 -0
  794. package/system/dist/kernel/moleculer/hub-service.d.ts +39 -0
  795. package/system/dist/kernel/moleculer/init-watchdog.d.ts +60 -0
  796. package/system/dist/kernel/moleculer/mesh-access-middleware.d.ts +42 -0
  797. package/system/dist/kernel/moleculer/mesh-identity.d.ts +57 -0
  798. package/system/dist/kernel/moleculer/mesh-mtls/constants.d.ts +17 -0
  799. package/system/dist/kernel/moleculer/mesh-mtls/index.d.ts +12 -0
  800. package/system/dist/kernel/moleculer/mesh-mtls/mesh-ca-keeper.d.ts +60 -0
  801. package/system/dist/kernel/moleculer/mesh-mtls/mesh-ca.d.ts +49 -0
  802. package/system/dist/kernel/moleculer/mesh-mtls/mesh-certificate-registry.d.ts +105 -0
  803. package/system/dist/kernel/moleculer/mesh-mtls/mesh-crl.d.ts +16 -0
  804. package/system/dist/kernel/moleculer/mesh-mtls/mesh-membership.d.ts +64 -0
  805. package/system/dist/kernel/moleculer/mesh-mtls/mesh-peer-transport.d.ts +47 -0
  806. package/system/dist/kernel/moleculer/mesh-mtls/mesh-renewal.d.ts +135 -0
  807. package/system/dist/kernel/moleculer/mesh-mtls/mesh-tls-enabler.d.ts +9 -0
  808. package/system/dist/kernel/moleculer/mesh-mtls/mesh-tls-gate.d.ts +40 -0
  809. package/system/dist/kernel/moleculer/mesh-mtls/pairing/agent-pairing.d.ts +214 -0
  810. package/system/dist/kernel/moleculer/mesh-mtls/pairing/hub-pairing.d.ts +115 -0
  811. package/system/dist/kernel/moleculer/mesh-mtls/pairing/index.d.ts +3 -0
  812. package/system/dist/kernel/moleculer/mesh-mtls/pairing/pairing-protocol.d.ts +107 -0
  813. package/system/dist/kernel/moleculer/mesh-mtls/tls-tcp-transporter.d.ts +242 -0
  814. package/system/dist/kernel/moleculer/mesh-queue-report.d.ts +51 -0
  815. package/system/dist/kernel/moleculer/node-registry.d.ts +146 -0
  816. package/system/dist/kernel/moleculer/process-context.d.ts +4 -0
  817. package/system/dist/kernel/moleculer/process-service.d.ts +92 -0
  818. package/system/dist/kernel/moleculer/provider-registry.d.ts +28 -0
  819. package/system/dist/kernel/moleculer/readiness-context.d.ts +67 -0
  820. package/system/dist/kernel/moleculer/readiness-service.d.ts +37 -0
  821. package/system/dist/kernel/moleculer/records-api-transport.d.ts +9 -0
  822. package/system/dist/kernel/moleculer/register-framework-resolver.d.ts +8 -0
  823. package/system/dist/kernel/moleculer/register-node-client.d.ts +49 -0
  824. package/system/dist/kernel/moleculer/remote-logger.d.ts +43 -0
  825. package/system/dist/kernel/moleculer/resilient-cap-call.d.ts +28 -0
  826. package/system/dist/kernel/moleculer/runner-addon-settings.d.ts +29 -0
  827. package/system/dist/kernel/moleculer/runner-device-settings.d.ts +39 -0
  828. package/system/dist/kernel/moleculer/runner-heap-flags.d.ts +228 -0
  829. package/system/dist/kernel/moleculer/runner-native-allocator.d.ts +107 -0
  830. package/system/dist/kernel/moleculer/runner-process-group.d.ts +96 -0
  831. package/system/dist/kernel/moleculer/runner-refusal.d.ts +27 -0
  832. package/system/dist/kernel/moleculer/runtime-state-load.d.ts +29 -0
  833. package/system/dist/kernel/moleculer/settings-read-guard.d.ts +49 -0
  834. package/system/dist/kernel/moleculer/stream-probe-service.d.ts +28 -0
  835. package/system/dist/kernel/moleculer/trpc-links.d.ts +244 -0
  836. package/system/dist/kernel/moleculer/typed-array-serde.d.ts +14 -0
  837. package/system/dist/kernel/moleculer/worker-device-restore.d.ts +10 -0
  838. package/system/dist/kernel/outbound-queue-watch.d.ts +94 -0
  839. package/system/dist/kernel/prefix-walk.d.ts +39 -0
  840. package/system/dist/kernel/process-cpu-census.d.ts +74 -0
  841. package/system/dist/kernel/provider-kind-drift.d.ts +21 -0
  842. package/system/dist/kernel/restart-coordinator.d.ts +90 -0
  843. package/system/dist/kernel/sections-store.d.ts +20 -0
  844. package/system/dist/kernel/settings-door-view.d.ts +41 -0
  845. package/system/dist/kernel/settings-read-error.d.ts +35 -0
  846. package/system/dist/kernel/settings-view-types.d.ts +80 -0
  847. package/system/dist/kernel/socket-plane-report.d.ts +268 -0
  848. package/system/dist/kernel/status-overlay.d.ts +38 -0
  849. package/system/dist/kernel/storage-location-registry.d.ts +55 -0
  850. package/system/dist/kernel/store-settings-view.d.ts +14 -0
  851. package/system/dist/kernel/system-settings-mirror.d.ts +46 -0
  852. package/system/dist/kernel/system-settings-policy.d.ts +28 -0
  853. package/system/dist/kernel/transport/cap-action-census.d.ts +218 -0
  854. package/system/dist/kernel/transport/cap-action-name.d.ts +100 -0
  855. package/system/dist/kernel/transport/cap-child-index.d.ts +49 -0
  856. package/system/dist/kernel/transport/cap-route-resolver.d.ts +231 -0
  857. package/system/dist/kernel/transport/cap-route.d.ts +168 -0
  858. package/system/dist/kernel/transport/cap-routing-hints.d.ts +42 -0
  859. package/system/dist/kernel/transport/child-cap-protocol.d.ts +307 -0
  860. package/system/dist/kernel/transport/claimed-get-status.d.ts +39 -0
  861. package/system/dist/kernel/transport/create-local-transport.d.ts +7 -0
  862. package/system/dist/kernel/transport/device-call-redirect.d.ts +39 -0
  863. package/system/dist/kernel/transport/frame-codec.d.ts +122 -0
  864. package/system/dist/kernel/transport/hub-cap-forward.d.ts +96 -0
  865. package/system/dist/kernel/transport/index.d.ts +38 -0
  866. package/system/dist/kernel/transport/local-child-client.d.ts +199 -0
  867. package/system/dist/kernel/transport/local-child-registry.d.ts +654 -0
  868. package/system/dist/kernel/transport/local-endpoint-path.d.ts +6 -0
  869. package/system/dist/kernel/transport/local-transport.d.ts +122 -0
  870. package/system/dist/kernel/transport/parent-unowned-call.d.ts +283 -0
  871. package/system/dist/kernel/transport/peer-answered-error.d.ts +21 -0
  872. package/system/dist/kernel/transport/socket-channel.d.ts +116 -0
  873. package/system/dist/kernel/transport/socket-traffic.d.ts +118 -0
  874. package/system/dist/kernel/transport/uds-event-bridge.d.ts +85 -0
  875. package/system/dist/kernel/transport/uds-event-bus.d.ts +93 -0
  876. package/system/dist/kernel/transport/uds-local-transport.d.ts +18 -0
  877. package/system/dist/kernel/transport/uds-log-ingest.d.ts +43 -0
  878. package/system/dist/kernel/transport/uds-logger.d.ts +44 -0
  879. package/system/dist/kernel/utils/ring-buffer.d.ts +15 -0
  880. package/system/dist/kernel/workspace-detect.d.ts +9 -0
  881. package/system/dist/lib-5THG9eKz.mjs +15545 -0
  882. package/system/dist/lib-C3U1yluo.js +7110 -0
  883. package/system/dist/lib-CZ3g2WTS.js +15549 -0
  884. package/system/dist/lib-DFZblCIu.mjs +7106 -0
  885. package/system/dist/lifecycle/lifecycle-state-machine.d.ts +28 -0
  886. package/system/dist/log-file-read-protocol-B7M3X3bT.mjs +785 -0
  887. package/system/dist/log-file-read-protocol-D0WcLbIV.js +817 -0
  888. package/system/dist/log-file-read-worker.js +64 -0
  889. package/system/dist/log-file-read-worker.mjs +64 -0
  890. package/system/dist/log-read-filter-Bi066jwU.js +134 -0
  891. package/system/dist/log-read-filter-D7Ev3zm-.mjs +93 -0
  892. package/system/dist/logging/formatter.d.ts +57 -0
  893. package/system/dist/logging/log-manager.d.ts +145 -0
  894. package/system/dist/logging/log-read-filter.d.ts +43 -0
  895. package/system/dist/logging/log-redactor.d.ts +30 -0
  896. package/system/dist/logging/log-ring-buffer.d.ts +62 -0
  897. package/system/dist/logging/logging-gate.d.ts +76 -0
  898. package/system/dist/logging/logging-gate.singleton.d.ts +16 -0
  899. package/system/dist/logging/partitioned-log-buffer.d.ts +169 -0
  900. package/system/dist/logging/scoped-logger.d.ts +17 -0
  901. package/system/dist/migrations/hub/index.d.ts +11 -0
  902. package/system/dist/ms-CgH2OFlD.mjs +120 -0
  903. package/system/dist/ms-LB3giGoU.js +124 -0
  904. package/system/dist/network/network-quality.d.ts +11 -0
  905. package/system/dist/notification/notification-service.d.ts +43 -0
  906. package/system/dist/notification/toast-service.d.ts +22 -0
  907. package/system/dist/pipeline/engine-manager-resolver.d.ts +15 -0
  908. package/system/dist/pipeline/pipeline-runner.d.ts +8 -0
  909. package/system/dist/pipeline/pipeline-validator.d.ts +13 -0
  910. package/system/dist/platform-key-source-BWlq0jjn.mjs +23 -0
  911. package/system/dist/platform-key-source-Di7HrlGR.js +40 -0
  912. package/system/dist/prefix-range-D_KueXbQ.js +27 -0
  913. package/system/dist/prefix-range-Dl0znowN.mjs +22 -0
  914. package/system/dist/prefix-walk-DAOBSyH1.mjs +88 -0
  915. package/system/dist/prefix-walk-Dv6MLZlM.js +99 -0
  916. package/system/dist/process/proc-stat.d.ts +75 -0
  917. package/system/dist/process/resource-monitor.d.ts +28 -0
  918. package/system/dist/python/python-env-manager.d.ts +12 -0
  919. package/system/dist/read-all-rows-CVoO1ONM.js +29 -0
  920. package/system/dist/read-all-rows-TaPqdWNF.mjs +25 -0
  921. package/system/dist/records/read-all-rows.d.ts +6 -0
  922. package/system/dist/repl/interfaces.d.ts +31 -0
  923. package/system/dist/repl/repl-engine.d.ts +8 -0
  924. package/system/dist/resource-monitor-Di9daRwI.mjs +96 -0
  925. package/system/dist/resource-monitor-mio9dSCT.js +113 -0
  926. package/system/dist/restore-archive-Cy7jGqiD.js +4325 -0
  927. package/system/dist/restore-archive-DS4nvQ43.mjs +4213 -0
  928. package/system/dist/retention-Dqm_EiVq.mjs +893 -0
  929. package/system/dist/retention-Ufa2fci-.js +1024 -0
  930. package/system/dist/retired-settings-keys-C8nOOr5H.js +381 -0
  931. package/system/dist/retired-settings-keys-u6xQA6r7.mjs +364 -0
  932. package/system/dist/safe-buffer-B1OjL1I9.mjs +42 -0
  933. package/system/dist/safe-buffer-D3aoa-7X.js +46 -0
  934. package/system/dist/settle-sources-Bhsy57y-.js +38 -0
  935. package/system/dist/settle-sources-CDtNC8ub.mjs +33 -0
  936. package/system/dist/snapshot-courtesy-CyFs1M3I.mjs +167 -0
  937. package/system/dist/snapshot-courtesy-D_C5-nC0.js +192 -0
  938. package/system/dist/sqlite-snapshot-protocol-2QaTouWV.mjs +34 -0
  939. package/system/dist/sqlite-snapshot-protocol-B9OndqZv.js +51 -0
  940. package/system/dist/sqlite-snapshot-worker.js +185 -0
  941. package/system/dist/sqlite-snapshot-worker.mjs +179 -0
  942. package/system/dist/src-CnAqG6EF.js +714 -0
  943. package/system/dist/src-hG4grMU4.mjs +709 -0
  944. package/system/dist/storage/fs-storage-backend.d.ts +40 -0
  945. package/system/dist/storage/storage-location-manager.d.ts +23 -0
  946. package/system/dist/storage/storage-manager.d.ts +83 -0
  947. package/system/dist/tls/agent-https-names.d.ts +25 -0
  948. package/system/dist/tls/agent-https.d.ts +111 -0
  949. package/system/dist/tls/boot-tls.d.ts +35 -0
  950. package/system/dist/tls/cert-backdate.d.ts +10 -0
  951. package/system/dist/tls/cert-evaluation.d.ts +41 -0
  952. package/system/dist/tls/cert-identity.d.ts +60 -0
  953. package/system/dist/tls/cert-issue.d.ts +57 -0
  954. package/system/dist/tls/cert-manager.d.ts +124 -0
  955. package/system/dist/tls/cert-name-constraints.d.ts +53 -0
  956. package/system/dist/tls/cert-utc-time.d.ts +1 -0
  957. package/system/dist/tls/https-listener.d.ts +30 -0
  958. package/system/dist/tls/index.d.ts +12 -0
  959. package/system/dist/tls/tls-actions.d.ts +49 -0
  960. package/system/dist/tls/tls-status.d.ts +57 -0
  961. package/system/dist/tls/uploaded-cert.d.ts +46 -0
  962. package/system/dist/wal-checkpoint-policy-BahrTtyD.mjs +186 -0
  963. package/system/dist/wal-checkpoint-policy-d2z2qPqx.js +233 -0
  964. package/system/dist/wal-checkpoint-worker.js +144 -0
  965. package/system/dist/wal-checkpoint-worker.mjs +143 -0
  966. package/system/dist/wal-maintenance-BmugbgS7.js +0 -0
  967. package/system/dist/wal-maintenance-Bnb2QzYG.mjs +0 -0
  968. package/system/dist/x509.es-BRiJgOvu.mjs +11939 -0
  969. package/system/dist/x509.es-WtnRNyYS.js +12076 -0
  970. package/system/package.json +516 -0
@@ -0,0 +1,2487 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_chunk = require("../../chunk-Cek0wNdY.js");
3
+ const require_dist = require("../../dist-M9yHiIY7.js");
4
+ const require_hub_mdns_ciao = require("../../hub-mdns-ciao-CpCKuQnK.js");
5
+ let zod = require("zod");
6
+ let node_net = require("node:net");
7
+ let node_os = require("node:os");
8
+ node_os = require_chunk.__toESM(node_os);
9
+ let node_fs = require("node:fs");
10
+ let node_http = require("node:http");
11
+ node_http = require_chunk.__toESM(node_http);
12
+ let node_dgram = require("node:dgram");
13
+ let node_https = require("node:https");
14
+ node_https = require_chunk.__toESM(node_https);
15
+ //#region src/builtins/local-network/address-book.ts
16
+ /**
17
+ * The Network page's address book, as pure functions: custom addresses plus
18
+ * the role flags carried by detected and custom addresses alike.
19
+ *
20
+ * ## Storage (D734)
21
+ *
22
+ * One key per role: `appConnectionUrls` (`appConnections`, many),
23
+ * `notificationTapUrl` (`notificationTaps`), `publicEndpointUrl`
24
+ * (`publicEndpoint`) and `internalUrl` (`internal`). A single-valued role is
25
+ * one URL — at most one address carries it, by construction. `''` / `[]` is
26
+ * automatic. The custom addresses are `customAddresses` (url + label).
27
+ *
28
+ * The keys of the earlier role names (`viewerBaseUrls`, `notificationBaseUrl`,
29
+ * `signInBaseUrl`, `agentBaseUrl`) are not read: a value stored under one is
30
+ * ignored, and that role is automatic until the operator flags it again
31
+ * (D734 — one install, re-set by hand, no migration code).
32
+ *
33
+ * ## A flag on an address that is in no row
34
+ *
35
+ * A flagged detected address can disappear (a DHCP move) while it still wins
36
+ * its role. {@link normalizeAddressBook} turns every single-valued flag that
37
+ * names neither a detected address, a custom one nor the app link into a
38
+ * custom address carrying that role, on every read; the next write persists
39
+ * the result — so the address shows as a custom row instead of vanishing.
40
+ */
41
+ var CustomAddressListSchema = zod.z.array(zod.z.object({
42
+ baseUrl: zod.z.string(),
43
+ label: zod.z.string()
44
+ }));
45
+ /** The label a flag promoted to a custom address is given. */
46
+ var PROMOTED_LABEL = {
47
+ notificationTaps: "Notification taps address",
48
+ internal: "Internal address",
49
+ publicEndpoint: "Public endpoint"
50
+ };
51
+ var SINGLE_ROLES = [
52
+ "notificationTaps",
53
+ "internal",
54
+ "publicEndpoint"
55
+ ];
56
+ function flagOf(value) {
57
+ return value === "" ? null : value;
58
+ }
59
+ /** Parse the stored custom list; a malformed store reads as empty, never throws. */
60
+ function parseCustomAddresses(raw) {
61
+ const parsed = CustomAddressListSchema.safeParse(raw ?? []);
62
+ return parsed.success ? parsed.data : [];
63
+ }
64
+ /**
65
+ * The address book as it stands: stored custom addresses, plus every
66
+ * single-valued flag that names neither a detected address, a custom one nor
67
+ * the app link, promoted to a custom address (see the module doc).
68
+ */
69
+ function normalizeAddressBook(stored, detectedUrls) {
70
+ const flags = {
71
+ appConnections: stored.appConnectionUrls,
72
+ notificationTaps: flagOf(stored.notificationTapUrl),
73
+ internal: flagOf(stored.internalUrl),
74
+ publicEndpoint: flagOf(stored.publicEndpointUrl)
75
+ };
76
+ const custom = [...parseCustomAddresses(stored.customAddresses)];
77
+ for (const role of SINGLE_ROLES) {
78
+ const url = flags[role];
79
+ if (url === null || require_dist.isAppLinkBase(url) || detectedUrls.has(url)) continue;
80
+ if (custom.some((c) => c.baseUrl === url)) continue;
81
+ custom.push({
82
+ baseUrl: url,
83
+ label: PROMOTED_LABEL[role]
84
+ });
85
+ }
86
+ return {
87
+ custom,
88
+ flags
89
+ };
90
+ }
91
+ /** The stored-settings patch that persists `state`. */
92
+ function addressBookPatch(state) {
93
+ return {
94
+ customAddresses: state.custom,
95
+ appConnectionUrls: state.flags.appConnections,
96
+ notificationTapUrl: state.flags.notificationTaps ?? "",
97
+ publicEndpointUrl: state.flags.publicEndpoint ?? "",
98
+ internalUrl: state.flags.internal ?? ""
99
+ };
100
+ }
101
+ function withCustomAddress(state, entry) {
102
+ const custom = state.custom.some((c) => c.baseUrl === entry.baseUrl) ? state.custom.map((c) => c.baseUrl === entry.baseUrl ? entry : c) : [...state.custom, entry];
103
+ return {
104
+ ...state,
105
+ custom
106
+ };
107
+ }
108
+ /** Drop a custom address and every flag it carried (those roles turn automatic). */
109
+ function withoutCustomAddress(state, baseUrl) {
110
+ const clear = (flag) => flag === baseUrl ? null : flag;
111
+ return {
112
+ custom: state.custom.filter((c) => c.baseUrl !== baseUrl),
113
+ flags: {
114
+ appConnections: state.flags.appConnections.filter((u) => u !== baseUrl),
115
+ notificationTaps: clear(state.flags.notificationTaps),
116
+ internal: clear(state.flags.internal),
117
+ publicEndpoint: clear(state.flags.publicEndpoint)
118
+ }
119
+ };
120
+ }
121
+ /** Every role back to automatic for `role`. */
122
+ function withRoleAutomatic(state, role) {
123
+ return role === "appConnections" ? {
124
+ ...state,
125
+ flags: {
126
+ ...state.flags,
127
+ appConnections: []
128
+ }
129
+ } : {
130
+ ...state,
131
+ flags: {
132
+ ...state.flags,
133
+ [role]: null
134
+ }
135
+ };
136
+ }
137
+ /**
138
+ * Flag or unflag `baseUrl` for `role`. A single-valued role flagged here moves
139
+ * off every other address (it is one URL); unflagging the address that carries
140
+ * it returns the role to automatic. The app link flagged for notification
141
+ * taps IS the automatic answer, stored as automatic — one representation.
142
+ * `appConnections` toggles inside the set; toggling while automatic starts
143
+ * from the automatic set (`autoApp`) so the other addresses keep racing.
144
+ */
145
+ function withRoleFlag(state, role, baseUrl, enabled, autoApp) {
146
+ if (role === "appConnections") {
147
+ const without = (state.flags.appConnections.length === 0 ? autoApp : state.flags.appConnections).filter((u) => u !== baseUrl);
148
+ const appConnections = enabled ? [...without, baseUrl] : without;
149
+ return {
150
+ ...state,
151
+ flags: {
152
+ ...state.flags,
153
+ appConnections
154
+ }
155
+ };
156
+ }
157
+ if (role === "notificationTaps" && require_dist.isAppLinkBase(baseUrl)) return withRoleAutomatic(state, role);
158
+ if (enabled) return {
159
+ ...state,
160
+ flags: {
161
+ ...state.flags,
162
+ [role]: baseUrl
163
+ }
164
+ };
165
+ return state.flags[role] === baseUrl ? withRoleAutomatic(state, role) : state;
166
+ }
167
+ /** What a row may be flagged with. */
168
+ function eligibleRoles(endpoint) {
169
+ if (endpoint.kind === "loopback") return [];
170
+ if (endpoint.kind === "app-link") return ["notificationTaps"];
171
+ return [
172
+ "appConnections",
173
+ "notificationTaps",
174
+ "internal",
175
+ "publicEndpoint"
176
+ ];
177
+ }
178
+ /** A custom address as a palette entry (`kind: 'custom'`). */
179
+ function customEndpoint(entry) {
180
+ return {
181
+ label: entry.label === "" ? "Custom address" : entry.label,
182
+ baseUrl: entry.baseUrl,
183
+ kind: "custom",
184
+ interfaceKind: "other",
185
+ plausible: true,
186
+ plausibleReason: "",
187
+ priority: 200
188
+ };
189
+ }
190
+ /**
191
+ * The palette a client races: the detected endpoints plus the custom
192
+ * addresses flagged `appConnections` (a detected URL is never listed twice).
193
+ */
194
+ function withAppConnectionCustomEndpoints(detected, state) {
195
+ const known = new Set(detected.map((e) => e.baseUrl));
196
+ const wanted = new Set(state.flags.appConnections);
197
+ const extra = state.custom.filter((c) => wanted.has(c.baseUrl) && !known.has(c.baseUrl)).map(customEndpoint);
198
+ return [...detected, ...extra];
199
+ }
200
+ /** Where a twin sorts relative to its plain-HTTP row: straight after it. */
201
+ var HTTPS_TWIN_PRIORITY_STEP = .5;
202
+ /**
203
+ * The HTTPS counterpart of every LAN address advertised over plain HTTP
204
+ * (D859): `http://<lan>:<httpPort>` gains `https://<lan>:<httpsPort>`, the hub's
205
+ * TLS listener, as its own row straight after it. The twin is an ordinary
206
+ * detected LAN row — ticked, unticked and flagged like any other, on by default
207
+ * (a LAN row is an automatic app connection). A phone that does not trust the
208
+ * hub's local CA fails that candidate in the race it already runs; one that
209
+ * does reaches it. Only the app-connection palette and the table carry twins:
210
+ * the palette `internal` and `publicEndpoint` resolve over never does, so those
211
+ * roles keep their answer. Rows already on https (LAN HTTP off), the public
212
+ * tunnel, the mesh, custom addresses and loopback have no twin.
213
+ */
214
+ function withLanHttpsCounterparts(palette, httpsPort) {
215
+ const known = new Set(palette.map((e) => e.baseUrl));
216
+ const out = [];
217
+ for (const endpoint of palette) {
218
+ out.push(endpoint);
219
+ if (endpoint.kind !== "lan-ipv4" && endpoint.kind !== "lan-ipv6") continue;
220
+ const twin = httpsTwinOf(endpoint, httpsPort);
221
+ if (twin === null || known.has(twin.baseUrl)) continue;
222
+ known.add(twin.baseUrl);
223
+ out.push(twin);
224
+ }
225
+ return out;
226
+ }
227
+ function httpsTwinOf(endpoint, httpsPort) {
228
+ let parsed;
229
+ try {
230
+ parsed = new URL(endpoint.baseUrl);
231
+ } catch {
232
+ return null;
233
+ }
234
+ if (parsed.protocol !== "http:") return null;
235
+ return {
236
+ ...endpoint,
237
+ label: `${endpoint.label} (HTTPS)`,
238
+ baseUrl: `https://${parsed.hostname}:${httpsPort}`,
239
+ priority: endpoint.priority + HTTPS_TWIN_PRIORITY_STEP
240
+ };
241
+ }
242
+ /** Every role's answer — the resolvers from `@camstack/types`, nothing else. */
243
+ function resolveRoles(state, appPalette, httpsPalette) {
244
+ return require_dist.resolveHubAddressRoles(withAppConnectionCustomEndpoints(appPalette, state), httpsPalette, state.flags);
245
+ }
246
+ function flagsOn(state, baseUrl) {
247
+ const out = [];
248
+ if (state.flags.appConnections.includes(baseUrl)) out.push("appConnections");
249
+ for (const role of SINGLE_ROLES) if (state.flags[role] === baseUrl) out.push(role);
250
+ return out;
251
+ }
252
+ function inUseOn(roles, baseUrl) {
253
+ const out = [];
254
+ if (roles.appConnections.resolved.includes(baseUrl)) out.push("appConnections");
255
+ for (const role of SINGLE_ROLES) if (roles[role].resolved === baseUrl) out.push(role);
256
+ return out;
257
+ }
258
+ /** The Addresses table: app link, detected rows, then custom-only rows. */
259
+ function buildAddressBook(state, inputs) {
260
+ const roles = resolveRoles(state, inputs.rowsPalette, inputs.httpsPalette);
261
+ const customUrls = new Set(state.custom.map((c) => c.baseUrl));
262
+ const detectedUrls = new Set(inputs.rowsPalette.map((e) => e.baseUrl));
263
+ const row = (endpoint, detected) => ({
264
+ ...endpoint,
265
+ detected,
266
+ custom: customUrls.has(endpoint.baseUrl),
267
+ flags: endpoint.kind === "app-link" ? [] : flagsOn(state, endpoint.baseUrl),
268
+ inUse: endpoint.kind === "app-link" ? roles.notificationTaps.resolved === "https://camstack.zentik.app" ? ["notificationTaps"] : [] : inUseOn(roles, endpoint.baseUrl),
269
+ eligible: eligibleRoles(endpoint)
270
+ });
271
+ return {
272
+ rows: [
273
+ row(inputs.appLink, false),
274
+ ...inputs.rowsPalette.map((e) => row(e, true)),
275
+ ...state.custom.filter((c) => !detectedUrls.has(c.baseUrl)).map((c) => row(customEndpoint(c), false))
276
+ ],
277
+ roles,
278
+ appLinkHub: inputs.appLinkHub,
279
+ listenerOrigins: inputs.listenerOrigins
280
+ };
281
+ }
282
+ var ORIGIN_KINDS = new Set([
283
+ "lan-ipv4",
284
+ "lan-ipv6",
285
+ "public"
286
+ ]);
287
+ /**
288
+ * Every origin a browser can really reach this hub at: the HTTPS listener's
289
+ * `https://<lan>:<httpsPort>` AND, while the LAN HTTP listener is on,
290
+ * `http://<lan>:<httpPort>`; plus the public and custom addresses. The rows
291
+ * show `http://` only while LAN HTTP is on (native clients skip the private
292
+ * certificate), so the https origin the admin UI is opened at is in no row —
293
+ * a sign-in return (D794) matches against this list instead of falling back
294
+ * to the public endpoint. Never loopback, never the app link.
295
+ */
296
+ function buildListenerOrigins(inputs) {
297
+ const out = /* @__PURE__ */ new Set();
298
+ for (const e of [...inputs.overHttps, ...inputs.overHttp]) if (ORIGIN_KINDS.has(e.kind)) out.add(e.baseUrl);
299
+ for (const c of inputs.custom) out.add(c.baseUrl);
300
+ for (const o of inputs.localNameOrigins) out.add(o);
301
+ return [...out];
302
+ }
303
+ //#endregion
304
+ //#region src/builtins/local-network/hub-mdns.ts
305
+ /**
306
+ * Hub mDNS advertisement (D838) — how `camstack login` / `camstack discover`
307
+ * find a hub on the LAN.
308
+ *
309
+ * The hub publishes ONE `_camstack._tcp` service for its HTTPS endpoint. There
310
+ * is no mesh channel in it (D826 retired mesh UDP discovery on purpose) and
311
+ * nothing secret: the TXT record carries the node id, the version, the role
312
+ * and the address URL — finding a hub grants nothing, every client still signs
313
+ * in.
314
+ *
315
+ * The advertised address is NOT ranked here. It is the `internal` role of the
316
+ * address book (the address flagged for LAN clients, else the automatic LAN
317
+ * pick) — this module only reads the answer `local-network` already gives.
318
+ *
319
+ * The responder is injected so the logic is tested with a fake; the real one
320
+ * wraps `@homebridge/ciao`.
321
+ */
322
+ /** The announcement for the current address, or null when nothing qualifies. */
323
+ function buildHubAnnouncement(inputs) {
324
+ if (inputs.internalUrl === null) return null;
325
+ let url;
326
+ try {
327
+ url = new URL(inputs.internalUrl);
328
+ } catch {
329
+ return null;
330
+ }
331
+ if (url.protocol !== "https:") return null;
332
+ const port = url.port === "" ? 443 : Number.parseInt(url.port, 10);
333
+ if (!Number.isInteger(port) || port < 1 || port > 65535) return null;
334
+ const host = url.hostname.replace(/^\[|\]$/g, "");
335
+ const txt = {
336
+ [require_dist.HUB_MDNS_TXT_KEYS.nodeId]: inputs.nodeId,
337
+ [require_dist.HUB_MDNS_TXT_KEYS.role]: "hub",
338
+ [require_dist.HUB_MDNS_TXT_KEYS.url]: url.origin
339
+ };
340
+ if (inputs.version !== null) txt[require_dist.HUB_MDNS_TXT_KEYS.version] = inputs.version;
341
+ return {
342
+ name: `camstack-${inputs.nodeId}`,
343
+ type: require_dist.HUB_MDNS_SERVICE_TYPE,
344
+ port,
345
+ address: (0, node_net.isIP)(host) !== 0 ? host : null,
346
+ txt
347
+ };
348
+ }
349
+ function announcementKey(a) {
350
+ return JSON.stringify([
351
+ a.name,
352
+ a.type,
353
+ a.port,
354
+ a.address,
355
+ a.txt
356
+ ]);
357
+ }
358
+ /**
359
+ * Keeps one mDNS service in step with the hub's `internal` address. `sync()`
360
+ * is safe to call on any change; it never throws — a failure to advertise is
361
+ * logged and the boot goes on.
362
+ */
363
+ var HubMdnsAdvertiser = class {
364
+ options;
365
+ current = null;
366
+ running = false;
367
+ chain = Promise.resolve();
368
+ constructor(options) {
369
+ this.options = options;
370
+ }
371
+ async start() {
372
+ this.running = true;
373
+ await this.sync();
374
+ }
375
+ /** Re-read the address and re-announce when it changed. Serialised. */
376
+ sync() {
377
+ this.chain = this.chain.then(() => this.syncOnce());
378
+ return this.chain;
379
+ }
380
+ async stop() {
381
+ this.running = false;
382
+ await (this.chain = this.chain.then(() => this.withdraw()));
383
+ }
384
+ async syncOnce() {
385
+ if (!this.running) return;
386
+ const { logger } = this.options;
387
+ try {
388
+ const internalUrl = await this.options.readInternalUrl();
389
+ const next = buildHubAnnouncement({
390
+ nodeId: this.options.nodeId,
391
+ version: this.options.version,
392
+ internalUrl
393
+ });
394
+ if (next === null) {
395
+ if (this.current !== null) {
396
+ await this.withdraw();
397
+ logger.info("hub mDNS: no internal address, advertisement withdrawn");
398
+ }
399
+ return;
400
+ }
401
+ const key = announcementKey(next);
402
+ if (this.current?.key === key) return;
403
+ await this.withdraw();
404
+ const handle = await this.options.publisher.publish(next);
405
+ this.current = {
406
+ key,
407
+ handle
408
+ };
409
+ logger.info("hub mDNS: advertising _camstack._tcp", { meta: {
410
+ url: next.txt[require_dist.HUB_MDNS_TXT_KEYS.url],
411
+ port: next.port
412
+ } });
413
+ } catch (err) {
414
+ logger.warn("hub mDNS: could not advertise the hub (logins still work with --server)", { meta: { error: err instanceof Error ? err.message : String(err) } });
415
+ }
416
+ }
417
+ async withdraw() {
418
+ const held = this.current;
419
+ this.current = null;
420
+ if (held === null) return;
421
+ try {
422
+ await held.handle.stop();
423
+ } catch (err) {
424
+ this.options.logger.warn("hub mDNS: withdraw failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
425
+ }
426
+ }
427
+ };
428
+ /**
429
+ * The address a hub advertises: the `internal` role's answer, exactly as the
430
+ * address book resolved it. Never re-ranked here (D729, D732).
431
+ */
432
+ function internalUrlOf(book) {
433
+ return book.roles.internal.resolved;
434
+ }
435
+ //#endregion
436
+ //#region src/builtins/local-network/ipv6-lan.ts
437
+ /**
438
+ * IPv6 helpers for LAN advertisement: prefix matching (privacy addresses
439
+ * rotate inside a /64), Linux `/proc/net/if_inet6` flags, and the gate
440
+ * that keeps temporary GUA off the connection candidate list.
441
+ */
442
+ var IFA_F_TEMPORARY = 1;
443
+ var IFA_F_DEPRECATED = 32;
444
+ var IFA_F_TENTATIVE = 64;
445
+ /** First 64 bits, canonical hex groups, or null if the address is not IPv6. */
446
+ function ipv6Prefix64Key(address) {
447
+ const groups = parseIpv6Groups(address);
448
+ if (groups === null) return null;
449
+ return groups.slice(0, 4).map((g) => g.toString(16).padStart(4, "0")).join(":");
450
+ }
451
+ /** 32-char lowercase hex (same encoding as `/proc/net/if_inet6`). */
452
+ function ipv6ToHex32(address) {
453
+ const groups = parseIpv6Groups(address);
454
+ if (groups === null) return null;
455
+ return groups.map((g) => g.toString(16).padStart(4, "0")).join("");
456
+ }
457
+ /**
458
+ * Parse Linux `if_inet6` into hex32 → flags. Unknown / malformed lines
459
+ * are skipped. Keys match {@link ipv6ToHex32}.
460
+ */
461
+ function parseProcIfInet6(text) {
462
+ const out = /* @__PURE__ */ new Map();
463
+ for (const line of text.split("\n")) {
464
+ const trimmed = line.trim();
465
+ if (trimmed === "") continue;
466
+ const parts = trimmed.split(/\s+/);
467
+ const hex = parts[0]?.toLowerCase();
468
+ const flagsRaw = parts[4];
469
+ if (!hex || hex.length !== 32 || flagsRaw === void 0) continue;
470
+ const flags = Number.parseInt(flagsRaw, 16);
471
+ if (!Number.isFinite(flags)) continue;
472
+ out.set(hex, flags);
473
+ }
474
+ return out;
475
+ }
476
+ /**
477
+ * Whether this IPv6 should be auto-seeded / advertised.
478
+ * `flags === undefined` means the platform did not tell us (macOS, tests
479
+ * without a proc snapshot) — keep every non-link-local plausible address.
480
+ *
481
+ * On Linux, drop addresses marked TEMPORARY / DEPRECATED / TENTATIVE, and
482
+ * `flags === 0` which is how this kernel reports RFC 4941 privacy temps
483
+ * (the stable GUA is PERMANENT|NODAD). Do **not** require PERMANENT —
484
+ * stateful DHCPv6 GUA often has only NODAD (0x02).
485
+ */
486
+ function shouldAdvertiseIpv6(address, flags) {
487
+ const a = address.toLowerCase().split("%")[0] ?? address;
488
+ if (a === "::" || a === "::1") return false;
489
+ if (a.startsWith("fe80:")) return false;
490
+ if (a.startsWith("ff")) return false;
491
+ if (flags === void 0) return true;
492
+ if ((flags & IFA_F_TEMPORARY) !== 0) return false;
493
+ if ((flags & IFA_F_DEPRECATED) !== 0) return false;
494
+ if ((flags & IFA_F_TENTATIVE) !== 0) return false;
495
+ if (flags === 0) return false;
496
+ return true;
497
+ }
498
+ function ipv6AllowlistMatches(address, allowed) {
499
+ if (allowed.includes(address)) return true;
500
+ const key = ipv6Prefix64Key(address);
501
+ if (key === null) return false;
502
+ for (const entry of allowed) {
503
+ if (!entry.includes(":")) continue;
504
+ if (ipv6Prefix64Key(entry) === key) return true;
505
+ }
506
+ return false;
507
+ }
508
+ function parseIpv6Groups(address) {
509
+ const raw = address.toLowerCase().split("%")[0];
510
+ if (!raw || raw.includes(".")) return null;
511
+ const sides = raw.split("::");
512
+ if (sides.length > 2) return null;
513
+ const parsePart = (part) => {
514
+ if (part === void 0 || part === "") return [];
515
+ const groups = part.split(":");
516
+ const out = [];
517
+ for (const g of groups) {
518
+ if (g === "") return null;
519
+ if (!/^[0-9a-f]{1,4}$/.test(g)) return null;
520
+ out.push(Number.parseInt(g, 16));
521
+ }
522
+ return out;
523
+ };
524
+ if (sides.length === 1) {
525
+ const groups = parsePart(sides[0]);
526
+ if (groups === null || groups.length !== 8) return null;
527
+ return groups;
528
+ }
529
+ const left = parsePart(sides[0]);
530
+ const right = parsePart(sides[1]);
531
+ if (left === null || right === null) return null;
532
+ const fill = 8 - left.length - right.length;
533
+ if (fill < 0) return null;
534
+ return [
535
+ ...left,
536
+ ...Array(fill).fill(0),
537
+ ...right
538
+ ];
539
+ }
540
+ //#endregion
541
+ //#region src/builtins/local-network/local-hostname.ts
542
+ var DNS_NAME = /^(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])$/;
543
+ /**
544
+ * Parse the operator-typed local hostname.
545
+ *
546
+ * Empty / whitespace → `null` (advertise the raw LAN IP). A DNS name is
547
+ * lowercased. A URL, port suffix, path, or bare IP is rejected so it cannot
548
+ * leak into a SAN or a candidate URL.
549
+ */
550
+ function parseLocalHostname(raw) {
551
+ const trimmed = raw.trim();
552
+ if (trimmed === "") return {
553
+ ok: true,
554
+ value: null
555
+ };
556
+ if (/[\s/:?#]/.test(trimmed) || trimmed.includes("\\")) return {
557
+ ok: false,
558
+ error: "Enter a DNS name such as camstack.lan, without a scheme or port."
559
+ };
560
+ const lowered = trimmed.toLowerCase();
561
+ if ((0, node_net.isIP)(lowered) !== 0) return {
562
+ ok: false,
563
+ error: "Use the address allowlist for IPs — this field is a DNS name."
564
+ };
565
+ if (!DNS_NAME.test(lowered)) return {
566
+ ok: false,
567
+ error: "Enter a DNS name such as camstack.lan, without a scheme or port."
568
+ };
569
+ return {
570
+ ok: true,
571
+ value: lowered
572
+ };
573
+ }
574
+ //#endregion
575
+ //#region src/builtins/local-network/scan/dns-wire.ts
576
+ /**
577
+ * DNS-SD wire format for the scan engine: one PTR question per service type,
578
+ * and a parser that turns an answer into services (instance, host, port, TXT).
579
+ */
580
+ /** Top bit of the question class: ask for a unicast reply (RFC 6762). */
581
+ var MDNS_QU_CLASS = 32769;
582
+ var A = 1;
583
+ var PTR = 12;
584
+ var TXT = 16;
585
+ var SRV = 33;
586
+ var SRV_FIXED = 6;
587
+ var MAX_NAME_HOPS = 16;
588
+ var MDNS_PORT = 5353;
589
+ var MDNS_GROUP = "224.0.0.251";
590
+ /** `_esphomelib._tcp` and `_esphomelib._tcp.local.` name the same service. */
591
+ function normalizeServiceType(serviceType) {
592
+ const lower = serviceType.trim().toLowerCase().replace(/\.$/, "");
593
+ return lower.endsWith(".local") ? lower.slice(0, -6) : lower;
594
+ }
595
+ function readName(buf, start) {
596
+ const labels = [];
597
+ let pos = start;
598
+ let end = start;
599
+ let jumped = false;
600
+ for (let hops = 0; hops < MAX_NAME_HOPS; hops++) {
601
+ if (pos < 0 || pos >= buf.length) return null;
602
+ const len = buf[pos] ?? 0;
603
+ if (len === 0) {
604
+ if (!jumped) end = pos + 1;
605
+ return {
606
+ name: labels.join("."),
607
+ end
608
+ };
609
+ }
610
+ if ((len & 192) === 192) {
611
+ if (pos + 1 >= buf.length) return null;
612
+ if (!jumped) end = pos + 2;
613
+ jumped = true;
614
+ pos = (len & 63) << 8 | (buf[pos + 1] ?? 0);
615
+ continue;
616
+ }
617
+ if ((len & 192) !== 0 || pos + 1 + len > buf.length) return null;
618
+ labels.push(buf.subarray(pos + 1, pos + 1 + len).toString("utf8"));
619
+ pos += 1 + len;
620
+ if (!jumped) end = pos;
621
+ }
622
+ return null;
623
+ }
624
+ function readRecords(buf, offset, count) {
625
+ const records = [];
626
+ let pos = offset;
627
+ for (let i = 0; i < count; i++) {
628
+ const name = readName(buf, pos);
629
+ if (name === null || name.end + 10 > buf.length) return null;
630
+ const type = buf.readUInt16BE(name.end);
631
+ const dataLength = buf.readUInt16BE(name.end + 8);
632
+ const dataOffset = name.end + 10;
633
+ if (dataOffset + dataLength > buf.length) return null;
634
+ records.push({
635
+ name: name.name,
636
+ type,
637
+ dataOffset,
638
+ dataLength
639
+ });
640
+ pos = dataOffset + dataLength;
641
+ }
642
+ return {
643
+ records,
644
+ next: pos
645
+ };
646
+ }
647
+ function parseTxt(buf, offset, length) {
648
+ const out = {};
649
+ let pos = offset;
650
+ const end = offset + length;
651
+ while (pos < end) {
652
+ const len = buf[pos] ?? 0;
653
+ pos += 1;
654
+ if (len === 0 || pos + len > end) break;
655
+ const entry = buf.subarray(pos, pos + len).toString("utf8");
656
+ pos += len;
657
+ const eq = entry.indexOf("=");
658
+ if (eq < 0) out[entry] = "";
659
+ else out[entry.slice(0, eq)] = entry.slice(eq + 1);
660
+ }
661
+ return out;
662
+ }
663
+ /** One PTR question per service type, all with the unicast-reply bit. */
664
+ function buildPtrQuery(serviceTypes) {
665
+ const header = Buffer.alloc(12);
666
+ header.writeUInt16BE(serviceTypes.length, 4);
667
+ const questions = serviceTypes.map((type) => {
668
+ const encoded = `${normalizeServiceType(type)}.local`.split(".").filter((part) => part.length > 0).map((l) => Buffer.concat([Buffer.from([l.length]), Buffer.from(l)]));
669
+ const tail = Buffer.alloc(4);
670
+ tail.writeUInt16BE(PTR, 0);
671
+ tail.writeUInt16BE(MDNS_QU_CLASS, 2);
672
+ return Buffer.concat([
673
+ ...encoded,
674
+ Buffer.from([0]),
675
+ tail
676
+ ]);
677
+ });
678
+ return Buffer.concat([header, ...questions]);
679
+ }
680
+ /** The services advertised on one mDNS message; a malformed packet yields none. */
681
+ function parseMdnsMessage(buf) {
682
+ if (buf.length < 12) return [];
683
+ const [questions = 0, answers = 0, authorities = 0, extra = 0] = [
684
+ 4,
685
+ 6,
686
+ 8,
687
+ 10
688
+ ].map((o) => buf.readUInt16BE(o));
689
+ let pos = 12;
690
+ for (let i = 0; i < questions; i++) {
691
+ const name = readName(buf, pos);
692
+ if (name === null) return [];
693
+ pos = name.end + 4;
694
+ if (pos > buf.length) return [];
695
+ }
696
+ const records = [];
697
+ for (const count of [
698
+ answers,
699
+ authorities,
700
+ extra
701
+ ]) {
702
+ const read = readRecords(buf, pos, count);
703
+ if (read === null) return [];
704
+ records.push(...read.records);
705
+ pos = read.next;
706
+ }
707
+ const ptrs = [];
708
+ const srv = /* @__PURE__ */ new Map();
709
+ const txt = /* @__PURE__ */ new Map();
710
+ const addresses = /* @__PURE__ */ new Map();
711
+ for (const rec of records) {
712
+ const key = rec.name.toLowerCase();
713
+ if (rec.type === PTR) {
714
+ const target = readName(buf, rec.dataOffset);
715
+ if (target !== null) ptrs.push({
716
+ serviceType: rec.name,
717
+ instance: target.name
718
+ });
719
+ } else if (rec.type === SRV && rec.dataLength >= SRV_FIXED) {
720
+ const target = readName(buf, rec.dataOffset + SRV_FIXED);
721
+ if (target !== null) srv.set(key, {
722
+ target: target.name,
723
+ port: buf.readUInt16BE(rec.dataOffset + 4)
724
+ });
725
+ } else if (rec.type === TXT) txt.set(key, parseTxt(buf, rec.dataOffset, rec.dataLength));
726
+ 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]}`);
727
+ }
728
+ const out = [];
729
+ for (const { serviceType, instance } of ptrs) {
730
+ const service = srv.get(instance.toLowerCase());
731
+ const target = service?.target ?? instance;
732
+ out.push({
733
+ serviceType: normalizeServiceType(serviceType),
734
+ instance,
735
+ address: addresses.get(target.toLowerCase()) ?? addresses.get(instance.toLowerCase()) ?? null,
736
+ host: target,
737
+ port: service?.port ?? 0,
738
+ txt: txt.get(instance.toLowerCase()) ?? {}
739
+ });
740
+ }
741
+ return out;
742
+ }
743
+ //#endregion
744
+ //#region src/builtins/local-network/scan/scan-io.ts
745
+ /** A hit carries at most this much of a response body. */
746
+ var MAX_HIT_BODY_BYTES = 16 * 1024;
747
+ //#endregion
748
+ //#region src/builtins/local-network/scan/subnets.ts
749
+ /** Total hosts one scan may visit across every subnet. */
750
+ var MAX_SCAN_HOSTS = 4096;
751
+ /** A refused subnet input: the operator typed something the engine will not sweep. */
752
+ var ScanSubnetError = class extends Error {
753
+ constructor(message) {
754
+ super(message);
755
+ this.name = "ScanSubnetError";
756
+ }
757
+ };
758
+ var IPV4 = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
759
+ function ipv4ToInt(address) {
760
+ const m = IPV4.exec(address.trim());
761
+ if (m === null) return null;
762
+ let out = 0;
763
+ for (let i = 1; i <= 4; i++) {
764
+ const octet = Number(m[i]);
765
+ if (octet > 255) return null;
766
+ out = out * 256 + octet;
767
+ }
768
+ return out;
769
+ }
770
+ function intToIpv4(value) {
771
+ return [
772
+ value >>> 24,
773
+ value >>> 16 & 255,
774
+ value >>> 8 & 255,
775
+ value & 255
776
+ ].join(".");
777
+ }
778
+ function prefixMask(prefix) {
779
+ return prefix === 0 ? 0 : 4294967295 << 32 - prefix >>> 0;
780
+ }
781
+ /** Parse `a.b.c.d/p`. A bare address is a /32. Throws {@link ScanSubnetError}. */
782
+ function parseCidr(input) {
783
+ const [addr, rest, ...extra] = input.trim().split("/");
784
+ if (extra.length > 0 || addr === void 0) throw new ScanSubnetError(`Invalid CIDR "${input}"`);
785
+ const ip = ipv4ToInt(addr);
786
+ if (ip === null) throw new ScanSubnetError(`Invalid CIDR "${input}": not an IPv4 address`);
787
+ const prefix = rest === void 0 ? 32 : /^\d{1,2}$/.test(rest) ? Number(rest) : -1;
788
+ if (prefix < 0 || prefix > 32) throw new ScanSubnetError(`Invalid CIDR "${input}": bad prefix`);
789
+ if (prefix < 22) throw new ScanSubnetError(`CIDR "${input}" is wider than /22`);
790
+ const base = (ip & prefixMask(prefix)) >>> 0;
791
+ return {
792
+ cidr: `${intToIpv4(base)}/${prefix}`,
793
+ base,
794
+ prefix
795
+ };
796
+ }
797
+ /** Host addresses of a subnet, network and broadcast excluded (a /32 is its own host). */
798
+ function hostsOf(subnet) {
799
+ if (subnet.prefix === 32) return [intToIpv4(subnet.base)];
800
+ const size = 2 ** (32 - subnet.prefix);
801
+ if (subnet.prefix === 31) return [intToIpv4(subnet.base), intToIpv4(subnet.base + 1)];
802
+ const out = [];
803
+ for (let i = 1; i < size - 1; i++) out.push(intToIpv4(subnet.base + i));
804
+ return out;
805
+ }
806
+ /** The directed-broadcast address of a subnet. */
807
+ function broadcastOf(subnet) {
808
+ return intToIpv4(subnet.base + 2 ** (32 - subnet.prefix) - 1);
809
+ }
810
+ function containsAddress(subnet, address) {
811
+ const ip = ipv4ToInt(address);
812
+ return ip !== null && (ip & prefixMask(subnet.prefix)) >>> 0 === subnet.base;
813
+ }
814
+ function prefixOfNetmask(netmask) {
815
+ const mask = ipv4ToInt(netmask);
816
+ if (mask === null) return 24;
817
+ let bits = 0;
818
+ for (let bit = 31; bit >= 0 && (mask >>> bit & 1) === 1; bit--) bits++;
819
+ return bits;
820
+ }
821
+ /** A link the hub sits on and can scan: IPv4, not loopback / link-local, LAN or Wi-Fi. */
822
+ function isScannableLink(iface) {
823
+ if (iface.family !== "IPv4" || iface.internal) return false;
824
+ if (iface.address.startsWith("169.254.")) return false;
825
+ return iface.kind === "lan" || iface.kind === "wifi";
826
+ }
827
+ /** The hub's own /24 (or narrower) per scannable link. */
828
+ function ownLinkSubnets(interfaces) {
829
+ const out = /* @__PURE__ */ new Map();
830
+ for (const iface of interfaces) {
831
+ if (!isScannableLink(iface)) continue;
832
+ const prefix = Math.max(prefixOfNetmask(iface.netmask), 24);
833
+ const ip = ipv4ToInt(iface.address);
834
+ if (ip === null) continue;
835
+ const base = (ip & prefixMask(prefix)) >>> 0;
836
+ const subnet = {
837
+ cidr: `${intToIpv4(base)}/${prefix}`,
838
+ base,
839
+ prefix
840
+ };
841
+ out.set(subnet.cidr, subnet);
842
+ }
843
+ return [...out.values()];
844
+ }
845
+ /**
846
+ * hub /24s ∪ saved ∪ per-call. An invalid CIDR, or a union above
847
+ * {@link MAX_SCAN_HOSTS} hosts, throws {@link ScanSubnetError}.
848
+ */
849
+ function resolveScanSubnets(input) {
850
+ const own = ownLinkSubnets(input.interfaces);
851
+ const ownCidrs = new Set(own.map((s) => s.cidr));
852
+ const extraParsed = [...input.saved, ...input.perCall].map(parseCidr);
853
+ const all = /* @__PURE__ */ new Map();
854
+ for (const s of own) all.set(s.cidr, s);
855
+ const extra = /* @__PURE__ */ new Map();
856
+ for (const s of extraParsed) {
857
+ if (!all.has(s.cidr)) all.set(s.cidr, s);
858
+ if (!ownCidrs.has(s.cidr)) extra.set(s.cidr, s);
859
+ }
860
+ const ownAddresses = new Set(input.interfaces.map((i) => i.address));
861
+ const hosts = /* @__PURE__ */ new Set();
862
+ for (const s of all.values()) {
863
+ for (const h of hostsOf(s)) if (!ownAddresses.has(h)) hosts.add(h);
864
+ if (hosts.size > 4096) throw new ScanSubnetError(`The subnets cover more than ${MAX_SCAN_HOSTS} hosts; remove or narrow one`);
865
+ }
866
+ return {
867
+ all: [...all.values()],
868
+ extra: [...extra.values()],
869
+ hosts: [...hosts]
870
+ };
871
+ }
872
+ /** Validate a list to be saved: same rules as a scan, returned canonical and deduplicated. */
873
+ function validateSavedSubnets(list) {
874
+ const parsed = list.map(parseCidr);
875
+ const cidrs = [...new Set(parsed.map((s) => s.cidr))];
876
+ resolveScanSubnets({
877
+ interfaces: [],
878
+ saved: cidrs,
879
+ perCall: []
880
+ });
881
+ return cidrs;
882
+ }
883
+ var SCAN_REQUEST_TIMEOUT_MS = 1200;
884
+ /** Wi-Fi boards drop or late-answer one multicast query: send it three times, listen to the end. */
885
+ var MULTICAST_RESEND_AT_MS = [1200, 2500];
886
+ var MULTICAST_LISTEN_MS = 4500;
887
+ /** Unicast DNS-SD probes to extra subnets get one retry. */
888
+ var UNICAST_RESEND_AT_MS = [900];
889
+ var UNICAST_LISTEN_MS = 2e3;
890
+ var WSD_GROUP = "239.255.255.250";
891
+ var WSD_PORT = 3702;
892
+ var SSDP_PORT = 1900;
893
+ var MAX_HEADERS_PER_HIT = 32;
894
+ function bucket(c, kind) {
895
+ const existing = c.stats.get(kind);
896
+ if (existing !== void 0) return existing;
897
+ const fresh = {
898
+ probed: 0,
899
+ hits: 0,
900
+ timeouts: 0
901
+ };
902
+ c.stats.set(kind, fresh);
903
+ return fresh;
904
+ }
905
+ function emit(c, entry, hit) {
906
+ c.hits.push({
907
+ providerId: entry.providerId,
908
+ hit: {
909
+ ...hit,
910
+ modeIndex: entry.modeIndex
911
+ }
912
+ });
913
+ bucket(c, entry.mode.kind).hits += 1;
914
+ }
915
+ function isKind(mode, kind) {
916
+ return mode.kind === kind;
917
+ }
918
+ function entriesOf(requests, kind) {
919
+ const out = [];
920
+ for (const req of requests) req.modes.forEach((mode, modeIndex) => {
921
+ if (isKind(mode, kind)) out.push({
922
+ providerId: req.providerId,
923
+ modeIndex,
924
+ mode
925
+ });
926
+ });
927
+ return out;
928
+ }
929
+ /** Hosts of the subnets multicast cannot reach. */
930
+ function extraHostsOf(subnets) {
931
+ return subnets.hosts.filter((h) => subnets.extra.some((s) => containsAddress(s, h)));
932
+ }
933
+ /** Run `task` over `items` with at most `limit` in flight. */
934
+ async function pool(items, limit, task) {
935
+ let next = 0;
936
+ const worker = async () => {
937
+ for (;;) {
938
+ const index = next++;
939
+ const item = items[index];
940
+ if (index >= items.length || item === void 0) return;
941
+ await task(item);
942
+ }
943
+ };
944
+ await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
945
+ }
946
+ /** Hits per scanned CIDR, so "5 of 20 boards" is visible without a packet capture. */
947
+ function hitsBySubnet(subnets, hits) {
948
+ const out = {};
949
+ for (const subnet of subnets.all) out[subnet.cidr] = hits.filter((h) => containsAddress(subnet, h.hit.host)).length;
950
+ return out;
951
+ }
952
+ /** A resent query is answered more than once: one hit per distinct reply. */
953
+ function dedupeReplies(replies) {
954
+ const seen = /* @__PURE__ */ new Set();
955
+ const out = [];
956
+ for (const reply of replies) {
957
+ const key = `${reply.host}:${reply.port}:${reply.data.toString("hex")}`;
958
+ if (seen.has(key)) continue;
959
+ seen.add(key);
960
+ out.push(reply);
961
+ }
962
+ return out;
963
+ }
964
+ function hubLinks(interfaces) {
965
+ return interfaces.filter(isScannableLink);
966
+ }
967
+ function instanceLabel(instance) {
968
+ return instance.split("._")[0] ?? instance;
969
+ }
970
+ async function runMdns(deps, entries, subnets, c) {
971
+ if (entries.length === 0) return;
972
+ const query = buildPtrQuery([...new Set(entries.map((e) => normalizeServiceType(e.mode.serviceType)))]);
973
+ const replies = [];
974
+ const links = hubLinks(deps.interfaces());
975
+ for (const link of links) {
976
+ bucket(c, "mdns").probed += 1;
977
+ replies.push(...await deps.io.udpExchange({
978
+ payload: query,
979
+ targets: [{
980
+ host: MDNS_GROUP,
981
+ port: MDNS_PORT
982
+ }],
983
+ localAddress: link.address,
984
+ resendAtMs: MULTICAST_RESEND_AT_MS,
985
+ listenMs: MULTICAST_LISTEN_MS
986
+ }));
987
+ }
988
+ const extraHosts = extraHostsOf(subnets);
989
+ if (extraHosts.length > 0) {
990
+ bucket(c, "mdns").probed += extraHosts.length;
991
+ replies.push(...await deps.io.udpExchange({
992
+ payload: query,
993
+ targets: extraHosts.map((host) => ({
994
+ host,
995
+ port: MDNS_PORT
996
+ })),
997
+ resendAtMs: UNICAST_RESEND_AT_MS,
998
+ listenMs: UNICAST_LISTEN_MS
999
+ }));
1000
+ }
1001
+ for (const reply of dedupeReplies(replies)) for (const service of parseMdnsMessage(reply.data)) for (const entry of entries) {
1002
+ if (normalizeServiceType(entry.mode.serviceType) !== service.serviceType) continue;
1003
+ const label = instanceLabel(service.instance);
1004
+ if (entry.mode.instancePattern !== void 0 && !matches(entry.mode.instancePattern, label)) continue;
1005
+ emit(c, entry, {
1006
+ host: service.address ?? reply.host,
1007
+ port: service.port,
1008
+ mdns: {
1009
+ instance: label,
1010
+ host: service.host,
1011
+ port: service.port,
1012
+ txt: service.txt
1013
+ }
1014
+ });
1015
+ }
1016
+ }
1017
+ function matches(pattern, text) {
1018
+ try {
1019
+ return new RegExp(pattern, "i").test(text);
1020
+ } catch {
1021
+ return false;
1022
+ }
1023
+ }
1024
+ function wsdProbe() {
1025
+ const id = `uuid:${Array.from({ length: 4 }, () => Math.random().toString(16).slice(2, 10)).join("").slice(0, 32)}`;
1026
+ return Buffer.from(`<?xml version="1.0" encoding="UTF-8"?><e:Envelope xmlns:e="http://www.w3.org/2003/05/soap-envelope" xmlns:w="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery"><e:Header><w:MessageID>${id}</w:MessageID><w:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</w:To><w:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</w:Action></e:Header><e:Body><d:Probe/></e:Body></e:Envelope>`);
1027
+ }
1028
+ function xmlText(xml, tag) {
1029
+ const out = [];
1030
+ const re = new RegExp(`<(?:[\\w-]+:)?${tag}[^>]*>([^<]*)</(?:[\\w-]+:)?${tag}>`, "g");
1031
+ for (const m of xml.matchAll(re)) {
1032
+ const text = m[1]?.trim();
1033
+ if (text !== void 0 && text.length > 0) out.push(...text.split(/\s+/));
1034
+ }
1035
+ return out;
1036
+ }
1037
+ async function exchangeEverywhere(deps, kind, payload, multicast, unicastPort, subnets, c) {
1038
+ const replies = [];
1039
+ for (const link of hubLinks(deps.interfaces())) {
1040
+ bucket(c, kind).probed += 1;
1041
+ replies.push(...await deps.io.udpExchange({
1042
+ payload,
1043
+ targets: [multicast],
1044
+ localAddress: link.address,
1045
+ resendAtMs: MULTICAST_RESEND_AT_MS,
1046
+ listenMs: MULTICAST_LISTEN_MS
1047
+ }));
1048
+ }
1049
+ const extraHosts = extraHostsOf(subnets);
1050
+ if (extraHosts.length > 0) {
1051
+ bucket(c, kind).probed += extraHosts.length;
1052
+ replies.push(...await deps.io.udpExchange({
1053
+ payload,
1054
+ targets: extraHosts.map((host) => ({
1055
+ host,
1056
+ port: unicastPort
1057
+ })),
1058
+ resendAtMs: UNICAST_RESEND_AT_MS,
1059
+ listenMs: UNICAST_LISTEN_MS
1060
+ }));
1061
+ }
1062
+ return dedupeReplies(replies);
1063
+ }
1064
+ async function runWsDiscovery(deps, entries, subnets, c) {
1065
+ if (entries.length === 0) return;
1066
+ const replies = await exchangeEverywhere(deps, "ws-discovery", wsdProbe(), {
1067
+ host: WSD_GROUP,
1068
+ port: WSD_PORT
1069
+ }, WSD_PORT, subnets, c);
1070
+ for (const reply of replies) {
1071
+ const xml = reply.data.toString("utf8");
1072
+ const xaddrs = xmlText(xml, "XAddrs");
1073
+ const types = xmlText(xml, "Types");
1074
+ const scopes = xmlText(xml, "Scopes");
1075
+ if (xaddrs.length === 0 && types.length === 0) continue;
1076
+ const first = xaddrs[0] === void 0 ? null : safeUrl(xaddrs[0]);
1077
+ for (const entry of entries) {
1078
+ const wanted = entry.mode.types;
1079
+ if (wanted !== void 0 && !wanted.some((w) => types.some((t) => t.includes(w)))) continue;
1080
+ emit(c, entry, {
1081
+ host: first?.hostname ?? reply.host,
1082
+ port: first === null ? reply.port : Number(first.port || (first.protocol === "https:" ? 443 : 80)),
1083
+ wsd: {
1084
+ xaddrs,
1085
+ types,
1086
+ scopes
1087
+ }
1088
+ });
1089
+ }
1090
+ }
1091
+ }
1092
+ function safeUrl(text) {
1093
+ try {
1094
+ return new URL(text);
1095
+ } catch {
1096
+ return null;
1097
+ }
1098
+ }
1099
+ function parseSsdp(data) {
1100
+ const lines = data.toString("utf8").split(/\r?\n/);
1101
+ const first = /^HTTP\/1\.[01]\s+(\d{3})/.exec(lines[0] ?? "");
1102
+ if (first === null) return null;
1103
+ const headers = {};
1104
+ for (const line of lines.slice(1)) {
1105
+ const colon = line.indexOf(":");
1106
+ if (colon <= 0) continue;
1107
+ if (Object.keys(headers).length >= MAX_HEADERS_PER_HIT) break;
1108
+ headers[line.slice(0, colon).trim().toLowerCase()] = line.slice(colon + 1).trim();
1109
+ }
1110
+ return {
1111
+ status: Number(first[1]),
1112
+ headers
1113
+ };
1114
+ }
1115
+ async function runSsdp(deps, entries, subnets, c) {
1116
+ for (const target of new Set(entries.map((e) => e.mode.searchTarget))) {
1117
+ const replies = await exchangeEverywhere(deps, "ssdp", Buffer.from(`M-SEARCH * HTTP/1.1\r\nHOST: ${WSD_GROUP}:${SSDP_PORT}\r\nMAN: "ssdp:discover"\r\nMX: 1\r\nST: ${target}\r\n\r\n`), {
1118
+ host: WSD_GROUP,
1119
+ port: SSDP_PORT
1120
+ }, SSDP_PORT, subnets, c);
1121
+ for (const reply of replies) {
1122
+ const parsed = parseSsdp(reply.data);
1123
+ if (parsed === null) continue;
1124
+ for (const entry of entries) {
1125
+ if (entry.mode.searchTarget !== target) continue;
1126
+ emit(c, entry, {
1127
+ host: reply.host,
1128
+ port: reply.port,
1129
+ http: {
1130
+ status: parsed.status,
1131
+ headers: parsed.headers,
1132
+ bodyText: ""
1133
+ }
1134
+ });
1135
+ }
1136
+ }
1137
+ }
1138
+ }
1139
+ async function runUdpBroadcast(deps, entries, subnets, c) {
1140
+ const groups = /* @__PURE__ */ new Map();
1141
+ for (const entry of entries) {
1142
+ const { port, payloadHex, listenPort } = entry.mode;
1143
+ const key = `${port}|${payloadHex.toLowerCase()}|${listenPort ?? ""}`;
1144
+ groups.set(key, [...groups.get(key) ?? [], entry]);
1145
+ }
1146
+ const links = hubLinks(deps.interfaces());
1147
+ for (const group of groups.values()) {
1148
+ const first = group[0];
1149
+ if (first === void 0) continue;
1150
+ const { port, payloadHex, listenPort } = first.mode;
1151
+ const payload = Buffer.from(payloadHex, "hex");
1152
+ const replies = [];
1153
+ const sends = [...subnets.all.filter((s) => !subnets.extra.some((x) => x.cidr === s.cidr)).map((s) => ({
1154
+ link: links.find((l) => containsAddress(s, l.address)),
1155
+ host: broadcastOf(s)
1156
+ })).map((b) => ({
1157
+ localAddress: b.link?.address,
1158
+ host: b.host
1159
+ })), ...subnets.extra.map((s) => ({
1160
+ localAddress: void 0,
1161
+ host: broadcastOf(s)
1162
+ }))];
1163
+ for (const send of sends) {
1164
+ bucket(c, "udp-broadcast").probed += 1;
1165
+ replies.push(...await deps.io.udpExchange({
1166
+ payload,
1167
+ targets: [{
1168
+ host: send.host,
1169
+ port
1170
+ }],
1171
+ ...send.localAddress !== void 0 ? { localAddress: send.localAddress } : {},
1172
+ ...listenPort !== void 0 ? { bindPort: listenPort } : {},
1173
+ broadcast: true,
1174
+ resendAtMs: UNICAST_RESEND_AT_MS,
1175
+ listenMs: UNICAST_LISTEN_MS
1176
+ }));
1177
+ }
1178
+ for (const reply of replies) for (const entry of group) emit(c, entry, {
1179
+ host: reply.host,
1180
+ port: reply.port,
1181
+ udp: { payloadHex: reply.data.toString("hex") }
1182
+ });
1183
+ }
1184
+ }
1185
+ function probeKey(m) {
1186
+ return [
1187
+ m.port,
1188
+ m.method,
1189
+ m.path,
1190
+ m.tls,
1191
+ m.contentType ?? "",
1192
+ m.bodyText ?? ""
1193
+ ].join("|");
1194
+ }
1195
+ async function runHttpSweep(deps, entries, subnets, c) {
1196
+ if (entries.length === 0) return;
1197
+ const probes = /* @__PURE__ */ new Map();
1198
+ for (const entry of entries) {
1199
+ const key = probeKey(entry.mode);
1200
+ probes.set(key, [...probes.get(key) ?? [], entry]);
1201
+ }
1202
+ const stats = bucket(c, "http-probe");
1203
+ await pool(subnets.hosts, 64, async (host) => {
1204
+ for (const group of probes.values()) {
1205
+ const mode = group[0]?.mode;
1206
+ if (mode === void 0) continue;
1207
+ const request = {
1208
+ host,
1209
+ port: mode.port,
1210
+ path: mode.path,
1211
+ method: mode.method,
1212
+ tls: mode.tls,
1213
+ timeoutMs: SCAN_REQUEST_TIMEOUT_MS,
1214
+ ...mode.bodyText !== void 0 ? { bodyText: mode.bodyText } : {},
1215
+ ...mode.contentType !== void 0 ? { contentType: mode.contentType } : {}
1216
+ };
1217
+ stats.probed += 1;
1218
+ const outcome = await deps.io.httpProbe(request);
1219
+ if (outcome.kind === "timeout") stats.timeouts += 1;
1220
+ if (outcome.kind !== "response") continue;
1221
+ for (const entry of group) {
1222
+ const accept = entry.mode.acceptStatus;
1223
+ if (accept !== void 0 && !accept.includes(outcome.status)) continue;
1224
+ emit(c, entry, {
1225
+ host,
1226
+ port: mode.port,
1227
+ http: {
1228
+ status: outcome.status,
1229
+ headers: outcome.headers,
1230
+ bodyText: outcome.bodyText.slice(0, MAX_HIT_BODY_BYTES)
1231
+ }
1232
+ });
1233
+ }
1234
+ }
1235
+ });
1236
+ }
1237
+ /** Why a family of modes failed, without taking the others down with it. */
1238
+ async function guarded(c, kind, work) {
1239
+ try {
1240
+ await work();
1241
+ } catch (err) {
1242
+ c.errors.push({
1243
+ mode: kind,
1244
+ message: err instanceof Error ? err.message : String(err)
1245
+ });
1246
+ }
1247
+ }
1248
+ async function runScan(deps, input) {
1249
+ const startedAt = Date.now();
1250
+ const subnets = resolveScanSubnets({
1251
+ interfaces: deps.interfaces(),
1252
+ saved: deps.savedSubnets(),
1253
+ perCall: input.subnets ?? []
1254
+ });
1255
+ const c = {
1256
+ hits: [],
1257
+ errors: [],
1258
+ stats: /* @__PURE__ */ new Map()
1259
+ };
1260
+ await Promise.all([
1261
+ guarded(c, "mdns", () => runMdns(deps, entriesOf(input.requests, "mdns"), subnets, c)),
1262
+ guarded(c, "ws-discovery", () => runWsDiscovery(deps, entriesOf(input.requests, "ws-discovery"), subnets, c)),
1263
+ guarded(c, "ssdp", () => runSsdp(deps, entriesOf(input.requests, "ssdp"), subnets, c)),
1264
+ guarded(c, "udp-broadcast", () => runUdpBroadcast(deps, entriesOf(input.requests, "udp-broadcast"), subnets, c)),
1265
+ guarded(c, "http-probe", () => runHttpSweep(deps, entriesOf(input.requests, "http-probe"), subnets, c))
1266
+ ]);
1267
+ const byMode = Object.fromEntries(c.stats);
1268
+ const stats = {
1269
+ hostsProbed: byMode["http-probe"] === void 0 ? 0 : subnets.hosts.length,
1270
+ hits: c.hits.length,
1271
+ timeouts: [...c.stats.values()].reduce((n, s) => n + s.timeouts, 0),
1272
+ byMode
1273
+ };
1274
+ deps.logger.info("local-network: scan finished", { meta: {
1275
+ providers: input.requests.length,
1276
+ subnets: subnets.all.map((s) => s.cidr),
1277
+ hostsProbed: stats.hostsProbed,
1278
+ hits: stats.hits,
1279
+ timeouts: stats.timeouts,
1280
+ errors: c.errors.length,
1281
+ byMode,
1282
+ hitsBySubnet: hitsBySubnet(subnets, c.hits),
1283
+ ms: Date.now() - startedAt
1284
+ } });
1285
+ return {
1286
+ hits: c.hits,
1287
+ subnetsScanned: subnets.all.map((s) => s.cidr),
1288
+ errors: c.errors,
1289
+ stats
1290
+ };
1291
+ }
1292
+ //#endregion
1293
+ //#region src/builtins/local-network/scan/scan-io-node.ts
1294
+ /** The real {@link ScanIo}: node `dgram`, `http` and `https`. Not unit-tested; the engine is. */
1295
+ function udpExchange(request) {
1296
+ return new Promise((resolve, reject) => {
1297
+ const socket = (0, node_dgram.createSocket)({
1298
+ type: "udp4",
1299
+ reuseAddr: true
1300
+ });
1301
+ const replies = [];
1302
+ let settled = false;
1303
+ const finish = (error) => {
1304
+ if (settled) return;
1305
+ settled = true;
1306
+ try {
1307
+ socket.close();
1308
+ } catch {}
1309
+ if (error !== null) reject(error);
1310
+ else resolve(replies);
1311
+ };
1312
+ socket.on("error", (err) => finish(err));
1313
+ socket.on("message", (data, rinfo) => {
1314
+ replies.push({
1315
+ host: rinfo.address,
1316
+ port: rinfo.port,
1317
+ data
1318
+ });
1319
+ });
1320
+ socket.bind(request.bindPort ?? 0, request.localAddress ?? void 0, () => {
1321
+ try {
1322
+ if (request.broadcast === true) socket.setBroadcast(true);
1323
+ if (request.localAddress !== void 0) socket.setMulticastInterface(request.localAddress);
1324
+ } catch (err) {
1325
+ finish(err instanceof Error ? err : new Error(String(err)));
1326
+ return;
1327
+ }
1328
+ const burst = () => {
1329
+ if (settled) return;
1330
+ for (const target of request.targets) socket.send(request.payload, target.port, target.host, () => {});
1331
+ };
1332
+ burst();
1333
+ for (const offset of request.resendAtMs ?? []) setTimeout(burst, offset);
1334
+ setTimeout(() => finish(null), request.listenMs);
1335
+ });
1336
+ });
1337
+ }
1338
+ function httpProbe(request) {
1339
+ return new Promise((resolve) => {
1340
+ const transport = request.tls ? node_https : node_http;
1341
+ let settled = false;
1342
+ const done = (outcome) => {
1343
+ if (settled) return;
1344
+ settled = true;
1345
+ resolve(outcome);
1346
+ };
1347
+ const body = request.bodyText;
1348
+ const req = transport.request({
1349
+ host: request.host,
1350
+ port: request.port,
1351
+ path: request.path,
1352
+ method: request.method,
1353
+ timeout: request.timeoutMs,
1354
+ ...request.tls ? { rejectUnauthorized: false } : {},
1355
+ headers: {
1356
+ ...request.contentType !== void 0 ? { "content-type": request.contentType } : {},
1357
+ ...body !== void 0 ? { "content-length": Buffer.byteLength(body) } : {}
1358
+ }
1359
+ }, (res) => {
1360
+ const chunks = [];
1361
+ let size = 0;
1362
+ const finish = () => {
1363
+ const headers = {};
1364
+ for (const [k, v] of Object.entries(res.headers)) if (typeof v === "string") headers[k.toLowerCase()] = v;
1365
+ else if (Array.isArray(v)) headers[k.toLowerCase()] = v.join(", ");
1366
+ done({
1367
+ kind: "response",
1368
+ status: res.statusCode ?? 0,
1369
+ headers,
1370
+ bodyText: Buffer.concat(chunks).toString("utf8")
1371
+ });
1372
+ };
1373
+ res.on("data", (chunk) => {
1374
+ chunks.push(chunk.subarray(0, MAX_HIT_BODY_BYTES - size));
1375
+ size += chunk.length;
1376
+ if (size >= 16384) {
1377
+ finish();
1378
+ req.destroy();
1379
+ }
1380
+ });
1381
+ res.on("end", finish);
1382
+ res.on("error", () => done({ kind: "unreachable" }));
1383
+ });
1384
+ req.on("timeout", () => {
1385
+ done({ kind: "timeout" });
1386
+ req.destroy();
1387
+ });
1388
+ req.on("error", () => done({ kind: "unreachable" }));
1389
+ if (body !== void 0) req.write(body);
1390
+ req.end();
1391
+ });
1392
+ }
1393
+ var nodeScanIo = {
1394
+ udpExchange,
1395
+ httpProbe
1396
+ };
1397
+ //#endregion
1398
+ //#region src/builtins/local-network/local-network.addon.ts
1399
+ /**
1400
+ * local-network — hub-only system cap implementation.
1401
+ *
1402
+ * Wraps `os.networkInterfaces()` with:
1403
+ * - Coarse kind classification (lan/wifi/docker/vpn/loopback/other)
1404
+ * - Auto-select heuristic for the outbound interface
1405
+ * - Periodic poll (30s) + diff to emit `LocalNetworkChanged` events
1406
+ * so subscribers can react to DHCP renewals, VPN connect, etc.
1407
+ * - `getConnectionEndpoints()` — ranked URL list for SDK clients
1408
+ *
1409
+ * Does NOT poll the cloudflare-tunnel state directly; the public
1410
+ * tunnel hostname (if any) is provided by `network-access` consumers
1411
+ * via `NetworkTunnelStarted/Stopped` events on the bus, so the cap
1412
+ * stays free of cross-addon dependencies.
1413
+ */
1414
+ /**
1415
+ * Forked `mesh-network` provider addon ids `local-network` pull-reconciles
1416
+ * against. `mesh-network` is a COLLECTION cap, so a hub builtin's local
1417
+ * registry can't enumerate forked providers — we resolve each by addonId
1418
+ * via `getProviderByAddon`. New mesh providers (Headscale, ZeroTier) add
1419
+ * their id here.
1420
+ */
1421
+ var MESH_PROVIDER_ADDON_IDS = ["tailscale-client"];
1422
+ var POLL_INTERVAL_MS = 3e4;
1423
+ /** Drop rotated IPv6 / dead extras from the persisted allowlist. */
1424
+ var ALLOWLIST_RECONCILE_INTERVAL_MS = 3600 * 1e3;
1425
+ /**
1426
+ * Compiled-in boot default — mirrors `CONFIG_DEFAULTS.server.port` in
1427
+ * `server/backend/src/boot/boot-config.ts`. Used only when neither the live
1428
+ * config section, the env, nor the caller says anything.
1429
+ */
1430
+ var DEFAULT_HUB_PORT = 4443;
1431
+ var LocalNetworkAddon = class extends require_dist.BaseAddon {
1432
+ pollTimer = null;
1433
+ allowlistTimer = null;
1434
+ allowlistReconcilePending = false;
1435
+ lastSnapshotKey = "";
1436
+ /** Optional public hostname tracked from `NetworkTunnelStarted`/
1437
+ * `Stopped` events on the bus. */
1438
+ publicHostname = "";
1439
+ /** False for a Quick tunnel: shown in the palette, never picked automatically (D860). */
1440
+ publicHostnameStable = true;
1441
+ /**
1442
+ * Mesh-reachable endpoint (Tailscale MagicDNS / 100.x), learned from
1443
+ * the `MeshNetworkChanged` event-tail and refreshed by a pull-reconcile
1444
+ * before each `getConnectionEndpoints` build (events are lossy — D8).
1445
+ * `null` when no mesh provider is joined.
1446
+ */
1447
+ meshEndpoint = null;
1448
+ mdns = null;
1449
+ constructor() {
1450
+ super({
1451
+ allowedAddresses: [],
1452
+ bootSeeded: false,
1453
+ notificationTapUrl: "",
1454
+ appConnectionUrls: [],
1455
+ customAddresses: [],
1456
+ httpEnabled: true,
1457
+ httpPort: require_hub_mdns_ciao.DEFAULT_LAN_HTTP_PORT,
1458
+ tlsEnabled: true,
1459
+ localHostname: "",
1460
+ internalUrl: "",
1461
+ publicEndpointUrl: "",
1462
+ mdnsAdvertise: true,
1463
+ scanSubnets: []
1464
+ });
1465
+ }
1466
+ /**
1467
+ * The detected palettes, with the mesh reconciled once: `https` (what
1468
+ * `internal` and `publicEndpoint` resolve over, and the app link's `hub=`)
1469
+ * and `http` (what the app-connections race resolves over).
1470
+ */
1471
+ async palettes() {
1472
+ const port = (await this.resolveAdvertisedListenPort(null)).port;
1473
+ await this.reconcileMeshEndpoint();
1474
+ const http = this.endpointsNow(false, false, "http", port);
1475
+ const https = this.endpointsNow(false, false, "https", port);
1476
+ return {
1477
+ http,
1478
+ https,
1479
+ httpWithTwins: withLanHttpsCounterparts(http, port),
1480
+ httpsWithTwins: withLanHttpsCounterparts(https, port)
1481
+ };
1482
+ }
1483
+ /** The stored address book, normalised against what is detected now. */
1484
+ addressState(detected) {
1485
+ return normalizeAddressBook(this.config, new Set(detected.map((e) => e.baseUrl)));
1486
+ }
1487
+ /** The role flags alone — they do not depend on what is detected. */
1488
+ storedFlags() {
1489
+ return normalizeAddressBook(this.config, /* @__PURE__ */ new Set()).flags;
1490
+ }
1491
+ /** `getAddresses`: the Addresses table and every role's answer. */
1492
+ async addressBook(scheme) {
1493
+ const { http, https, httpWithTwins, httpsWithTwins } = await this.palettes();
1494
+ const state = this.addressState([...httpWithTwins, ...httpsWithTwins]);
1495
+ const httpsPort = (await this.resolveAdvertisedListenPort(null)).port;
1496
+ return buildAddressBook(state, {
1497
+ rowsPalette: scheme === "http" ? httpWithTwins : httpsWithTwins,
1498
+ httpsPalette: https,
1499
+ appLink: appLinkEndpoint(),
1500
+ appLinkHub: require_dist.pickAppLinkHub(https),
1501
+ listenerOrigins: this.listenerOriginsNow(state, http, httpsPort)
1502
+ });
1503
+ }
1504
+ /**
1505
+ * Apply one change to the address book and persist it, normalised (a flag
1506
+ * naming an address in no row becomes a custom address in the same write).
1507
+ */
1508
+ async changeAddressBook(change) {
1509
+ const { httpWithTwins, httpsWithTwins } = await this.palettes();
1510
+ const detected = [...httpWithTwins, ...httpsWithTwins];
1511
+ const detectedUrls = new Set(detected.map((e) => e.baseUrl));
1512
+ const changed = change(this.addressState(detected), {
1513
+ detectedUrls,
1514
+ autoApp: [...new Set(detected.filter(require_dist.isDefaultAppConnectionEndpoint).map((e) => e.baseUrl))]
1515
+ });
1516
+ const after = normalizeAddressBook({
1517
+ ...addressBookPatch(changed),
1518
+ customAddresses: changed.custom
1519
+ }, detectedUrls);
1520
+ await this.updateGlobalSettings(addressBookPatch(after));
1521
+ await this.mdns?.sync();
1522
+ }
1523
+ /** The deprecated `getHubAddresses` shape, from the role resolvers. */
1524
+ async snapshotHubAddresses() {
1525
+ const { roles } = await this.addressBook("https");
1526
+ const legacy = (r) => ({
1527
+ override: r.flagged,
1528
+ resolved: r.resolved,
1529
+ source: r.source === "flagged" ? "override" : r.source
1530
+ });
1531
+ return {
1532
+ cluster: legacy(roles.internal),
1533
+ browser: legacy(roles.publicEndpoint)
1534
+ };
1535
+ }
1536
+ /**
1537
+ * Flag / unflag `baseUrl` for `role`, or (`baseUrl: null`) return the role
1538
+ * to automatic. Validated: the address must be a row (detected, custom, or
1539
+ * the app link for `notificationTaps`), never loopback, and
1540
+ * `publicEndpoint` on plain http only when accepted. A refusal stores nothing.
1541
+ */
1542
+ async setRole(role, baseUrl, enabled, acceptInsecureHttp) {
1543
+ if (baseUrl === null || baseUrl.trim() === "" && role !== "appConnections") {
1544
+ await this.changeAddressBook((state) => withRoleAutomatic(state, role));
1545
+ this.ctx.logger.info("local-network: address role set to automatic", { meta: { role } });
1546
+ return;
1547
+ }
1548
+ let target = baseUrl.trim();
1549
+ if (enabled) {
1550
+ const check = require_dist.checkRoleAddress(role, target, { acceptInsecureHttp });
1551
+ if (!check.ok) throw new Error(check.reason);
1552
+ target = check.baseUrl;
1553
+ }
1554
+ await this.changeAddressBook((state, ctx) => {
1555
+ const known = require_dist.isAppLinkBase(target) || ctx.detectedUrls.has(target) || state.custom.some((c) => c.baseUrl === target);
1556
+ if (enabled && !known && role !== "notificationTaps") throw new Error(`${target} is not in the address list — add it as a custom address first.`);
1557
+ return withRoleFlag(state, role, target, enabled, ctx.autoApp);
1558
+ });
1559
+ this.ctx.logger.info("local-network: address role set", { meta: {
1560
+ role,
1561
+ baseUrl: target,
1562
+ enabled
1563
+ } });
1564
+ }
1565
+ async notificationEndpointSnapshot() {
1566
+ const resolution = require_dist.resolveNotificationTapAddress(this.storedFlags());
1567
+ const port = (await this.resolveAdvertisedListenPort(null)).port;
1568
+ return {
1569
+ baseUrl: resolution.flagged,
1570
+ resolved: resolution.resolved,
1571
+ appLinkHub: require_dist.pickAppLinkHub(await this.buildAdvertisedEndpoints(false, false, "https", port))
1572
+ };
1573
+ }
1574
+ async snapshotViewerEndpoints() {
1575
+ const resolution = require_dist.resolveAppConnections(await this.buildAdvertisedEndpoints(false, false, "http", (await this.resolveAdvertisedListenPort(null)).port), this.storedFlags());
1576
+ return {
1577
+ baseUrls: resolution.flagged,
1578
+ resolved: resolution.resolved
1579
+ };
1580
+ }
1581
+ /**
1582
+ * Palette shown to clients: LAN IPv4, stable LAN IPv6, public, mesh, and
1583
+ * the custom addresses flagged `appConnections` (`kind: 'custom'`). The app
1584
+ * HTTP/WS race is a subset (`selectAppConnectionEndpoints`) — IPv6 stays in this
1585
+ * list because ICE/WebRTC gathers it regardless.
1586
+ */
1587
+ async buildAdvertisedEndpoints(includeLoopback, ipv4Only, scheme, httpsPort) {
1588
+ await this.reconcileMeshEndpoint();
1589
+ const detected = withLanHttpsCounterparts(this.endpointsNow(includeLoopback, ipv4Only, scheme, httpsPort), httpsPort);
1590
+ return withAppConnectionCustomEndpoints(detected, this.addressState(detected));
1591
+ }
1592
+ /**
1593
+ * Where the listeners answer, whatever the rows advertise: the HTTPS
1594
+ * listener's origin per allowlisted LAN address, the HTTP one while it is
1595
+ * on (`http` is the palette that already carries those rows).
1596
+ */
1597
+ listenerOriginsNow(state, http, httpsPort) {
1598
+ const httpListening = this.config.httpEnabled !== false && require_hub_mdns_ciao.readLanHttpState().listening;
1599
+ const hostname = this.config.localHostname || null;
1600
+ const localNameOrigins = hostname === null ? [] : [`https://${hostname}:${httpsPort}`, ...httpListening ? [`http://${hostname}:${this.resolvedHttpPort()}`] : []];
1601
+ return buildListenerOrigins({
1602
+ overHttps: this.endpointsNow(false, false, "https", httpsPort, false),
1603
+ overHttp: httpListening ? http : [],
1604
+ custom: state.custom,
1605
+ localNameOrigins
1606
+ });
1607
+ }
1608
+ /** The DETECTED palette from the cached interface/tunnel/mesh state. */
1609
+ endpointsNow(includeLoopback, ipv4Only, scheme, httpsPort, advertiseLanHttp = true) {
1610
+ const interfaces = applyAllowlist(this.enumerate(), this.config.allowedAddresses);
1611
+ const httpState = require_hub_mdns_ciao.readLanHttpState();
1612
+ return buildEndpoints(interfaces, httpsPort, includeLoopback, ipv4Only, this.publicHostname, scheme, this.meshEndpoint, advertiseLanHttp ? {
1613
+ enabled: this.config.httpEnabled !== false,
1614
+ listening: httpState.listening,
1615
+ httpPort: this.resolvedHttpPort(),
1616
+ httpsPort,
1617
+ localHostname: this.config.localHostname || null
1618
+ } : null, this.publicHostnameStable);
1619
+ }
1620
+ async onInitialize() {
1621
+ if (!this.config.bootSeeded) {
1622
+ const seed = autoSeedAllowlist(this.enumerate());
1623
+ await this.updateGlobalSettings({
1624
+ allowedAddresses: seed,
1625
+ bootSeeded: true
1626
+ });
1627
+ this.ctx.logger.info("local-network: first-boot auto-seed", { meta: { addresses: seed } });
1628
+ }
1629
+ await this.persistReconciledAllowlist();
1630
+ const provider = {
1631
+ list: async () => ({
1632
+ interfaces: this.enumerate(),
1633
+ probedAt: Date.now()
1634
+ }),
1635
+ getPreferred: async () => pickPreferred(applyAllowlist(this.enumerate(), this.config.allowedAddresses)),
1636
+ getConnectionEndpoints: async (input) => {
1637
+ const includeLoopback = input.includeLoopback ?? false;
1638
+ const scheme = input.scheme ?? "http";
1639
+ const localPort = await this.resolveAdvertisedListenPort(input.port ?? null);
1640
+ if (input.port !== void 0 && input.port !== localPort.port) this.ctx.logger.info("local-network: caller port hint overridden", { meta: {
1641
+ hint: input.port,
1642
+ advertised: localPort.port,
1643
+ source: localPort.source
1644
+ } });
1645
+ const endpoints = await this.buildAdvertisedEndpoints(includeLoopback, input.ipv4Only ?? false, scheme, localPort.port);
1646
+ return {
1647
+ endpoints: input.includeAppLink === true ? [appLinkEndpoint(), ...endpoints] : endpoints,
1648
+ localPort
1649
+ };
1650
+ },
1651
+ getNotificationEndpoint: async () => this.notificationEndpointSnapshot(),
1652
+ setNotificationEndpoint: async ({ baseUrl }) => {
1653
+ await this.setRole("notificationTaps", baseUrl, true, false);
1654
+ return this.notificationEndpointSnapshot();
1655
+ },
1656
+ getViewerEndpoints: async () => this.snapshotViewerEndpoints(),
1657
+ setViewerEndpoints: async ({ baseUrls }) => {
1658
+ const appConnections = [...new Set(baseUrls.filter((u) => u.length > 0))];
1659
+ await this.changeAddressBook((state) => ({
1660
+ ...state,
1661
+ flags: {
1662
+ ...state.flags,
1663
+ appConnections
1664
+ }
1665
+ }));
1666
+ this.ctx.logger.info("local-network: app connections set", { meta: {
1667
+ count: appConnections.length,
1668
+ auto: appConnections.length === 0
1669
+ } });
1670
+ return this.snapshotViewerEndpoints();
1671
+ },
1672
+ getAddresses: async (input) => this.addressBook(input?.scheme ?? "https"),
1673
+ addCustomAddress: async ({ baseUrl, label }) => {
1674
+ const check = require_dist.validateCustomAddress(baseUrl);
1675
+ if (!check.ok) throw new Error(check.reason);
1676
+ const entry = {
1677
+ baseUrl: check.baseUrl,
1678
+ label: label.trim()
1679
+ };
1680
+ await this.changeAddressBook((state) => withCustomAddress(state, entry));
1681
+ this.ctx.logger.info("local-network: custom address added", { meta: {
1682
+ baseUrl: entry.baseUrl,
1683
+ label: entry.label
1684
+ } });
1685
+ return this.addressBook("https");
1686
+ },
1687
+ removeCustomAddress: async ({ baseUrl }) => {
1688
+ await this.changeAddressBook((state) => withoutCustomAddress(state, baseUrl));
1689
+ this.ctx.logger.info("local-network: custom address removed", { meta: { baseUrl } });
1690
+ return this.addressBook("https");
1691
+ },
1692
+ setAddressRole: async ({ role, baseUrl, enabled, acceptInsecureHttp }) => {
1693
+ await this.setRole(role, baseUrl, enabled, acceptInsecureHttp === true);
1694
+ return this.addressBook("https");
1695
+ },
1696
+ getHubAddresses: async () => this.snapshotHubAddresses(),
1697
+ getAllowedAddresses: async () => ({ addresses: this.config.allowedAddresses }),
1698
+ resetAllowlistToBestMatch: async () => {
1699
+ const seed = autoSeedAllowlist(this.enumerate());
1700
+ await this.updateGlobalSettings({
1701
+ allowedAddresses: seed,
1702
+ bootSeeded: true
1703
+ });
1704
+ this.ctx.logger.info("local-network: allowlist reset to auto-seed", { meta: { count: seed.length } });
1705
+ return { addresses: seed };
1706
+ },
1707
+ setAllowedAddresses: async ({ addresses }) => {
1708
+ const known = new Set(this.enumerate().map((i) => i.address));
1709
+ const cleaned = [...new Set(addresses)].filter((a) => known.has(a));
1710
+ await this.updateGlobalSettings({ allowedAddresses: cleaned });
1711
+ this.ctx.logger.info("local-network: allowlist updated", { meta: {
1712
+ count: cleaned.length,
1713
+ dropped: addresses.length - cleaned.length
1714
+ } });
1715
+ return { success: true };
1716
+ },
1717
+ scanNetwork: async (input) => runScan({
1718
+ io: nodeScanIo,
1719
+ interfaces: () => this.enumerate(),
1720
+ savedSubnets: () => this.config.scanSubnets,
1721
+ logger: this.ctx.logger
1722
+ }, input),
1723
+ getScanSubnets: async () => ({ subnets: [...this.config.scanSubnets] }),
1724
+ setScanSubnets: async ({ subnets }) => {
1725
+ const cleaned = [...validateSavedSubnets(subnets)];
1726
+ await this.updateGlobalSettings({ scanSubnets: cleaned });
1727
+ this.ctx.logger.info("local-network: scan subnets updated", { meta: {
1728
+ count: cleaned.length,
1729
+ subnets: cleaned
1730
+ } });
1731
+ return { subnets: cleaned };
1732
+ },
1733
+ getTlsStatus: async () => this.snapshotTls(),
1734
+ regenerateCertificate: async (_input) => {
1735
+ const extraSans = [...require_hub_mdns_ciao.readExtraSans(this.tlsDataDir())];
1736
+ await require_hub_mdns_ciao.regenerateCertificate(this.tlsDataDir(), {
1737
+ extraSans,
1738
+ ...await this.caHubName()
1739
+ });
1740
+ this.putCertificateOnListener("regenerate");
1741
+ return this.snapshotTls();
1742
+ },
1743
+ uploadCertificate: async ({ certPem, keyPem, caPem }) => {
1744
+ await require_hub_mdns_ciao.storeUploadedCertificate(this.tlsDataDir(), {
1745
+ certPem,
1746
+ keyPem,
1747
+ caPem
1748
+ });
1749
+ this.putCertificateOnListener("upload");
1750
+ return this.snapshotTls();
1751
+ },
1752
+ useStoredUploadedCertificate: async () => {
1753
+ await require_hub_mdns_ciao.useStoredUploadedCertificate(this.tlsDataDir());
1754
+ this.putCertificateOnListener("upload");
1755
+ return this.snapshotTls();
1756
+ },
1757
+ downloadCa: async () => {
1758
+ return { pem: this.snapshotTls().caCertPem ?? "" };
1759
+ },
1760
+ revertToGeneratedCertificate: async () => {
1761
+ const extraSans = [...require_hub_mdns_ciao.readExtraSans(this.tlsDataDir())];
1762
+ await require_hub_mdns_ciao.revertToGeneratedCertificate(this.tlsDataDir(), {
1763
+ extraSans,
1764
+ ...await this.caHubName()
1765
+ });
1766
+ this.putCertificateOnListener("revert");
1767
+ return this.snapshotTls();
1768
+ }
1769
+ };
1770
+ this.lastSnapshotKey = snapshotKey(this.enumerate());
1771
+ this.pollTimer = setInterval(() => this.detectChanges(), POLL_INTERVAL_MS);
1772
+ this.pollTimer.unref?.();
1773
+ this.allowlistTimer = setInterval(() => {
1774
+ this.persistReconciledAllowlist();
1775
+ }, ALLOWLIST_RECONCILE_INTERVAL_MS);
1776
+ this.allowlistTimer.unref?.();
1777
+ this.ctx.eventBus?.subscribe({ category: require_dist.EventCategory.NetworkTunnelStarted }, (event) => {
1778
+ const parsed = require_dist.NetworkTunnelStartedDataSchema.safeParse(event.data ?? {});
1779
+ if (parsed.success) {
1780
+ const data = parsed.data;
1781
+ try {
1782
+ const hostname = new URL(data.url).hostname;
1783
+ if (hostname && !hostname.endsWith(".placeholder") && !hostname.startsWith("pending.")) this.setPublicHostname(hostname, data.stable !== false);
1784
+ } catch {}
1785
+ }
1786
+ });
1787
+ this.ctx.eventBus?.subscribe({ category: require_dist.EventCategory.NetworkTunnelStopped }, () => this.setPublicHostname(""));
1788
+ this.ctx.eventBus?.subscribe({ category: require_dist.EventCategory.MeshNetworkChanged }, (event) => {
1789
+ const data = event.data ?? {};
1790
+ const host = typeof data.host === "string" ? data.host : "";
1791
+ const port = typeof data.port === "number" ? data.port : 0;
1792
+ this.setMeshEndpoint(host && port > 0 ? {
1793
+ host,
1794
+ port
1795
+ } : null);
1796
+ });
1797
+ this.ctx.logger.info("local-network initialized", { meta: { interfaceCount: this.enumerate().length } });
1798
+ try {
1799
+ await this.applyLanAccessFromSettings();
1800
+ } catch (err) {
1801
+ this.ctx.logger.warn("local-network: LAN HTTP not applied at boot", { meta: { error: err instanceof Error ? err.message : String(err) } });
1802
+ }
1803
+ await this.applyMdnsAdvertisement();
1804
+ return [{
1805
+ capability: require_dist.localNetworkCapability,
1806
+ provider
1807
+ }];
1808
+ }
1809
+ globalSettingsSchema() {
1810
+ return this.schema({ sections: [{
1811
+ id: "local-access",
1812
+ title: "LAN HTTP",
1813
+ titleKey: "server:globalSettings.s_local-access.title",
1814
+ description: "Native apps on this Wi-Fi use http:// and skip the private certificate. The tunnel and this admin UI stay on HTTPS. Turn off once a publicly-trusted certificate covers the LAN name.",
1815
+ descriptionKey: "server:globalSettings.s_local-access.description",
1816
+ columns: 1,
1817
+ fields: [
1818
+ this.field({
1819
+ type: "boolean",
1820
+ key: "httpEnabled",
1821
+ label: "Enable HTTP on the LAN",
1822
+ labelKey: "server:globalSettings.s_local-access.httpEnabled.label",
1823
+ style: "switch",
1824
+ default: true
1825
+ }),
1826
+ this.field({
1827
+ type: "number",
1828
+ key: "httpPort",
1829
+ label: "HTTP port",
1830
+ labelKey: "server:globalSettings.s_local-access.httpPort.label",
1831
+ description: "Dedicated listener. Must not equal the HTTPS port (4443 by default).",
1832
+ descriptionKey: "server:globalSettings.s_local-access.httpPort.description",
1833
+ min: 1,
1834
+ max: 65535,
1835
+ step: 1,
1836
+ default: require_hub_mdns_ciao.DEFAULT_LAN_HTTP_PORT,
1837
+ showWhen: {
1838
+ field: "httpEnabled",
1839
+ equals: true
1840
+ }
1841
+ }),
1842
+ this.field({
1843
+ type: "boolean",
1844
+ key: "tlsEnabled",
1845
+ label: "Serve HTTPS",
1846
+ labelKey: "server:globalSettings.s_local-access.tlsEnabled.label",
1847
+ description: "On by default. Turn off only behind a reverse proxy that terminates TLS for you: browsers refuse passkeys, the camera and the microphone over plain HTTP. Applies after the hub restarts.",
1848
+ descriptionKey: "server:globalSettings.s_local-access.tlsEnabled.description",
1849
+ style: "switch",
1850
+ default: true
1851
+ }),
1852
+ this.field({
1853
+ type: "boolean",
1854
+ key: "mdnsAdvertise",
1855
+ label: "Announce this hub on the LAN (mDNS)",
1856
+ labelKey: "server:globalSettings.s_local-access.mdnsAdvertise.label",
1857
+ 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).",
1858
+ descriptionKey: "server:globalSettings.s_local-access.mdnsAdvertise.description",
1859
+ style: "switch",
1860
+ default: true
1861
+ }),
1862
+ this.field({
1863
+ type: "text",
1864
+ key: "localHostname",
1865
+ label: "Local hostname",
1866
+ labelKey: "server:globalSettings.s_local-access.localHostname.label",
1867
+ 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.",
1868
+ descriptionKey: "server:globalSettings.s_local-access.localHostname.description",
1869
+ maxLength: 253,
1870
+ placeholder: "camstack.lan"
1871
+ })
1872
+ ]
1873
+ }] });
1874
+ }
1875
+ async onConfigChanged() {
1876
+ await this.applyLanAccessFromSettings();
1877
+ await this.applyMdnsAdvertisement();
1878
+ }
1879
+ /**
1880
+ * Start, re-announce or stop the hub's mDNS service (D838). Never throws:
1881
+ * the advertiser logs its own failures and boot goes on.
1882
+ */
1883
+ async applyMdnsAdvertisement() {
1884
+ if (this.config.mdnsAdvertise === false) {
1885
+ await this.mdns?.stop();
1886
+ return;
1887
+ }
1888
+ if (this.mdns === null) this.mdns = new HubMdnsAdvertiser({
1889
+ publisher: require_hub_mdns_ciao.createCiaoPublisher(),
1890
+ logger: this.ctx.logger,
1891
+ nodeId: this.ctx.kernel.localNodeId ?? "hub",
1892
+ version: null,
1893
+ readInternalUrl: async () => internalUrlOf(await this.addressBook("https"))
1894
+ });
1895
+ await this.mdns.start();
1896
+ }
1897
+ async onShutdown() {
1898
+ await this.mdns?.stop();
1899
+ this.mdns = null;
1900
+ if (this.pollTimer) {
1901
+ clearInterval(this.pollTimer);
1902
+ this.pollTimer = null;
1903
+ }
1904
+ if (this.allowlistTimer) {
1905
+ clearInterval(this.allowlistTimer);
1906
+ this.allowlistTimer = null;
1907
+ }
1908
+ }
1909
+ /**
1910
+ * Other hub addons (e.g. cloudflare-tunnel) signal the active public
1911
+ * FQDN by emitting `NetworkTunnelStarted` on the bus — handled in
1912
+ * `onInitialize`. This setter exists for tests + future direct
1913
+ * callers; cleared by passing an empty string.
1914
+ */
1915
+ setPublicHostname(hostname, stable = true) {
1916
+ if (this.publicHostname === hostname && this.publicHostnameStable === stable) return;
1917
+ this.publicHostname = hostname;
1918
+ this.publicHostnameStable = stable;
1919
+ this.ctx.logger.info("local-network: public hostname updated", { meta: {
1920
+ hostname: hostname || "(cleared)",
1921
+ stable
1922
+ } });
1923
+ }
1924
+ /**
1925
+ * Replace the cached mesh endpoint. Set from the `MeshNetworkChanged`
1926
+ * event-tail + the pull-reconcile; exposed for tests + future direct
1927
+ * callers. Pass `null` to clear (mesh left / no provider joined).
1928
+ */
1929
+ setMeshEndpoint(endpoint) {
1930
+ const prev = this.meshEndpoint;
1931
+ if (prev?.host === endpoint?.host && prev?.port === endpoint?.port) return;
1932
+ this.meshEndpoint = endpoint;
1933
+ this.ctx.logger.info("local-network: mesh endpoint updated", { meta: {
1934
+ host: endpoint?.host || "(cleared)",
1935
+ port: endpoint?.port ?? 0
1936
+ } });
1937
+ }
1938
+ /**
1939
+ * Refresh the cached mesh endpoint from the authoritative forked
1940
+ * `mesh-network` provider(s). `mesh-network` is a COLLECTION cap on a
1941
+ * forked addon, so the hub builtin can't see it via `ctx.api` /
1942
+ * `getCollectionEntries` — we resolve each provider by addonId through
1943
+ * the hub-side `capabilityRegistry.getProviderByAddon` resolver (the
1944
+ * same mechanism `device-manager` uses for cross-process exporter
1945
+ * contributions). Best-effort: a provider that's absent / errors /
1946
+ * not joined simply contributes nothing.
1947
+ */
1948
+ async reconcileMeshEndpoint() {
1949
+ const registry = this.ctx.kernel.capabilityRegistry;
1950
+ if (!registry) return;
1951
+ for (const addonId of MESH_PROVIDER_ADDON_IDS) {
1952
+ const provider = registry.getProviderByAddon("mesh-network", addonId);
1953
+ if (!provider) continue;
1954
+ try {
1955
+ const status = await provider.getStatus();
1956
+ if (!status.joined) {
1957
+ this.setMeshEndpoint(null);
1958
+ continue;
1959
+ }
1960
+ const host = status.magicDnsHostname || status.meshIp;
1961
+ const port = (status.endpoints.find((e) => e.id === "magicdns") ?? status.endpoints.find((e) => e.id === "mesh-ipv4"))?.port ?? 0;
1962
+ this.setMeshEndpoint(host && port > 0 ? {
1963
+ host,
1964
+ port
1965
+ } : null);
1966
+ return;
1967
+ } catch (err) {
1968
+ this.ctx.logger.debug("local-network: mesh reconcile skipped", { meta: {
1969
+ addonId,
1970
+ error: err instanceof Error ? err.message : String(err)
1971
+ } });
1972
+ }
1973
+ }
1974
+ }
1975
+ resolvedHttpPort() {
1976
+ const port = this.config.httpPort;
1977
+ return Number.isInteger(port) && port >= 1 && port <= 65535 ? port : require_hub_mdns_ciao.DEFAULT_LAN_HTTP_PORT;
1978
+ }
1979
+ tlsDataDir() {
1980
+ return this.ctx.nodeDataDir ?? this.ctx.dataDir;
1981
+ }
1982
+ /**
1983
+ * The hub's name (D861) for a local root this action may CREATE (an existing root is
1984
+ * never renamed). Hub only: on an agent the hub's name would mislabel the agent's own
1985
+ * material, so it gets the plain name. A failed read falls back to the machine
1986
+ * hostname (what the hub shows when unnamed) and says so: a certificate action must
1987
+ * not fail over a label.
1988
+ */
1989
+ async caHubName() {
1990
+ if ((this.ctx.kernel.localNodeId ?? "hub") !== "hub") return {};
1991
+ try {
1992
+ return { hubName: (await this.ctx.api.system.info.query()).serverName.name };
1993
+ } catch (err) {
1994
+ this.ctx.logger.warn("local-network: server name unreadable - naming the CA after the hostname", { meta: { error: require_dist.errMsg(err) } });
1995
+ return { hubName: require_dist.shortHostname(node_os.hostname()) };
1996
+ }
1997
+ }
1998
+ snapshotTls() {
1999
+ const status = require_hub_mdns_ciao.readTlsAccessStatus(this.tlsDataDir(), require_hub_mdns_ciao.servedHttpsLeafFingerprint());
2000
+ return {
2001
+ ...status,
2002
+ sans: [...status.sans]
2003
+ };
2004
+ }
2005
+ /**
2006
+ * Hot-swap the HTTPS listener onto the pair now on disk. A failure is not
2007
+ * thrown — the files are already written and the status reports
2008
+ * `restartRequired` from the served-vs-disk fingerprints — but it is logged:
2009
+ * a certificate change that did not reach the listener must say so.
2010
+ */
2011
+ putCertificateOnListener(action) {
2012
+ const outcome = require_hub_mdns_ciao.applyCertificateToListener(this.tlsDataDir());
2013
+ if (outcome.kind === "reloaded") {
2014
+ this.ctx.logger.info("local-network: HTTPS listener now serves the new certificate", { meta: {
2015
+ action,
2016
+ leafFingerprintSha256: outcome.servedLeafFingerprint
2017
+ } });
2018
+ return;
2019
+ }
2020
+ this.ctx.logger.warn("local-network: certificate changed on disk but NOT on the listener", { meta: {
2021
+ action,
2022
+ reason: outcome.kind,
2023
+ ...outcome.kind === "failed" ? { error: outcome.error } : {}
2024
+ } });
2025
+ }
2026
+ /**
2027
+ * Bind or unbind the LAN HTTP sibling from the addon's own settings, and
2028
+ * keep the leaf SAN in sync with `localHostname`. This is the settings
2029
+ * side-effect path — there is no second persist API.
2030
+ */
2031
+ async applyLanAccessFromSettings() {
2032
+ const parsed = parseLocalHostname(this.config.localHostname ?? "");
2033
+ if (!parsed.ok) throw new Error(parsed.error);
2034
+ const hostname = parsed.value ?? "";
2035
+ const httpsPort = (await this.resolveAdvertisedListenPort(null)).port;
2036
+ const httpPort = this.resolvedHttpPort();
2037
+ if (this.config.httpEnabled !== false && httpPort === httpsPort) throw new Error(`HTTP port ${httpPort} cannot equal the HTTPS listen port`);
2038
+ require_hub_mdns_ciao.writeTlsEnabled(this.tlsDataDir(), this.config.tlsEnabled !== false);
2039
+ await require_hub_mdns_ciao.applyLanHttp({
2040
+ enabled: this.config.httpEnabled !== false,
2041
+ port: httpPort,
2042
+ host: "0.0.0.0"
2043
+ });
2044
+ if (hostname !== "") {
2045
+ require_hub_mdns_ciao.writeExtraSans(this.tlsDataDir(), [hostname]);
2046
+ if (require_hub_mdns_ciao.readTlsMode(this.tlsDataDir()) === "generated") {
2047
+ if ((await require_hub_mdns_ciao.ensureTlsCert(this.tlsDataDir(), {
2048
+ extraSans: [hostname],
2049
+ hubName: require_dist.shortHostname(node_os.hostname())
2050
+ })).generated) this.putCertificateOnListener("hostname");
2051
+ }
2052
+ } else require_hub_mdns_ciao.writeExtraSans(this.tlsDataDir(), []);
2053
+ }
2054
+ /**
2055
+ * The port this hub is actually listening on, plus the provenance of the
2056
+ * number. The boot loader merges the `CAMSTACK_PORT` env override into the
2057
+ * persisted `server` section (`server/backend/src/boot/boot-config.ts`), so
2058
+ * reading that section gives the authoritative live port — no new setting,
2059
+ * and the same source `tailscale-client` already stamps its mesh endpoints
2060
+ * from, so the two cannot drift.
2061
+ */
2062
+ async resolveAdvertisedListenPort(callerHint) {
2063
+ const envRaw = Number.parseInt(process.env["CAMSTACK_PORT"] ?? "", 10);
2064
+ return resolveAdvertisedPort({
2065
+ configured: await this.readConfiguredPort(),
2066
+ env: Number.isNaN(envRaw) ? null : envRaw,
2067
+ callerHint
2068
+ });
2069
+ }
2070
+ /** `server.port` from the live config section, or null when unreadable. */
2071
+ async readConfiguredPort() {
2072
+ const settings = this.ctx.settings;
2073
+ if (!settings) return null;
2074
+ try {
2075
+ const raw = (await settings.getSection("server"))["port"];
2076
+ if (typeof raw === "number") return raw;
2077
+ if (typeof raw === "string") {
2078
+ const parsed = Number.parseInt(raw, 10);
2079
+ return Number.isNaN(parsed) ? null : parsed;
2080
+ }
2081
+ return null;
2082
+ } catch (err) {
2083
+ this.ctx.logger.warn("local-network: could not read server.port", { meta: { error: err instanceof Error ? err.message : String(err) } });
2084
+ return null;
2085
+ }
2086
+ }
2087
+ enumerate() {
2088
+ return enumerateOsInterfaces(node_os.networkInterfaces(), readLinuxIpv6Flags());
2089
+ }
2090
+ /**
2091
+ * Replace rotated IPv6 and drop addresses that no longer exist, without
2092
+ * clearing operator extras that are still live (docker/vpn opt-in).
2093
+ */
2094
+ async persistReconciledAllowlist(interfaces = this.enumerate()) {
2095
+ if (this.allowlistReconcilePending) return;
2096
+ this.allowlistReconcilePending = true;
2097
+ try {
2098
+ const next = reconcileAllowlist(this.config.allowedAddresses, interfaces);
2099
+ if (sameAddressSet(this.config.allowedAddresses, next)) return;
2100
+ await this.updateGlobalSettings({
2101
+ allowedAddresses: next,
2102
+ bootSeeded: true
2103
+ });
2104
+ this.ctx.logger.info("local-network: allowlist reconciled", { meta: { addresses: next } });
2105
+ } finally {
2106
+ this.allowlistReconcilePending = false;
2107
+ }
2108
+ }
2109
+ detectChanges() {
2110
+ const interfaces = this.enumerate();
2111
+ const key = snapshotKey(interfaces);
2112
+ if (key === this.lastSnapshotKey) return;
2113
+ this.ctx.logger.info("local-network: interface set changed", { meta: {
2114
+ count: interfaces.length,
2115
+ key
2116
+ } });
2117
+ this.lastSnapshotKey = key;
2118
+ this.persistReconciledAllowlist(interfaces);
2119
+ this.mdns?.sync();
2120
+ this.ctx.eventBus?.emit({
2121
+ id: `local-network-changed-${Date.now()}`,
2122
+ timestamp: /* @__PURE__ */ new Date(),
2123
+ source: {
2124
+ type: "core",
2125
+ id: "local-network"
2126
+ },
2127
+ category: require_dist.EventCategory.LocalNetworkChanged,
2128
+ data: { count: interfaces.length }
2129
+ });
2130
+ }
2131
+ };
2132
+ /**
2133
+ * Pick the port to advertise, and say where it came from.
2134
+ *
2135
+ * The caller's hint ranks BELOW everything the hub knows about itself and above
2136
+ * nothing but the compiled default — it is kept only so a client written
2137
+ * against the old echoing contract behaves exactly as it did before, and it is
2138
+ * labelled `caller-hint` so that client's successor can refuse to trust it.
2139
+ * Values outside the valid port range are dropped rather than advertised: a
2140
+ * malformed `server.port` must fall through to the next source, not produce a
2141
+ * URL nothing can bind.
2142
+ */
2143
+ function resolveAdvertisedPort(sources) {
2144
+ const configured = validPort(sources.configured);
2145
+ if (configured !== null) return {
2146
+ port: configured,
2147
+ source: "server-config"
2148
+ };
2149
+ const env = validPort(sources.env);
2150
+ if (env !== null) return {
2151
+ port: env,
2152
+ source: "server-env"
2153
+ };
2154
+ const hint = validPort(sources.callerHint);
2155
+ if (hint !== null) return {
2156
+ port: hint,
2157
+ source: "caller-hint"
2158
+ };
2159
+ return {
2160
+ port: DEFAULT_HUB_PORT,
2161
+ source: "default"
2162
+ };
2163
+ }
2164
+ function validPort(value) {
2165
+ if (value === null) return null;
2166
+ return Number.isInteger(value) && value >= 1 && value <= 65535 ? value : null;
2167
+ }
2168
+ function enumerateOsInterfaces(ifaces, ipv6Flags) {
2169
+ const raw = [];
2170
+ for (const [name, addrs] of Object.entries(ifaces)) {
2171
+ if (!addrs) continue;
2172
+ for (const a of addrs) {
2173
+ if (a.family !== "IPv4" && a.family !== "IPv6") continue;
2174
+ raw.push({
2175
+ name,
2176
+ family: a.family,
2177
+ address: a.address,
2178
+ cidr: a.cidr ?? "",
2179
+ netmask: a.netmask,
2180
+ internal: a.internal,
2181
+ mac: a.mac
2182
+ });
2183
+ }
2184
+ }
2185
+ const classified = raw.map((r) => {
2186
+ const kind = classifyKind(r.name, r.address, r.internal);
2187
+ const reachableKind = kind === "lan" || kind === "wifi";
2188
+ const hex = r.family === "IPv6" ? ipv6ToHex32(r.address) : null;
2189
+ const flags = hex !== null ? ipv6Flags?.get(hex) : void 0;
2190
+ const rangeOk = isPlausibleAutoSeed(r.address, r.family);
2191
+ const stableV6 = r.family !== "IPv6" || shouldAdvertiseIpv6(r.address, flags);
2192
+ const plausible = !r.internal && reachableKind && rangeOk && stableV6;
2193
+ const plausibleReason = plausible ? "" : r.family === "IPv6" && rangeOk && !stableV6 ? "IPv6 temporary / privacy address — rotates and is not advertised." : explainNonPlausible({
2194
+ kind,
2195
+ family: r.family,
2196
+ address: r.address,
2197
+ internal: r.internal
2198
+ });
2199
+ return {
2200
+ name: r.name,
2201
+ family: r.family,
2202
+ address: r.address,
2203
+ cidr: r.cidr,
2204
+ netmask: r.netmask,
2205
+ internal: r.internal,
2206
+ mac: r.mac,
2207
+ kind,
2208
+ preferred: false,
2209
+ plausible,
2210
+ plausibleReason
2211
+ };
2212
+ });
2213
+ const preferred = pickPreferred(classified);
2214
+ return classified.map((iface) => ({
2215
+ ...iface,
2216
+ preferred: preferred !== null && iface.name === preferred.name && iface.address === preferred.address
2217
+ }));
2218
+ }
2219
+ /**
2220
+ * Filter the interface list by the operator's allowlist. Empty
2221
+ * allowlist = no-op (every interface passes); otherwise only entries
2222
+ * whose `address` matches an allowlist entry remain. IPv6 matches the
2223
+ * allowlisted /64 so a rotated privacy address does not hide the live
2224
+ * GUA. Loopback is not an advertised client route and is not forced
2225
+ * through.
2226
+ */
2227
+ function applyAllowlist(interfaces, allowed) {
2228
+ if (allowed.length === 0) return interfaces;
2229
+ return interfaces.filter((i) => ipv6AllowlistMatches(i.address, allowed) || allowed.includes(i.address));
2230
+ }
2231
+ /**
2232
+ * Rank interfaces and pick the auto-selected outbound one. See the
2233
+ * cap's `getPreferred` doc for the heuristic.
2234
+ */
2235
+ function pickPreferred(interfaces) {
2236
+ const candidates = interfaces.filter((i) => !i.internal && i.family === "IPv4" && !i.address.startsWith("169.254.") && i.kind !== "loopback");
2237
+ if (candidates.length === 0) return null;
2238
+ const kindRank = {
2239
+ lan: 1,
2240
+ wifi: 2,
2241
+ vpn: 3,
2242
+ docker: 4,
2243
+ other: 5,
2244
+ loopback: 99
2245
+ };
2246
+ return [...candidates].toSorted((a, b) => {
2247
+ const ra = kindRank[a.kind];
2248
+ const rb = kindRank[b.kind];
2249
+ if (ra !== rb) return ra - rb;
2250
+ return prefixLen(b.netmask) - prefixLen(a.netmask);
2251
+ })[0] ?? null;
2252
+ }
2253
+ /**
2254
+ * The CamStack app link as a palette entry (D709): the one address on the
2255
+ * Network page that is not this hub's. Flagging it for notifications (the
2256
+ * default) makes viewer taps open the native app, with the hub carried as
2257
+ * `hub=`. `kind: 'app-link'` keeps it out of every race and ranking; it is
2258
+ * only emitted on `includeAppLink: true`.
2259
+ */
2260
+ function appLinkEndpoint() {
2261
+ return {
2262
+ label: "CamStack app link",
2263
+ baseUrl: require_dist.CAMSTACK_APP_LINK_ORIGIN,
2264
+ kind: "app-link",
2265
+ interfaceKind: "public",
2266
+ plausible: true,
2267
+ plausibleReason: "",
2268
+ priority: -1
2269
+ };
2270
+ }
2271
+ function buildEndpoints(interfaces, port, includeLoopback, ipv4Only, publicHostname, scheme = "http", meshEndpoint = null, lanHttp = null, publicHostnameStable = true) {
2272
+ const out = [];
2273
+ let priority = 0;
2274
+ const preferred = pickPreferred(interfaces);
2275
+ const httpLan = lanHttp?.enabled === true && lanHttp.listening === true;
2276
+ const lanScheme = httpLan ? "http" : scheme;
2277
+ const lanPort = httpLan ? lanHttp.httpPort : port;
2278
+ const emit = (iface, kind, label, baseUrl, pri) => {
2279
+ out.push({
2280
+ label,
2281
+ baseUrl,
2282
+ kind,
2283
+ interfaceKind: iface.kind,
2284
+ plausible: iface.plausible,
2285
+ plausibleReason: iface.plausibleReason,
2286
+ priority: pri
2287
+ });
2288
+ };
2289
+ if (httpLan && lanHttp.localHostname) out.push({
2290
+ label: "Local name",
2291
+ baseUrl: `${lanScheme}://${lanHttp.localHostname}:${lanPort}`,
2292
+ kind: "lan-ipv4",
2293
+ interfaceKind: "lan",
2294
+ plausible: true,
2295
+ plausibleReason: "",
2296
+ priority: priority++
2297
+ });
2298
+ if (preferred) emit(preferred, "lan-ipv4", `${formatKind(preferred.kind)} — ${preferred.name}`, `${lanScheme}://${preferred.address}:${lanPort}`, priority++);
2299
+ for (const iface of interfaces) {
2300
+ if (iface.internal || iface.family !== "IPv4") continue;
2301
+ if (iface.kind === "loopback") continue;
2302
+ if (preferred && iface.name === preferred.name && iface.address === preferred.address) continue;
2303
+ if (iface.address.startsWith("169.254.")) continue;
2304
+ emit(iface, "lan-ipv4", `${formatKind(iface.kind)} — ${iface.name}`, `${lanScheme}://${iface.address}:${lanPort}`, 10 + priority++);
2305
+ }
2306
+ if (!ipv4Only) for (const iface of interfaces) {
2307
+ if (iface.internal || iface.family !== "IPv6") continue;
2308
+ if (iface.kind === "loopback") continue;
2309
+ if (iface.address.toLowerCase().startsWith("fe80:")) continue;
2310
+ if (!iface.plausible) continue;
2311
+ emit(iface, "lan-ipv6", `${formatKind(iface.kind)} — ${iface.name} (IPv6)`, `${lanScheme}://[${iface.address}]:${lanPort}`, 10 + priority++);
2312
+ }
2313
+ if (publicHostname) out.push({
2314
+ label: publicHostnameStable ? "Public tunnel" : "Public tunnel (temporary address)",
2315
+ baseUrl: `https://${publicHostname}`,
2316
+ kind: "public",
2317
+ interfaceKind: "public",
2318
+ plausible: true,
2319
+ plausibleReason: "",
2320
+ priority: 100,
2321
+ ...publicHostnameStable ? {} : { stable: false }
2322
+ });
2323
+ if (meshEndpoint && meshEndpoint.host) out.push({
2324
+ label: "Mesh (Tailscale)",
2325
+ baseUrl: `https://${meshEndpoint.host}:${meshEndpoint.port}`,
2326
+ kind: "public",
2327
+ interfaceKind: "vpn",
2328
+ plausible: true,
2329
+ plausibleReason: "",
2330
+ priority: 150
2331
+ });
2332
+ if (includeLoopback) out.push({
2333
+ label: "Loopback",
2334
+ baseUrl: `${scheme}://127.0.0.1:${port}`,
2335
+ kind: "loopback",
2336
+ interfaceKind: "loopback",
2337
+ plausible: false,
2338
+ plausibleReason: "Loopback — last-resort fallback when no other endpoint responds.",
2339
+ priority: 1e3
2340
+ });
2341
+ return out.toSorted((a, b) => a.priority - b.priority);
2342
+ }
2343
+ /**
2344
+ * First-boot heuristic: which addresses should the allowlist start
2345
+ * with? Includes LAN + Wi-Fi IPv4 addresses + plausible IPv6:
2346
+ *
2347
+ * - **IPv4**: skip link-local (`169.254.*`), keep the rest.
2348
+ * - **IPv6**: skip link-local (`fe80::*`), unspecified, and
2349
+ * multicast. Keep ULAs (`fc00::/7`) and Global Unicast (`2000::/3`).
2350
+ * Privacy-extension temporary addresses are skipped when Linux flags
2351
+ * mark them non-permanent (`plausible === false`).
2352
+ *
2353
+ * Skips docker/vpn/loopback/other entirely — those stay opt-in.
2354
+ */
2355
+ function autoSeedAllowlist(interfaces) {
2356
+ return [...new Set(interfaces.filter((i) => !i.internal && (i.kind === "lan" || i.kind === "wifi") && isPlausibleAutoSeed(i.address, i.family) && (i.family !== "IPv6" || i.plausible)).map((i) => i.address))];
2357
+ }
2358
+ /**
2359
+ * Per-interface tooltip text surfaced on the "Unlikely usable" badge.
2360
+ * Server-side so the UI doesn't re-derive the rationale (single source
2361
+ * of truth). Returns `''` for plausible entries; the addon overlays
2362
+ * this on the `LocalInterface.plausibleReason` field.
2363
+ */
2364
+ function explainNonPlausible(input) {
2365
+ if (input.internal) return "Internal interface (loopback) — not reachable from clients.";
2366
+ if (input.kind === "docker") return "Docker bridge — only reachable from inside the container network.";
2367
+ if (input.kind === "vpn") return "VPN tunnel — only reachable while the VPN is connected.";
2368
+ if (input.kind === "other") return "Unrecognised interface kind — verify reachability before pinning.";
2369
+ if (input.family === "IPv6") {
2370
+ const a = input.address.toLowerCase();
2371
+ if (a.startsWith("fe80:")) return "IPv6 link-local — only reachable on the same link, not routed.";
2372
+ if (a.startsWith("ff")) return "IPv6 multicast — not a unicast address.";
2373
+ if (a === "::" || a === "::1") return "IPv6 loopback / unspecified — not a public address.";
2374
+ return "IPv6 address outside the ULA / GUA ranges — verify before pinning.";
2375
+ }
2376
+ if (input.address.startsWith("169.254.")) return "IPv4 link-local (RFC 3927) — only valid when DHCP fails.";
2377
+ return "Address looks unusual for client traffic — verify before pinning.";
2378
+ }
2379
+ /**
2380
+ * Per-address gate used by `autoSeedAllowlist`. Exposed for tests so
2381
+ * we can pin every classification rule without standing up the addon.
2382
+ */
2383
+ function isPlausibleAutoSeed(address, family) {
2384
+ if (family === "IPv4") {
2385
+ if (address.startsWith("169.254.")) return false;
2386
+ return true;
2387
+ }
2388
+ const a = address.toLowerCase();
2389
+ if (a === "::" || a === "::1") return false;
2390
+ if (a.startsWith("fe80:")) return false;
2391
+ if (a.startsWith("ff")) return false;
2392
+ if (/^f[cd][0-9a-f]{0,2}:/.test(a)) return true;
2393
+ if (/^[23][0-9a-f]{0,3}:/.test(a)) return true;
2394
+ return false;
2395
+ }
2396
+ function classifyKind(name, address, internal) {
2397
+ if (internal || name === "lo" || name.startsWith("lo")) return "loopback";
2398
+ const n = name.toLowerCase();
2399
+ if (n.startsWith("docker") || n.startsWith("br-") || n.startsWith("veth")) return "docker";
2400
+ if (n.startsWith("tun") || n.startsWith("utun") || n.startsWith("wg") || n.startsWith("tap")) return "vpn";
2401
+ if (n.startsWith("wlan") || n.startsWith("wlp") || n.startsWith("wlx")) return "wifi";
2402
+ if (n.startsWith("eth") || /^en\d+$/.test(n)) {
2403
+ if (process.platform === "darwin" && /^en[1-9]\d*$/.test(n)) return "wifi";
2404
+ return "lan";
2405
+ }
2406
+ if (address === "127.0.0.1" || address === "::1") return "loopback";
2407
+ return "other";
2408
+ }
2409
+ /** Convert an IPv4/IPv6 netmask string to its prefix length (CIDR). */
2410
+ function prefixLen(netmask) {
2411
+ if (!netmask) return 0;
2412
+ if (netmask.includes(":")) {
2413
+ let bits = 0;
2414
+ for (const group of netmask.split(":")) {
2415
+ if (!group) continue;
2416
+ const n = parseInt(group, 16);
2417
+ if (!Number.isFinite(n)) break;
2418
+ for (let mask = 32768; mask; mask >>= 1) if (n & mask) bits++;
2419
+ else return bits;
2420
+ }
2421
+ return bits;
2422
+ }
2423
+ let bits = 0;
2424
+ for (const part of netmask.split(".")) {
2425
+ const n = parseInt(part, 10);
2426
+ if (!Number.isFinite(n)) break;
2427
+ for (let mask = 128; mask; mask >>= 1) if (n & mask) bits++;
2428
+ else return bits;
2429
+ }
2430
+ return bits;
2431
+ }
2432
+ function snapshotKey(interfaces) {
2433
+ return [...interfaces].map((i) => `${i.name}|${i.family}|${i.address}|${i.netmask}`).toSorted().join("\n");
2434
+ }
2435
+ function formatKind(kind) {
2436
+ switch (kind) {
2437
+ case "lan": return "LAN";
2438
+ case "wifi": return "Wi-Fi";
2439
+ case "vpn": return "VPN";
2440
+ case "docker": return "Docker";
2441
+ case "loopback": return "Loopback";
2442
+ case "other": return "Other";
2443
+ }
2444
+ }
2445
+ /**
2446
+ * Rewrite a persisted allowlist against the live interface set:
2447
+ * current auto-seed (LAN/Wi-Fi, stable IPv6) plus still-live operator
2448
+ * extras (docker/vpn). Empty stays empty — that is "unrestricted".
2449
+ */
2450
+ function reconcileAllowlist(current, interfaces) {
2451
+ if (current.length === 0) return [];
2452
+ const live = new Set(interfaces.map((i) => i.address));
2453
+ const seed = autoSeedAllowlist(interfaces);
2454
+ const seedSet = new Set(seed);
2455
+ const extras = current.filter((a) => live.has(a) && !seedSet.has(a) && !a.includes(":"));
2456
+ return [...new Set([...seed, ...extras])];
2457
+ }
2458
+ function sameAddressSet(a, b) {
2459
+ if (a.length !== b.length) return false;
2460
+ const set = new Set(a);
2461
+ return b.every((addr) => set.has(addr));
2462
+ }
2463
+ function readLinuxIpv6Flags() {
2464
+ try {
2465
+ return parseProcIfInet6((0, node_fs.readFileSync)("/proc/net/if_inet6", "utf8"));
2466
+ } catch {
2467
+ return;
2468
+ }
2469
+ }
2470
+ //#endregion
2471
+ exports.ALLOWLIST_RECONCILE_INTERVAL_MS = ALLOWLIST_RECONCILE_INTERVAL_MS;
2472
+ exports.LocalNetworkAddon = LocalNetworkAddon;
2473
+ exports.appLinkEndpoint = appLinkEndpoint;
2474
+ exports.applyAllowlist = applyAllowlist;
2475
+ exports.autoSeedAllowlist = autoSeedAllowlist;
2476
+ exports.buildEndpoints = buildEndpoints;
2477
+ exports.classifyKind = classifyKind;
2478
+ exports.enumerateOsInterfaces = enumerateOsInterfaces;
2479
+ exports.explainNonPlausible = explainNonPlausible;
2480
+ exports.ipv6Prefix64Key = ipv6Prefix64Key;
2481
+ exports.isPlausibleAutoSeed = isPlausibleAutoSeed;
2482
+ exports.parseProcIfInet6 = parseProcIfInet6;
2483
+ exports.pickPreferred = pickPreferred;
2484
+ exports.prefixLen = prefixLen;
2485
+ exports.reconcileAllowlist = reconcileAllowlist;
2486
+ exports.resolveAdvertisedPort = resolveAdvertisedPort;
2487
+ exports.shouldAdvertiseIpv6 = shouldAdvertiseIpv6;