@camstack/system 1.0.2

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 (262) hide show
  1. package/dist/addon/addon-api-factory.d.ts +35 -0
  2. package/dist/addon-routes/addon-route-registry.d.ts +37 -0
  3. package/dist/addon-runner.js +599 -0
  4. package/dist/addon-runner.mjs +597 -0
  5. package/dist/auth/api-key-manager.d.ts +26 -0
  6. package/dist/auth/auth-manager.d.ts +109 -0
  7. package/dist/auth/parse-record.d.ts +18 -0
  8. package/dist/auth/scope-matcher.d.ts +7 -0
  9. package/dist/auth/scoped-token-manager.d.ts +40 -0
  10. package/dist/auth/totp-manager.d.ts +51 -0
  11. package/dist/auth/user-manager.d.ts +34 -0
  12. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts +53 -0
  13. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +259 -0
  14. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +251 -0
  15. package/dist/builtins/addon-pages-aggregator/dedupe-pages.d.ts +6 -0
  16. package/dist/builtins/addon-pages-aggregator/index.d.ts +1 -0
  17. package/dist/builtins/addon-pages-aggregator/index.js +8 -0
  18. package/dist/builtins/addon-pages-aggregator/index.mjs +2 -0
  19. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts +47 -0
  20. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +228 -0
  21. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +220 -0
  22. package/dist/builtins/addon-widgets-aggregator/index.d.ts +1 -0
  23. package/dist/builtins/addon-widgets-aggregator/index.js +8 -0
  24. package/dist/builtins/addon-widgets-aggregator/index.mjs +2 -0
  25. package/dist/builtins/alerts/alerts.addon.d.ts +81 -0
  26. package/dist/builtins/alerts/alerts.addon.js +601 -0
  27. package/dist/builtins/alerts/alerts.addon.mjs +595 -0
  28. package/dist/builtins/alerts/index.d.ts +1 -0
  29. package/dist/builtins/alerts/index.js +4 -0
  30. package/dist/builtins/alerts/index.mjs +2 -0
  31. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +147 -0
  32. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2229 -0
  33. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2220 -0
  34. package/dist/builtins/backup-orchestrator/cron-helpers.d.ts +23 -0
  35. package/dist/builtins/backup-orchestrator/destination-policy.d.ts +72 -0
  36. package/dist/builtins/backup-orchestrator/download-helpers.d.ts +12 -0
  37. package/dist/builtins/backup-orchestrator/index.d.ts +2 -0
  38. package/dist/builtins/backup-orchestrator/index.js +8 -0
  39. package/dist/builtins/backup-orchestrator/index.mjs +2 -0
  40. package/dist/builtins/backup-orchestrator/manifest-store.d.ts +77 -0
  41. package/dist/builtins/console-logging/console-destination.d.ts +13 -0
  42. package/dist/builtins/console-logging/console-logging.addon.d.ts +25 -0
  43. package/dist/builtins/console-logging/index.d.ts +3 -0
  44. package/dist/builtins/console-logging/index.js +104 -0
  45. package/dist/builtins/console-logging/index.mjs +95 -0
  46. package/dist/builtins/device-manager/device-config-contribution.d.ts +32 -0
  47. package/dist/builtins/device-manager/device-event-propagator.d.ts +26 -0
  48. package/dist/builtins/device-manager/device-link-overlay.d.ts +23 -0
  49. package/dist/builtins/device-manager/device-link-resolver.d.ts +15 -0
  50. package/dist/builtins/device-manager/device-manager.addon.d.ts +452 -0
  51. package/dist/builtins/device-manager/device-manager.addon.js +3299 -0
  52. package/dist/builtins/device-manager/device-manager.addon.mjs +3292 -0
  53. package/dist/builtins/device-manager/index.d.ts +2 -0
  54. package/dist/builtins/device-manager/index.js +8 -0
  55. package/dist/builtins/device-manager/index.mjs +2 -0
  56. package/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts +44 -0
  57. package/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts +15 -0
  58. package/dist/builtins/hub-forwarder/index.d.ts +3 -0
  59. package/dist/builtins/hub-forwarder/index.js +154 -0
  60. package/dist/builtins/hub-forwarder/index.mjs +145 -0
  61. package/dist/builtins/local-auth/auth-schema.d.ts +26 -0
  62. package/dist/builtins/local-auth/index.d.ts +1 -0
  63. package/dist/builtins/local-auth/index.js +4 -0
  64. package/dist/builtins/local-auth/index.mjs +2 -0
  65. package/dist/builtins/local-auth/local-auth.addon.d.ts +18 -0
  66. package/dist/builtins/local-auth/local-auth.addon.js +8094 -0
  67. package/dist/builtins/local-auth/local-auth.addon.mjs +8063 -0
  68. package/dist/builtins/local-auth/oauth-grants.d.ts +45 -0
  69. package/dist/builtins/local-auth/oauth-session-manager.d.ts +50 -0
  70. package/dist/builtins/local-network/index.d.ts +2 -0
  71. package/dist/builtins/local-network/index.js +10 -0
  72. package/dist/builtins/local-network/index.mjs +2 -0
  73. package/dist/builtins/local-network/local-network.addon.d.ts +150 -0
  74. package/dist/builtins/local-network/local-network.addon.js +489 -0
  75. package/dist/builtins/local-network/local-network.addon.mjs +477 -0
  76. package/dist/builtins/native-metrics/index.d.ts +2 -0
  77. package/dist/builtins/native-metrics/native-metrics-provider.d.ts +48 -0
  78. package/dist/builtins/native-metrics/native-metrics.addon.d.ts +73 -0
  79. package/dist/builtins/native-metrics/native-metrics.addon.js +922 -0
  80. package/dist/builtins/native-metrics/native-metrics.addon.mjs +914 -0
  81. package/dist/builtins/platform-probe/hardware-decode-accel-probe.d.ts +37 -0
  82. package/dist/builtins/platform-probe/hardware-encoder-probe.d.ts +13 -0
  83. package/dist/builtins/platform-probe/index.d.ts +22 -0
  84. package/dist/builtins/platform-probe/index.js +834 -0
  85. package/dist/builtins/platform-probe/index.mjs +822 -0
  86. package/dist/builtins/platform-probe/inference-config-resolver.d.ts +29 -0
  87. package/dist/builtins/platform-probe/intel-accelerators.d.ts +11 -0
  88. package/dist/builtins/platform-probe/platform-scorer.d.ts +30 -0
  89. package/dist/builtins/platform-probe/runtime-packages.d.ts +6 -0
  90. package/dist/builtins/remote-access-orchestrator/enabled-providers-reconcile.d.ts +96 -0
  91. package/dist/builtins/remote-access-orchestrator/index.d.ts +1 -0
  92. package/dist/builtins/remote-access-orchestrator/index.js +8 -0
  93. package/dist/builtins/remote-access-orchestrator/index.mjs +2 -0
  94. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +40 -0
  95. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +214 -0
  96. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +208 -0
  97. package/dist/builtins/shared/settle-sources.d.ts +22 -0
  98. package/dist/builtins/snapshot/index.d.ts +2 -0
  99. package/dist/builtins/snapshot/index.js +494 -0
  100. package/dist/builtins/snapshot/index.mjs +488 -0
  101. package/dist/builtins/snapshot/snapshot.addon.d.ts +120 -0
  102. package/dist/builtins/sqlite-storage/config-store.d.ts +8 -0
  103. package/dist/builtins/sqlite-storage/device-store.d.ts +23 -0
  104. package/dist/builtins/sqlite-storage/filesystem-browse-provider.d.ts +25 -0
  105. package/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts +83 -0
  106. package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts +32 -0
  107. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +396 -0
  108. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +388 -0
  109. package/dist/builtins/sqlite-storage/index.d.ts +8 -0
  110. package/dist/builtins/sqlite-storage/index.js +62 -0
  111. package/dist/builtins/sqlite-storage/index.mjs +49 -0
  112. package/dist/builtins/sqlite-storage/integration-registry.d.ts +27 -0
  113. package/dist/builtins/sqlite-storage/path-guard.d.ts +4 -0
  114. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +102 -0
  115. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +14 -0
  116. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +644 -0
  117. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +636 -0
  118. package/dist/builtins/storage-orchestrator/index.d.ts +6 -0
  119. package/dist/builtins/storage-orchestrator/index.js +10 -0
  120. package/dist/builtins/storage-orchestrator/index.mjs +2 -0
  121. package/dist/builtins/storage-orchestrator/location-store.d.ts +49 -0
  122. package/dist/builtins/storage-orchestrator/provider-discovery.d.ts +10 -0
  123. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +103 -0
  124. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1138 -0
  125. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1128 -0
  126. package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +236 -0
  127. package/dist/builtins/storage-orchestrator/storage-pressure-manager.d.ts +38 -0
  128. package/dist/builtins/system-backup/system-backup.service.d.ts +137 -0
  129. package/dist/builtins/system-config/index.d.ts +1 -0
  130. package/dist/builtins/system-config/index.js +8 -0
  131. package/dist/builtins/system-config/index.mjs +2 -0
  132. package/dist/builtins/system-config/system-config.addon.d.ts +10 -0
  133. package/dist/builtins/system-config/system-config.addon.js +232 -0
  134. package/dist/builtins/system-config/system-config.addon.mjs +226 -0
  135. package/dist/builtins/winston-logging/index.d.ts +3 -0
  136. package/dist/builtins/winston-logging/index.js +156 -0
  137. package/dist/builtins/winston-logging/index.mjs +144 -0
  138. package/dist/builtins/winston-logging/winston-destination.d.ts +21 -0
  139. package/dist/builtins/winston-logging/winston-logging.addon.d.ts +19 -0
  140. package/dist/chunk-CNf5ZN-e.mjs +37 -0
  141. package/dist/chunk-Cek0wNdY.js +64 -0
  142. package/dist/download/model-download-service.d.ts +41 -0
  143. package/dist/download/model-downloader.d.ts +31 -0
  144. package/dist/events/event-bus.d.ts +10 -0
  145. package/dist/events/system-event-bus.d.ts +14 -0
  146. package/dist/feature/feature-manager.d.ts +11 -0
  147. package/dist/formatter-B7qW8bPJ.mjs +162 -0
  148. package/dist/formatter-DqAKDlvN.js +167 -0
  149. package/dist/http/authenticated-file-server.d.ts +53 -0
  150. package/dist/http/data-plane-registry.d.ts +23 -0
  151. package/dist/http/file-data-plane.d.ts +10 -0
  152. package/dist/http/reverse-proxy.d.ts +15 -0
  153. package/dist/index.d.ts +82 -0
  154. package/dist/index.js +93485 -0
  155. package/dist/index.mjs +93179 -0
  156. package/dist/intel-accelerators-Gg0P5mnl.js +20 -0
  157. package/dist/intel-accelerators-hGgpZ0pX.mjs +19 -0
  158. package/dist/kernel/addon-class-resolver.d.ts +4 -0
  159. package/dist/kernel/addon-engine-manager.d.ts +22 -0
  160. package/dist/kernel/addon-health-monitor.d.ts +154 -0
  161. package/dist/kernel/addon-installer.d.ts +208 -0
  162. package/dist/kernel/addon-loader.d.ts +106 -0
  163. package/dist/kernel/addon-manifest.d.ts +77 -0
  164. package/dist/kernel/capability-handle.d.ts +46 -0
  165. package/dist/kernel/capability-registry.d.ts +412 -0
  166. package/dist/kernel/config-manager.d.ts +212 -0
  167. package/dist/kernel/config-schema.d.ts +93 -0
  168. package/dist/kernel/custom-action-registry.d.ts +23 -0
  169. package/dist/kernel/deps/addon-deps-manager.d.ts +19 -0
  170. package/dist/kernel/deps/manifest-native-deps.d.ts +25 -0
  171. package/dist/kernel/deps/manifest-python-deps.d.ts +20 -0
  172. package/dist/kernel/device-registry.d.ts +29 -0
  173. package/dist/kernel/fs-utils.d.ts +41 -0
  174. package/dist/kernel/hwaccel/hwaccel-resolver.d.ts +19 -0
  175. package/dist/kernel/hwaccel/hwaccel-service.d.ts +4 -0
  176. package/dist/kernel/index.d.ts +74 -0
  177. package/dist/kernel/infra-capabilities.d.ts +13 -0
  178. package/dist/kernel/moleculer/addon-context-factory.d.ts +91 -0
  179. package/dist/kernel/moleculer/addon-data-plane-facility.d.ts +19 -0
  180. package/dist/kernel/moleculer/addon-runner.d.ts +1 -0
  181. package/dist/kernel/moleculer/addon-service-factory.d.ts +50 -0
  182. package/dist/kernel/moleculer/broker-factory.d.ts +50 -0
  183. package/dist/kernel/moleculer/cap-usage-registry.d.ts +46 -0
  184. package/dist/kernel/moleculer/capabilities-access.d.ts +21 -0
  185. package/dist/kernel/moleculer/child-addon-call-dispatch.d.ts +46 -0
  186. package/dist/kernel/moleculer/child-cap-dispatch.d.ts +20 -0
  187. package/dist/kernel/moleculer/cluster-secret.d.ts +15 -0
  188. package/dist/kernel/moleculer/core-cap-service.d.ts +50 -0
  189. package/dist/kernel/moleculer/crash-supervisor.d.ts +50 -0
  190. package/dist/kernel/moleculer/device-cap-proxy.d.ts +79 -0
  191. package/dist/kernel/moleculer/event-bus-core.d.ts +53 -0
  192. package/dist/kernel/moleculer/event-bus.d.ts +53 -0
  193. package/dist/kernel/moleculer/hub-log-forwarder.d.ts +36 -0
  194. package/dist/kernel/moleculer/hub-service.d.ts +35 -0
  195. package/dist/kernel/moleculer/node-registry.d.ts +126 -0
  196. package/dist/kernel/moleculer/process-context.d.ts +4 -0
  197. package/dist/kernel/moleculer/process-service.d.ts +72 -0
  198. package/dist/kernel/moleculer/provider-registry.d.ts +28 -0
  199. package/dist/kernel/moleculer/readiness-context.d.ts +62 -0
  200. package/dist/kernel/moleculer/readiness-service.d.ts +7 -0
  201. package/dist/kernel/moleculer/register-node-client.d.ts +35 -0
  202. package/dist/kernel/moleculer/remote-logger.d.ts +43 -0
  203. package/dist/kernel/moleculer/resilient-cap-call.d.ts +28 -0
  204. package/dist/kernel/moleculer/stream-probe-service.d.ts +9 -0
  205. package/dist/kernel/moleculer/trpc-links.d.ts +189 -0
  206. package/dist/kernel/moleculer/typed-array-serde.d.ts +25 -0
  207. package/dist/kernel/moleculer/worker-device-restore.d.ts +10 -0
  208. package/dist/kernel/provider-kind-drift.d.ts +12 -0
  209. package/dist/kernel/restart-coordinator.d.ts +90 -0
  210. package/dist/kernel/storage-location-registry.d.ts +40 -0
  211. package/dist/kernel/transport/cap-action-name.d.ts +100 -0
  212. package/dist/kernel/transport/cap-route-resolver.d.ts +148 -0
  213. package/dist/kernel/transport/cap-route.d.ts +148 -0
  214. package/dist/kernel/transport/child-cap-protocol.d.ts +136 -0
  215. package/dist/kernel/transport/create-local-transport.d.ts +7 -0
  216. package/dist/kernel/transport/frame-codec.d.ts +7 -0
  217. package/dist/kernel/transport/index.d.ts +27 -0
  218. package/dist/kernel/transport/local-child-client.d.ts +136 -0
  219. package/dist/kernel/transport/local-child-registry.d.ts +179 -0
  220. package/dist/kernel/transport/local-endpoint-path.d.ts +6 -0
  221. package/dist/kernel/transport/local-transport.d.ts +46 -0
  222. package/dist/kernel/transport/parent-unowned-call.d.ts +75 -0
  223. package/dist/kernel/transport/socket-channel.d.ts +27 -0
  224. package/dist/kernel/transport/uds-event-bridge.d.ts +36 -0
  225. package/dist/kernel/transport/uds-event-bus.d.ts +22 -0
  226. package/dist/kernel/transport/uds-local-transport.d.ts +18 -0
  227. package/dist/kernel/transport/uds-log-ingest.d.ts +28 -0
  228. package/dist/kernel/transport/uds-logger.d.ts +44 -0
  229. package/dist/kernel/utils/ring-buffer.d.ts +15 -0
  230. package/dist/kernel/workspace-detect.d.ts +9 -0
  231. package/dist/lifecycle/lifecycle-state-machine.d.ts +28 -0
  232. package/dist/logging/formatter.d.ts +30 -0
  233. package/dist/logging/log-manager.d.ts +54 -0
  234. package/dist/logging/log-ring-buffer.d.ts +47 -0
  235. package/dist/logging/partitioned-log-buffer.d.ts +35 -0
  236. package/dist/logging/scoped-logger.d.ts +17 -0
  237. package/dist/main-DNnMW7Z2.js +9983 -0
  238. package/dist/main-rtjOwPBR.mjs +9976 -0
  239. package/dist/manifest-python-deps-D1DbAQEv.js +6724 -0
  240. package/dist/manifest-python-deps-DZsKTbs1.mjs +6315 -0
  241. package/dist/network/network-quality.d.ts +11 -0
  242. package/dist/notification/notification-service.d.ts +37 -0
  243. package/dist/notification/toast-service.d.ts +22 -0
  244. package/dist/pipeline/engine-manager-resolver.d.ts +15 -0
  245. package/dist/pipeline/pipeline-runner.d.ts +8 -0
  246. package/dist/pipeline/pipeline-validator.d.ts +13 -0
  247. package/dist/process/resource-monitor.d.ts +11 -0
  248. package/dist/python/python-env-manager.d.ts +12 -0
  249. package/dist/repl/interfaces.d.ts +31 -0
  250. package/dist/repl/repl-engine.d.ts +8 -0
  251. package/dist/resource-monitor-ClDGFyf6.mjs +57 -0
  252. package/dist/resource-monitor-IIEanuJt.js +74 -0
  253. package/dist/settle-sources-Bhsy57y-.js +38 -0
  254. package/dist/settle-sources-CDtNC8ub.mjs +33 -0
  255. package/dist/storage/fs-storage-backend.d.ts +40 -0
  256. package/dist/storage/storage-location-manager.d.ts +23 -0
  257. package/dist/storage/storage-manager.d.ts +83 -0
  258. package/dist/tar-BgAEMRBR.js +5434 -0
  259. package/dist/tar-ByMOPNM0.mjs +5429 -0
  260. package/dist/tls/cert-manager.d.ts +26 -0
  261. package/dist/tls/index.d.ts +1 -0
  262. package/package.json +343 -0
@@ -0,0 +1,45 @@
1
+ import { ISsoBridgeProvider, TokenScope } from '@camstack/types';
2
+ import { OauthSessionManager } from './oauth-session-manager.js';
3
+ interface IssueCodeInput {
4
+ integrationId: string;
5
+ userId: string;
6
+ username: string;
7
+ scopes: TokenScope[];
8
+ redirectUri: string;
9
+ hubUrl: string;
10
+ }
11
+ interface TokenPair {
12
+ accessToken: string;
13
+ refreshToken: string;
14
+ expiresIn: number;
15
+ }
16
+ interface VerifiedAccess {
17
+ userId: string;
18
+ username: string;
19
+ scopes: TokenScope[];
20
+ }
21
+ /** OAuth account-linking grant logic. Pure over an injected sso-bridge
22
+ * signer so it is unit-testable without the capability registry.
23
+ *
24
+ * Authorization codes are short-lived (60 s). The `redirectUri`,
25
+ * `integrationId`, and a unique `jti` are embedded in the signed JWT
26
+ * so the HMAC signature is the real security boundary. Single-use is
27
+ * enforced by a `jti` consumed-set. The old in-process `pendingCodes`
28
+ * Map is gone — a hub restart no longer breaks in-flight exchanges,
29
+ * only risking a single replay within the remaining 60 s TTL. */
30
+ export declare function createOauthGrants(ssoBridge: ISsoBridgeProvider, sessionManager: OauthSessionManager): {
31
+ oauthIssueCode(input: IssueCodeInput): Promise<{
32
+ code: string;
33
+ }>;
34
+ oauthExchangeCode(input: {
35
+ code: string;
36
+ redirectUri: string;
37
+ }): Promise<TokenPair | null>;
38
+ oauthRefresh(input: {
39
+ refreshToken: string;
40
+ }): Promise<TokenPair | null>;
41
+ oauthVerifyAccessToken(input: {
42
+ token: string;
43
+ }): Promise<VerifiedAccess | null>;
44
+ };
45
+ export {};
@@ -0,0 +1,50 @@
1
+ import { TokenScope, SettingsStoreClient } from '@camstack/types';
2
+ export interface OauthSession {
3
+ readonly id: string;
4
+ readonly userId: string;
5
+ readonly username: string;
6
+ readonly integrationId: string;
7
+ readonly scopes: TokenScope[];
8
+ readonly createdAt: number;
9
+ readonly lastUsedAt: number;
10
+ readonly revokedAt: number | null;
11
+ }
12
+ interface CreateInput {
13
+ readonly userId: string;
14
+ readonly username: string;
15
+ readonly integrationId: string;
16
+ readonly scopes: TokenScope[];
17
+ }
18
+ export declare class OauthSessionManager {
19
+ private readonly store;
20
+ constructor(store: SettingsStoreClient);
21
+ /**
22
+ * Create a new OAuth session record. Generates a UUID as the session id,
23
+ * sets `createdAt` and `lastUsedAt` to now, `revokedAt` to null.
24
+ */
25
+ create(input: CreateInput): Promise<OauthSession>;
26
+ /**
27
+ * Return all sessions — both active and revoked. Callers decide
28
+ * whether to filter by `revokedAt`.
29
+ */
30
+ list(): Promise<OauthSession[]>;
31
+ /**
32
+ * Look up a session by its id. Returns null when not found.
33
+ */
34
+ getById(id: string): Promise<OauthSession | null>;
35
+ /**
36
+ * Mark a session as revoked by setting `revokedAt = now`.
37
+ *
38
+ * - Returns `true` on success (including idempotent re-revoke — the
39
+ * existing `revokedAt` timestamp is preserved; it is NOT updated).
40
+ * - Returns `false` when the session id is not found.
41
+ */
42
+ markRevoked(id: string): Promise<boolean>;
43
+ /**
44
+ * Update `lastUsedAt` to now. No-op (does not throw) when the session
45
+ * id is not found — the caller (token-use hot path) should not fail
46
+ * for a missing session that may have been concurrently revoked.
47
+ */
48
+ touch(id: string): Promise<void>;
49
+ }
50
+ export {};
@@ -0,0 +1,2 @@
1
+ export { LocalNetworkAddon, classifyKind, prefixLen } from './local-network.addon.js';
2
+ export { LocalNetworkAddon as default } from './local-network.addon.js';
@@ -0,0 +1,10 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ require("../../chunk-Cek0wNdY.js");
6
+ const require_builtins_local_network_local_network_addon = require("./local-network.addon.js");
7
+ exports.LocalNetworkAddon = require_builtins_local_network_local_network_addon.LocalNetworkAddon;
8
+ exports.classifyKind = require_builtins_local_network_local_network_addon.classifyKind;
9
+ exports.default = require_builtins_local_network_local_network_addon.LocalNetworkAddon;
10
+ exports.prefixLen = require_builtins_local_network_local_network_addon.prefixLen;
@@ -0,0 +1,2 @@
1
+ import { LocalNetworkAddon, classifyKind, prefixLen } from "./local-network.addon.mjs";
2
+ export { LocalNetworkAddon, LocalNetworkAddon as default, classifyKind, prefixLen };
@@ -0,0 +1,150 @@
1
+ import { ProviderRegistration, LocalInterface, ConnectionEndpoint, BaseAddon } from '@camstack/types';
2
+ /**
3
+ * Cached mesh-reachable endpoint, learned from the `mesh-network`
4
+ * provider via the `MeshNetworkChanged` event-tail + pull-reconcile.
5
+ * `null` when no mesh provider is joined / reachable.
6
+ */
7
+ interface MeshEndpointCache {
8
+ /** Preferred mesh host — MagicDNS name when available, else raw mesh IP. */
9
+ readonly host: string;
10
+ /** Hub HTTPS port the mesh endpoint targets. */
11
+ readonly port: number;
12
+ }
13
+ interface LocalNetworkConfig {
14
+ /** Empty = "auto" (every non-loopback / non-link-local address
15
+ * participates). Non-empty restricts the candidate set to only
16
+ * those operator-pinned addresses. */
17
+ readonly allowedAddresses: readonly string[];
18
+ /** Sentinel — `true` after the first-boot auto-seed runs. Lets the
19
+ * addon distinguish "fresh install, never touched" (false → seed
20
+ * with LAN/Wi-Fi addresses) from "operator explicitly cleared the
21
+ * allowlist" (true + empty → respect operator's choice). */
22
+ readonly bootSeeded: boolean;
23
+ }
24
+ export declare class LocalNetworkAddon extends BaseAddon<LocalNetworkConfig> {
25
+ private pollTimer;
26
+ private lastSnapshotKey;
27
+ /** Optional public hostname tracked from `NetworkTunnelStarted`/
28
+ * `Stopped` events on the bus. */
29
+ private publicHostname;
30
+ /**
31
+ * Mesh-reachable endpoint (Tailscale MagicDNS / 100.x), learned from
32
+ * the `MeshNetworkChanged` event-tail and refreshed by a pull-reconcile
33
+ * before each `getConnectionEndpoints` build (events are lossy — D8).
34
+ * `null` when no mesh provider is joined.
35
+ */
36
+ private meshEndpoint;
37
+ constructor();
38
+ protected onInitialize(): Promise<ProviderRegistration[]>;
39
+ protected onShutdown(): Promise<void>;
40
+ /**
41
+ * Other hub addons (e.g. cloudflare-tunnel) signal the active public
42
+ * FQDN by emitting `NetworkTunnelStarted` on the bus — handled in
43
+ * `onInitialize`. This setter exists for tests + future direct
44
+ * callers; cleared by passing an empty string.
45
+ */
46
+ setPublicHostname(hostname: string): void;
47
+ /**
48
+ * Replace the cached mesh endpoint. Set from the `MeshNetworkChanged`
49
+ * event-tail + the pull-reconcile; exposed for tests + future direct
50
+ * callers. Pass `null` to clear (mesh left / no provider joined).
51
+ */
52
+ setMeshEndpoint(endpoint: MeshEndpointCache | null): void;
53
+ /**
54
+ * Refresh the cached mesh endpoint from the authoritative forked
55
+ * `mesh-network` provider(s). `mesh-network` is a COLLECTION cap on a
56
+ * forked addon, so the hub builtin can't see it via `ctx.api` /
57
+ * `getCollectionEntries` — we resolve each provider by addonId through
58
+ * the hub-side `capabilityRegistry.getProviderByAddon` resolver (the
59
+ * same mechanism `device-manager` uses for cross-process exporter
60
+ * contributions). Best-effort: a provider that's absent / errors /
61
+ * not joined simply contributes nothing.
62
+ */
63
+ private reconcileMeshEndpoint;
64
+ private enumerate;
65
+ private detectChanges;
66
+ }
67
+ /**
68
+ * Lift `os.networkInterfaces()` into our `LocalInterface[]` shape with
69
+ * kind classification + preferred flag. Pure — takes the raw result so
70
+ * tests can feed synthetic data.
71
+ */
72
+ interface OsNetworkInterfaceInfo {
73
+ readonly family: string;
74
+ readonly address: string;
75
+ readonly cidr?: string | null;
76
+ readonly netmask: string;
77
+ readonly internal: boolean;
78
+ readonly mac: string;
79
+ }
80
+ export declare function enumerateOsInterfaces(ifaces: NodeJS.Dict<readonly OsNetworkInterfaceInfo[]>): readonly LocalInterface[];
81
+ /**
82
+ * Filter the interface list by the operator's allowlist. Empty
83
+ * allowlist = no-op (every interface passes); otherwise only entries
84
+ * whose `address` matches an allowlist entry remain. Loopback always
85
+ * survives so the SDK keeps `127.0.0.1` as the last-resort fallback.
86
+ */
87
+ export declare function applyAllowlist(interfaces: readonly LocalInterface[], allowed: readonly string[]): readonly LocalInterface[];
88
+ /**
89
+ * Rank interfaces and pick the auto-selected outbound one. See the
90
+ * cap's `getPreferred` doc for the heuristic.
91
+ */
92
+ export declare function pickPreferred(interfaces: readonly LocalInterface[]): LocalInterface | null;
93
+ /**
94
+ * Build the ordered candidate URL list. Priority schema:
95
+ * 0 — preferred LAN IPv4
96
+ * 10+ — other LAN IPv4
97
+ * 100 — public tunnel hostname (always HTTPS)
98
+ * 150 — mesh endpoint (Tailscale MagicDNS / 100.x, always HTTPS)
99
+ * 200+ — LAN IPv6
100
+ * 1000 — loopback (last resort)
101
+ *
102
+ * The mesh endpoint ranks just below a true public funnel (a Funnel is
103
+ * reachable by ANY client; the mesh needs the peer on the same tailnet)
104
+ * but above the IPv6 / loopback fallbacks — giving remote, mesh-joined
105
+ * clients a working candidate when no public tunnel is up.
106
+ *
107
+ * `scheme` controls LAN + loopback URLs. Browsers running over HTTPS
108
+ * block `http://` candidates as mixed content, so callers loaded over
109
+ * HTTPS should pass `scheme: 'https'` even when probing a LAN IP — the
110
+ * hub's cert manager already issues a SAN-multi cert covering local
111
+ * interfaces. The public tunnel + mesh endpoint always emit `https://`
112
+ * (the tunnel edge / the hub itself terminates TLS).
113
+ */
114
+ export declare function buildEndpoints(interfaces: readonly LocalInterface[], port: number, includeLoopback: boolean, ipv4Only: boolean, publicHostname: string, scheme?: 'http' | 'https', meshEndpoint?: MeshEndpointCache | null): ConnectionEndpoint[];
115
+ /**
116
+ * First-boot heuristic: which addresses should the allowlist start
117
+ * with? Includes LAN + Wi-Fi IPv4 addresses + plausible IPv6:
118
+ *
119
+ * - **IPv4**: skip link-local (`169.254.*`), keep the rest.
120
+ * - **IPv6**: skip link-local (`fe80::*`), unspecified, and
121
+ * multicast. Keep ULAs (`fc00::/7` → `fc??:` / `fd??:`) and Global
122
+ * Unicast addresses (`2000::/3` → `2???`/`3???`). Privacy-extension
123
+ * temporary addresses get included by default; the operator can
124
+ * prune them from the Network Addresses tab if the rotating IPs
125
+ * become a nuisance.
126
+ *
127
+ * Skips docker/vpn/loopback/other entirely — those stay opt-in.
128
+ */
129
+ export declare function autoSeedAllowlist(interfaces: readonly LocalInterface[]): string[];
130
+ /**
131
+ * Per-interface tooltip text surfaced on the "Unlikely usable" badge.
132
+ * Server-side so the UI doesn't re-derive the rationale (single source
133
+ * of truth). Returns `''` for plausible entries; the addon overlays
134
+ * this on the `LocalInterface.plausibleReason` field.
135
+ */
136
+ export declare function explainNonPlausible(input: {
137
+ readonly kind: LocalInterface['kind'];
138
+ readonly family: 'IPv4' | 'IPv6';
139
+ readonly address: string;
140
+ readonly internal: boolean;
141
+ }): string;
142
+ /**
143
+ * Per-address gate used by `autoSeedAllowlist`. Exposed for tests so
144
+ * we can pin every classification rule without standing up the addon.
145
+ */
146
+ export declare function isPlausibleAutoSeed(address: string, family: 'IPv4' | 'IPv6'): boolean;
147
+ export declare function classifyKind(name: string, address: string, internal: boolean): LocalInterface['kind'];
148
+ /** Convert an IPv4/IPv6 netmask string to its prefix length (CIDR). */
149
+ export declare function prefixLen(netmask: string): number;
150
+ export {};