@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,2 @@
1
+ export { DeviceManagerAddon } from './device-manager.addon.js';
2
+ export { default } from './device-manager.addon.js';
@@ -0,0 +1,8 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ require("../../chunk-Cek0wNdY.js");
6
+ const require_builtins_device_manager_device_manager_addon = require("./device-manager.addon.js");
7
+ exports.DeviceManagerAddon = require_builtins_device_manager_device_manager_addon.DeviceManagerAddon;
8
+ exports.default = require_builtins_device_manager_device_manager_addon.DeviceManagerAddon;
@@ -0,0 +1,2 @@
1
+ import { DeviceManagerAddon } from "./device-manager.addon.mjs";
2
+ export { DeviceManagerAddon, DeviceManagerAddon as default };
@@ -0,0 +1,44 @@
1
+ import { IClusterBroker, ILogDestination, IScopedLogger, LogEntry, LogFilter } from '@camstack/types';
2
+ /**
3
+ * Log destination for agent mode.
4
+ *
5
+ * - Writes to console ONLY when hub is not yet reachable (cold-start
6
+ * fallback). Forked-worker agents share stdout with their parent
7
+ * hub, so logging to local console AND forwarding to hub's
8
+ * `log-receiver` would print the entry twice on the hub terminal.
9
+ * Once the hub is discovered, local console output stops and the
10
+ * hub's own ConsoleDestination owns the render.
11
+ * - When a Moleculer broker is connected and the hub node is reachable,
12
+ * forwards every log entry to the hub via `log-receiver.ingest`.
13
+ * - Entries written before the hub is reachable are buffered internally
14
+ * (ring-buffered to `DEFAULT_OUTBOUND_BUFFER_SIZE`) and flushed on connect,
15
+ * so boot-time logs still reach the hub without any external replay trigger.
16
+ */
17
+ export declare class HubForwarderDestination implements ILogDestination {
18
+ private broker;
19
+ private hubConnected;
20
+ private readonly outboundBuffer;
21
+ private statusLogger;
22
+ initialize(): Promise<void>;
23
+ /**
24
+ * Provide a logger for the destination's own status messages
25
+ * (discovery, disconnect, reconnect). Routed through the agent's
26
+ * LogManager but never through this same destination — the owning
27
+ * addon must hand in a logger that does NOT route back here, or
28
+ * status writes will recurse.
29
+ */
30
+ setStatusLogger(logger: IScopedLogger): void;
31
+ private status;
32
+ /**
33
+ * Attach the Moleculer broker so hub forwarding can start.
34
+ * Called by the owning addon from `onInitialize(ctx)` with
35
+ * `ctx.kernel.cluster?.broker`.
36
+ */
37
+ connectBroker(broker: IClusterBroker): void;
38
+ write(entry: LogEntry): void;
39
+ query(_filter: LogFilter): Promise<readonly LogEntry[]>;
40
+ shutdown(): Promise<void>;
41
+ private bufferOutbound;
42
+ private flushOutbound;
43
+ private forward;
44
+ }
@@ -0,0 +1,15 @@
1
+ import { ProviderRegistration, BaseAddon } from '@camstack/types';
2
+ import { HubForwarderDestination } from './hub-forwarder-destination.js';
3
+ /**
4
+ * Agent-only addon that provides the `log-destination` capability.
5
+ * Writes all logs to the console and forwards to the hub via Moleculer when
6
+ * reachable. The broker is read from `ctx.kernel.cluster?.broker`; outbound
7
+ * log replay on hub-connect is handled internally by the destination.
8
+ */
9
+ export declare class HubForwarderAddon extends BaseAddon {
10
+ private destination;
11
+ constructor();
12
+ protected onInitialize(): Promise<ProviderRegistration[]>;
13
+ getDestination(): HubForwarderDestination | null;
14
+ protected onShutdown(): Promise<void>;
15
+ }
@@ -0,0 +1,3 @@
1
+ export { HubForwarderAddon } from './hub-forwarder.addon.js';
2
+ export { HubForwarderAddon as default } from './hub-forwarder.addon.js';
3
+ export { HubForwarderDestination } from './hub-forwarder-destination.js';
@@ -0,0 +1,154 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ require("../../chunk-Cek0wNdY.js");
6
+ const require_formatter = require("../../formatter-DqAKDlvN.js");
7
+ let _camstack_types = require("@camstack/types");
8
+ //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
9
+ var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
10
+ /**
11
+ * Log destination for agent mode.
12
+ *
13
+ * - Writes to console ONLY when hub is not yet reachable (cold-start
14
+ * fallback). Forked-worker agents share stdout with their parent
15
+ * hub, so logging to local console AND forwarding to hub's
16
+ * `log-receiver` would print the entry twice on the hub terminal.
17
+ * Once the hub is discovered, local console output stops and the
18
+ * hub's own ConsoleDestination owns the render.
19
+ * - When a Moleculer broker is connected and the hub node is reachable,
20
+ * forwards every log entry to the hub via `log-receiver.ingest`.
21
+ * - Entries written before the hub is reachable are buffered internally
22
+ * (ring-buffered to `DEFAULT_OUTBOUND_BUFFER_SIZE`) and flushed on connect,
23
+ * so boot-time logs still reach the hub without any external replay trigger.
24
+ */
25
+ var HubForwarderDestination = class {
26
+ broker = null;
27
+ hubConnected = false;
28
+ outboundBuffer = [];
29
+ statusLogger = null;
30
+ async initialize() {}
31
+ /**
32
+ * Provide a logger for the destination's own status messages
33
+ * (discovery, disconnect, reconnect). Routed through the agent's
34
+ * LogManager but never through this same destination — the owning
35
+ * addon must hand in a logger that does NOT route back here, or
36
+ * status writes will recurse.
37
+ */
38
+ setStatusLogger(logger) {
39
+ this.statusLogger = logger;
40
+ }
41
+ status(level, msg) {
42
+ if (this.statusLogger) {
43
+ if (level === "warn") this.statusLogger.warn(msg);
44
+ else this.statusLogger.info(msg);
45
+ return;
46
+ }
47
+ if (level === "warn") console.warn(`[hub-forwarder] ${msg}`);
48
+ else console.log(`[hub-forwarder] ${msg}`);
49
+ }
50
+ /**
51
+ * Attach the Moleculer broker so hub forwarding can start.
52
+ * Called by the owning addon from `onInitialize(ctx)` with
53
+ * `ctx.kernel.cluster?.broker`.
54
+ */
55
+ connectBroker(broker) {
56
+ this.broker = broker;
57
+ broker.waitForServices("log-receiver").then(() => {
58
+ this.hubConnected = true;
59
+ this.status("info", "log-receiver discovered — log forwarding active");
60
+ this.flushOutbound();
61
+ }).catch(() => {});
62
+ broker.localBus.on("$node.disconnected", ({ node }) => {
63
+ if (node.id === "hub") {
64
+ this.hubConnected = false;
65
+ this.status("info", "Hub disconnected — log forwarding paused");
66
+ broker.waitForServices("log-receiver").then(() => {
67
+ this.hubConnected = true;
68
+ this.status("info", "Hub reconnected — log forwarding resumed");
69
+ this.flushOutbound();
70
+ }).catch(() => {});
71
+ }
72
+ });
73
+ }
74
+ write(entry) {
75
+ if (this.hubConnected && this.broker) {
76
+ this.forward(entry);
77
+ return;
78
+ }
79
+ this.bufferOutbound(entry);
80
+ const line = require_formatter.formatLogLine(entry, { colorize: true });
81
+ if (entry.level === "error") console.error(line);
82
+ else if (entry.level === "warn") console.warn(line);
83
+ else console.log(line);
84
+ }
85
+ async query(_filter) {
86
+ return [];
87
+ }
88
+ async shutdown() {
89
+ this.hubConnected = false;
90
+ this.broker = null;
91
+ this.outboundBuffer.length = 0;
92
+ }
93
+ bufferOutbound(entry) {
94
+ this.outboundBuffer.push(entry);
95
+ if (this.outboundBuffer.length > DEFAULT_OUTBOUND_BUFFER_SIZE) this.outboundBuffer.splice(0, this.outboundBuffer.length - DEFAULT_OUTBOUND_BUFFER_SIZE);
96
+ }
97
+ flushOutbound() {
98
+ if (!this.broker || !this.hubConnected) return;
99
+ const pending = this.outboundBuffer.splice(0, this.outboundBuffer.length);
100
+ for (const entry of pending) this.forward(entry);
101
+ }
102
+ forward(entry) {
103
+ if (!this.broker) return;
104
+ this.broker.call("log-receiver.ingest", {
105
+ level: entry.level,
106
+ message: entry.message,
107
+ addonId: entry.tags?.addonId ?? "agent",
108
+ nodeId: entry.tags?.nodeId ?? this.broker.nodeID,
109
+ ...entry.scope !== void 0 ? { scope: entry.scope } : {},
110
+ ...entry.tags ? { tags: entry.tags } : {},
111
+ ...entry.meta ? { meta: entry.meta } : {}
112
+ }).catch(() => {});
113
+ }
114
+ };
115
+ //#endregion
116
+ //#region src/builtins/hub-forwarder/hub-forwarder.addon.ts
117
+ /**
118
+ * Agent-only addon that provides the `log-destination` capability.
119
+ * Writes all logs to the console and forwards to the hub via Moleculer when
120
+ * reachable. The broker is read from `ctx.kernel.cluster?.broker`; outbound
121
+ * log replay on hub-connect is handled internally by the destination.
122
+ */
123
+ var HubForwarderAddon = class extends _camstack_types.BaseAddon {
124
+ destination = null;
125
+ constructor() {
126
+ super({});
127
+ }
128
+ async onInitialize() {
129
+ this.destination = new HubForwarderDestination();
130
+ await this.destination.initialize();
131
+ this.destination.setStatusLogger(this.ctx.logger);
132
+ const broker = this.ctx.kernel.cluster?.broker;
133
+ if (broker) this.destination.connectBroker(broker);
134
+ else this.ctx.logger.warn("cluster.broker not available — hub forwarding disabled, console only");
135
+ this.ctx.logger.info("Hub forwarder log destination registered");
136
+ return [{
137
+ capability: _camstack_types.logDestinationCapability,
138
+ provider: this.destination
139
+ }];
140
+ }
141
+ getDestination() {
142
+ return this.destination;
143
+ }
144
+ async onShutdown() {
145
+ await this.destination?.shutdown();
146
+ this.destination = null;
147
+ }
148
+ };
149
+ //#endregion
150
+ exports.HubForwarderAddon = HubForwarderAddon;
151
+ exports.HubForwarderAddon$1 = HubForwarderAddon;
152
+ exports.HubForwarderDestination = HubForwarderDestination;
153
+ exports.HubForwarderDestination$1 = HubForwarderDestination;
154
+ exports.default = HubForwarderAddon;
@@ -0,0 +1,145 @@
1
+ import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
2
+ import { BaseAddon, logDestinationCapability } from "@camstack/types";
3
+ //#region src/builtins/hub-forwarder/hub-forwarder-destination.ts
4
+ var DEFAULT_OUTBOUND_BUFFER_SIZE = 500;
5
+ /**
6
+ * Log destination for agent mode.
7
+ *
8
+ * - Writes to console ONLY when hub is not yet reachable (cold-start
9
+ * fallback). Forked-worker agents share stdout with their parent
10
+ * hub, so logging to local console AND forwarding to hub's
11
+ * `log-receiver` would print the entry twice on the hub terminal.
12
+ * Once the hub is discovered, local console output stops and the
13
+ * hub's own ConsoleDestination owns the render.
14
+ * - When a Moleculer broker is connected and the hub node is reachable,
15
+ * forwards every log entry to the hub via `log-receiver.ingest`.
16
+ * - Entries written before the hub is reachable are buffered internally
17
+ * (ring-buffered to `DEFAULT_OUTBOUND_BUFFER_SIZE`) and flushed on connect,
18
+ * so boot-time logs still reach the hub without any external replay trigger.
19
+ */
20
+ var HubForwarderDestination = class {
21
+ broker = null;
22
+ hubConnected = false;
23
+ outboundBuffer = [];
24
+ statusLogger = null;
25
+ async initialize() {}
26
+ /**
27
+ * Provide a logger for the destination's own status messages
28
+ * (discovery, disconnect, reconnect). Routed through the agent's
29
+ * LogManager but never through this same destination — the owning
30
+ * addon must hand in a logger that does NOT route back here, or
31
+ * status writes will recurse.
32
+ */
33
+ setStatusLogger(logger) {
34
+ this.statusLogger = logger;
35
+ }
36
+ status(level, msg) {
37
+ if (this.statusLogger) {
38
+ if (level === "warn") this.statusLogger.warn(msg);
39
+ else this.statusLogger.info(msg);
40
+ return;
41
+ }
42
+ if (level === "warn") console.warn(`[hub-forwarder] ${msg}`);
43
+ else console.log(`[hub-forwarder] ${msg}`);
44
+ }
45
+ /**
46
+ * Attach the Moleculer broker so hub forwarding can start.
47
+ * Called by the owning addon from `onInitialize(ctx)` with
48
+ * `ctx.kernel.cluster?.broker`.
49
+ */
50
+ connectBroker(broker) {
51
+ this.broker = broker;
52
+ broker.waitForServices("log-receiver").then(() => {
53
+ this.hubConnected = true;
54
+ this.status("info", "log-receiver discovered — log forwarding active");
55
+ this.flushOutbound();
56
+ }).catch(() => {});
57
+ broker.localBus.on("$node.disconnected", ({ node }) => {
58
+ if (node.id === "hub") {
59
+ this.hubConnected = false;
60
+ this.status("info", "Hub disconnected — log forwarding paused");
61
+ broker.waitForServices("log-receiver").then(() => {
62
+ this.hubConnected = true;
63
+ this.status("info", "Hub reconnected — log forwarding resumed");
64
+ this.flushOutbound();
65
+ }).catch(() => {});
66
+ }
67
+ });
68
+ }
69
+ write(entry) {
70
+ if (this.hubConnected && this.broker) {
71
+ this.forward(entry);
72
+ return;
73
+ }
74
+ this.bufferOutbound(entry);
75
+ const line = formatLogLine(entry, { colorize: true });
76
+ if (entry.level === "error") console.error(line);
77
+ else if (entry.level === "warn") console.warn(line);
78
+ else console.log(line);
79
+ }
80
+ async query(_filter) {
81
+ return [];
82
+ }
83
+ async shutdown() {
84
+ this.hubConnected = false;
85
+ this.broker = null;
86
+ this.outboundBuffer.length = 0;
87
+ }
88
+ bufferOutbound(entry) {
89
+ this.outboundBuffer.push(entry);
90
+ if (this.outboundBuffer.length > DEFAULT_OUTBOUND_BUFFER_SIZE) this.outboundBuffer.splice(0, this.outboundBuffer.length - DEFAULT_OUTBOUND_BUFFER_SIZE);
91
+ }
92
+ flushOutbound() {
93
+ if (!this.broker || !this.hubConnected) return;
94
+ const pending = this.outboundBuffer.splice(0, this.outboundBuffer.length);
95
+ for (const entry of pending) this.forward(entry);
96
+ }
97
+ forward(entry) {
98
+ if (!this.broker) return;
99
+ this.broker.call("log-receiver.ingest", {
100
+ level: entry.level,
101
+ message: entry.message,
102
+ addonId: entry.tags?.addonId ?? "agent",
103
+ nodeId: entry.tags?.nodeId ?? this.broker.nodeID,
104
+ ...entry.scope !== void 0 ? { scope: entry.scope } : {},
105
+ ...entry.tags ? { tags: entry.tags } : {},
106
+ ...entry.meta ? { meta: entry.meta } : {}
107
+ }).catch(() => {});
108
+ }
109
+ };
110
+ //#endregion
111
+ //#region src/builtins/hub-forwarder/hub-forwarder.addon.ts
112
+ /**
113
+ * Agent-only addon that provides the `log-destination` capability.
114
+ * Writes all logs to the console and forwards to the hub via Moleculer when
115
+ * reachable. The broker is read from `ctx.kernel.cluster?.broker`; outbound
116
+ * log replay on hub-connect is handled internally by the destination.
117
+ */
118
+ var HubForwarderAddon = class extends BaseAddon {
119
+ destination = null;
120
+ constructor() {
121
+ super({});
122
+ }
123
+ async onInitialize() {
124
+ this.destination = new HubForwarderDestination();
125
+ await this.destination.initialize();
126
+ this.destination.setStatusLogger(this.ctx.logger);
127
+ const broker = this.ctx.kernel.cluster?.broker;
128
+ if (broker) this.destination.connectBroker(broker);
129
+ else this.ctx.logger.warn("cluster.broker not available — hub forwarding disabled, console only");
130
+ this.ctx.logger.info("Hub forwarder log destination registered");
131
+ return [{
132
+ capability: logDestinationCapability,
133
+ provider: this.destination
134
+ }];
135
+ }
136
+ getDestination() {
137
+ return this.destination;
138
+ }
139
+ async onShutdown() {
140
+ await this.destination?.shutdown();
141
+ this.destination = null;
142
+ }
143
+ };
144
+ //#endregion
145
+ export { HubForwarderAddon, HubForwarderAddon as default, HubForwarderDestination };
@@ -0,0 +1,26 @@
1
+ import { SettingsStoreClient } from '@camstack/types';
2
+ export declare const USERS_COLLECTION = "users";
3
+ export declare const API_KEYS_COLLECTION = "api_keys";
4
+ export declare const SCOPED_TOKENS_COLLECTION = "scoped_tokens";
5
+ export declare const OAUTH_SESSIONS_COLLECTION = "oauth_sessions";
6
+ /**
7
+ * TOTP enrollment table — split off from `users` to avoid the
8
+ * destructive drop-+-recreate migration `ensureTable` performs when a
9
+ * new column is added to a typed schema (see `sqlite-settings-backend.ts`).
10
+ *
11
+ * Lifecycle:
12
+ * - Setup: row inserted with `confirmedAt = null` and a fresh secret.
13
+ * - Confirm: a valid code from the secret flips `confirmedAt` to now().
14
+ * - Disable: the row is deleted (next setup starts fresh).
15
+ *
16
+ * "Enabled" means `confirmedAt != null`. A half-enrolled row (`confirmedAt
17
+ * = null`) is INACTIVE — `verifyTotp` returns false until confirmation.
18
+ */
19
+ export declare const USER_TOTP_COLLECTION = "user_totp";
20
+ /**
21
+ * Declare every auth collection with the typed schema. Called by
22
+ * `LocalAuthAddon.onInitialize` before constructing the per-collection
23
+ * managers. Idempotent — `declareCollection` is a no-op when the
24
+ * collection has already been declared (same shape).
25
+ */
26
+ export declare function declareAuthSchema(store: SettingsStoreClient): Promise<void>;
@@ -0,0 +1 @@
1
+ export { LocalAuthAddon } from './local-auth.addon.js';
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../../chunk-Cek0wNdY.js");
3
+ const require_builtins_local_auth_local_auth_addon = require("./local-auth.addon.js");
4
+ exports.LocalAuthAddon = require_builtins_local_auth_local_auth_addon.LocalAuthAddon;
@@ -0,0 +1,2 @@
1
+ import { LocalAuthAddon } from "./local-auth.addon.mjs";
2
+ export { LocalAuthAddon };
@@ -0,0 +1,18 @@
1
+ import { ProviderRegistration, BaseAddon } from '@camstack/types';
2
+ interface LocalAuthConfig {
3
+ jwtSecret?: string;
4
+ adminUsername?: string;
5
+ adminPassword?: string;
6
+ }
7
+ export declare class LocalAuthAddon extends BaseAddon<LocalAuthConfig> {
8
+ private authManager;
9
+ private userManager;
10
+ private apiKeyManager;
11
+ private scopedTokenManager;
12
+ private oauthSessionManager;
13
+ private totpManager;
14
+ constructor();
15
+ protected onInitialize(): Promise<ProviderRegistration[]>;
16
+ protected onShutdown(): Promise<void>;
17
+ }
18
+ export default LocalAuthAddon;