@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,226 @@
1
+ import { BaseAddon, errMsg, hydrateSchema } from "@camstack/types";
2
+ //#region src/builtins/system-config/system-config.addon.ts
3
+ /**
4
+ * Built-in `system-config` addon — Phase 4 of the settings redesign.
5
+ *
6
+ * Exposes the cluster-wide yml-backed sections that the bootstrap
7
+ * loader reads before any addon is instantiated — things that cannot
8
+ * live inside an addon because changing them requires a server
9
+ * restart (port, host, dataPath) or because they own no runtime
10
+ * state of their own (auth token expiry, global ffmpeg binary path).
11
+ *
12
+ * Sections exposed:
13
+ * - server (port, host, dataPath — READ-ONLY, loaded from config.yaml at bootstrap)
14
+ * - auth (tokenExpiry)
15
+ * - ffmpeg (binaryPath, hwAccel, threadCount)
16
+ *
17
+ * Sections NOT exposed (each owned by the addon that implements them):
18
+ * - logging → `winston-logging` addon (level + retention)
19
+ * - recording → `recording` addon (segment duration, retention)
20
+ * - retention → analytics / detection addons (per-table retention)
21
+ *
22
+ * Implementation notes:
23
+ * - Runs only on the hub process (yml sections are hub-side state).
24
+ * On agent nodes this addon would still instantiate, but every
25
+ * `ctx.settings.getSection(section)` call would hit an empty
26
+ * ConfigManager section so the UI would show the schema defaults.
27
+ * In practice the built-in loader can skip it on agents; for now we
28
+ * just let it run everywhere because it's harmless.
29
+ * - Reads via `ctx.settings.getSection(section)` and writes via
30
+ * `ctx.settings.setSection(section, patch)` — the explicit
31
+ * yml-section pair on `AddonSettingsApi`.
32
+ * - Does NOT register as a capability provider. It's a pure "settings
33
+ * surface" addon — its sole purpose is to expose the yml sections
34
+ * through the new three-level settings API.
35
+ *
36
+ * This addon is declared in `@camstack/system`'s package.json `camstack.addons[]`
37
+ * and loaded automatically via AddonLoader like any other core built-in.
38
+ */
39
+ /** Section key → user-facing section title. */
40
+ var SECTION_TITLES = {
41
+ server: "Server",
42
+ auth: "Authentication",
43
+ ffmpeg: "FFmpeg"
44
+ };
45
+ /** Keys that map 1:1 to a given yml section — used by `updateGlobalSettings`
46
+ * to figure out which section owns each key in the incoming patch. */
47
+ var KEY_TO_SECTION = {
48
+ port: "server",
49
+ host: "server",
50
+ dataPath: "server",
51
+ tokenExpiry: "auth",
52
+ binaryPath: "ffmpeg",
53
+ hwAccel: "ffmpeg",
54
+ threadCount: "ffmpeg"
55
+ };
56
+ var SystemConfigAddon = class extends BaseAddon {
57
+ id = "system-config";
58
+ constructor() {
59
+ super({});
60
+ }
61
+ async onInitialize() {
62
+ this.ctx.logger.info("Initialized — exposes yml-backed sections via getGlobalSettings");
63
+ }
64
+ buildGlobalSchema() {
65
+ return { sections: [
66
+ {
67
+ id: "system-config-server",
68
+ title: SECTION_TITLES["server"],
69
+ description: "Core server connection settings — read-only, loaded from config.yaml at bootstrap.",
70
+ columns: 2,
71
+ fields: [
72
+ {
73
+ type: "info",
74
+ key: "server-restart-note",
75
+ label: "Restart required",
76
+ content: "Server settings are read-only. Change them in config.yaml and restart.",
77
+ variant: "warning"
78
+ },
79
+ {
80
+ type: "text",
81
+ key: "port",
82
+ label: "Port",
83
+ description: "Listening port",
84
+ disabled: true
85
+ },
86
+ {
87
+ type: "text",
88
+ key: "host",
89
+ label: "Host",
90
+ description: "Bind address",
91
+ disabled: true
92
+ },
93
+ {
94
+ type: "text",
95
+ key: "dataPath",
96
+ label: "Data Path",
97
+ description: "Root data directory",
98
+ disabled: true,
99
+ span: 2
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ id: "system-config-auth",
105
+ title: SECTION_TITLES["auth"],
106
+ description: "Token and session settings.",
107
+ columns: 1,
108
+ fields: [{
109
+ type: "text",
110
+ key: "tokenExpiry",
111
+ label: "Token Expiry",
112
+ description: "JWT token lifetime (e.g. 24h, 7d, 1h)",
113
+ placeholder: "24h",
114
+ default: "24h"
115
+ }]
116
+ },
117
+ {
118
+ id: "system-config-ffmpeg",
119
+ title: SECTION_TITLES["ffmpeg"],
120
+ description: "FFmpeg binary and hardware acceleration settings.",
121
+ columns: 2,
122
+ fields: [
123
+ {
124
+ type: "text",
125
+ key: "binaryPath",
126
+ label: "Binary Path",
127
+ description: "Path to ffmpeg executable",
128
+ placeholder: "ffmpeg",
129
+ default: "ffmpeg",
130
+ span: 2
131
+ },
132
+ {
133
+ type: "select",
134
+ key: "hwAccel",
135
+ label: "Hardware Acceleration",
136
+ description: "GPU decoding/encoding backend",
137
+ default: "auto",
138
+ options: [
139
+ {
140
+ value: "auto",
141
+ label: "Auto-detect"
142
+ },
143
+ {
144
+ value: "none",
145
+ label: "None (CPU only)"
146
+ },
147
+ {
148
+ value: "videotoolbox",
149
+ label: "VideoToolbox (macOS)"
150
+ },
151
+ {
152
+ value: "vaapi",
153
+ label: "VA-API (Linux Intel/AMD)"
154
+ },
155
+ {
156
+ value: "qsv",
157
+ label: "QSV (Intel Quick Sync)"
158
+ },
159
+ {
160
+ value: "cuda",
161
+ label: "CUDA (NVIDIA)"
162
+ }
163
+ ]
164
+ },
165
+ {
166
+ type: "number",
167
+ key: "threadCount",
168
+ label: "Thread Count",
169
+ description: "0 = auto (let FFmpeg decide)",
170
+ min: 0,
171
+ max: 16,
172
+ step: 1,
173
+ default: 0
174
+ }
175
+ ]
176
+ }
177
+ ] };
178
+ }
179
+ async getGlobalSettings() {
180
+ const schema = this.buildGlobalSchema();
181
+ if (!this.ctx.settings) return hydrateSchema(schema, {});
182
+ const sectionNames = Object.keys(SECTION_TITLES);
183
+ const merged = {};
184
+ for (const section of sectionNames) try {
185
+ const values = await this.ctx.settings.getSection(section);
186
+ Object.assign(merged, values);
187
+ } catch (err) {
188
+ const msg = errMsg(err);
189
+ this.ctx.logger.debug("Failed to read section", { meta: {
190
+ section,
191
+ error: msg
192
+ } });
193
+ }
194
+ return hydrateSchema(schema, merged);
195
+ }
196
+ async updateGlobalSettings(patch) {
197
+ if (!this.ctx.settings) throw new Error("system-config: ctx.settings not available — cannot write sections");
198
+ const perSection = /* @__PURE__ */ new Map();
199
+ for (const [key, value] of Object.entries(patch)) {
200
+ const section = KEY_TO_SECTION[key];
201
+ if (section === void 0) {
202
+ this.ctx.logger.warn("update ignored unknown key (not mapped to any section)", { meta: { key } });
203
+ continue;
204
+ }
205
+ if (section === "server") {
206
+ this.ctx.logger.warn("update ignored read-only server-section key", { meta: { key } });
207
+ continue;
208
+ }
209
+ let bucket = perSection.get(section);
210
+ if (!bucket) {
211
+ bucket = {};
212
+ perSection.set(section, bucket);
213
+ }
214
+ bucket[key] = value;
215
+ }
216
+ for (const [section, sectionPatch] of perSection) {
217
+ await this.ctx.settings.setSection(section, sectionPatch);
218
+ this.ctx.logger.info("Wrote keys to section", { meta: {
219
+ section,
220
+ keyCount: Object.keys(sectionPatch).length
221
+ } });
222
+ }
223
+ }
224
+ };
225
+ //#endregion
226
+ export { SystemConfigAddon, SystemConfigAddon as default };
@@ -0,0 +1,3 @@
1
+ export { WinstonLoggingAddon } from './winston-logging.addon.js';
2
+ export { WinstonDestination } from './winston-destination.js';
3
+ export { WinstonLoggingAddon as default } from './winston-logging.addon.js';
@@ -0,0 +1,156 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_chunk = require("../../chunk-Cek0wNdY.js");
6
+ const require_formatter = require("../../formatter-DqAKDlvN.js");
7
+ let node_path = require("node:path");
8
+ node_path = require_chunk.__toESM(node_path);
9
+ let _camstack_types = require("@camstack/types");
10
+ let winston = require("winston");
11
+ winston = require_chunk.__toESM(winston);
12
+ let winston_daily_rotate_file = require("winston-daily-rotate-file");
13
+ winston_daily_rotate_file = require_chunk.__toESM(winston_daily_rotate_file);
14
+ //#region src/builtins/winston-logging/winston-destination.ts
15
+ /**
16
+ * Rotated-file log destination. Console output goes through the shared
17
+ * `formatLogLine` so every console sink (Winston, ConsoleDestination,
18
+ * HubForwarderDestination) emits identical lines. File output keeps a
19
+ * structured JSON shape so log tooling can query tags/meta.
20
+ */
21
+ var WinstonDestination = class {
22
+ logger = null;
23
+ async initialize(config) {
24
+ const { level = "info", retentionDays = 30, logsDir = node_path.join("camstack-data", "logs") } = config ?? {};
25
+ winston.format.printf((info) => {
26
+ const rendered = info._rendered;
27
+ return typeof rendered === "string" ? rendered : String(info.message);
28
+ });
29
+ const stripRendered = winston.format((info) => {
30
+ delete info["_rendered"];
31
+ return info;
32
+ });
33
+ const fileFormat = winston.format.combine(winston.format.timestamp(), stripRendered(), winston.format.json());
34
+ this.logger = winston.createLogger({
35
+ level,
36
+ transports: [new winston_daily_rotate_file.default({
37
+ dirname: logsDir,
38
+ filename: "camstack-%DATE%.log",
39
+ datePattern: "YYYY-MM-DD",
40
+ maxFiles: `${retentionDays}d`,
41
+ format: fileFormat
42
+ })]
43
+ });
44
+ }
45
+ write(entry) {
46
+ if (!this.logger) return;
47
+ const ts = entry.timestamp instanceof Date ? entry.timestamp.toISOString() : String(entry.timestamp);
48
+ const rendered = require_formatter.formatLogLine(entry, { colorize: true });
49
+ this.logger.log({
50
+ level: entry.level,
51
+ message: entry.message,
52
+ _rendered: rendered,
53
+ timestamp: ts,
54
+ scope: entry.scope,
55
+ ...entry.tags ? { tags: entry.tags } : {},
56
+ ...entry.meta ? { meta: entry.meta } : {}
57
+ });
58
+ }
59
+ async query(_filter) {
60
+ return [];
61
+ }
62
+ async shutdown() {
63
+ if (!this.logger) return;
64
+ await new Promise((resolve) => {
65
+ this.logger.on("finish", resolve);
66
+ this.logger.end();
67
+ });
68
+ this.logger = null;
69
+ }
70
+ };
71
+ //#endregion
72
+ //#region src/builtins/winston-logging/winston-logging.addon.ts
73
+ /**
74
+ * Winston logging addon — rotated log files + console output.
75
+ * Settings appear under Cluster → NodeDetail → Settings.
76
+ */
77
+ var WinstonLoggingAddon = class extends _camstack_types.BaseAddon {
78
+ destination = null;
79
+ constructor() {
80
+ super({
81
+ level: "info",
82
+ retentionDays: 30
83
+ });
84
+ }
85
+ async onInitialize() {
86
+ const logsDir = await this.ctx.api.storage.resolve.query({
87
+ location: "logs",
88
+ relativePath: ""
89
+ }).catch(() => "camstack-data/logs");
90
+ this.destination = new WinstonDestination();
91
+ await this.destination.initialize({
92
+ ...this.config,
93
+ logsDir
94
+ });
95
+ this.ctx.logger.info("Winston logging initialized");
96
+ return [{
97
+ capability: _camstack_types.logDestinationCapability,
98
+ provider: this.destination
99
+ }];
100
+ }
101
+ async onShutdown() {
102
+ await this.destination?.shutdown();
103
+ }
104
+ getDestination() {
105
+ if (!this.destination) throw new Error("Winston not initialized");
106
+ return this.destination;
107
+ }
108
+ globalSettingsSchema() {
109
+ return this.schema({ sections: [{
110
+ id: "winston-logging",
111
+ title: "Logging",
112
+ description: "Global log verbosity + retention for rotated log files on this node.",
113
+ columns: 2,
114
+ fields: [this.field({
115
+ type: "select",
116
+ key: "level",
117
+ label: "Log Level",
118
+ default: "info",
119
+ options: [
120
+ {
121
+ value: "debug",
122
+ label: "Debug"
123
+ },
124
+ {
125
+ value: "info",
126
+ label: "Info"
127
+ },
128
+ {
129
+ value: "warn",
130
+ label: "Warn"
131
+ },
132
+ {
133
+ value: "error",
134
+ label: "Error"
135
+ }
136
+ ]
137
+ }), this.field({
138
+ type: "number",
139
+ key: "retentionDays",
140
+ label: "Retention (days)",
141
+ description: "Number of days to keep rotated log files before deletion",
142
+ min: 1,
143
+ max: 365,
144
+ step: 1,
145
+ default: 30,
146
+ unit: "days"
147
+ })]
148
+ }] });
149
+ }
150
+ };
151
+ //#endregion
152
+ exports.WinstonDestination = WinstonDestination;
153
+ exports.WinstonDestination$1 = WinstonDestination;
154
+ exports.WinstonLoggingAddon = WinstonLoggingAddon;
155
+ exports.WinstonLoggingAddon$1 = WinstonLoggingAddon;
156
+ exports.default = WinstonLoggingAddon;
@@ -0,0 +1,144 @@
1
+ import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
2
+ import * as path$1 from "node:path";
3
+ import { BaseAddon, logDestinationCapability } from "@camstack/types";
4
+ import * as winston from "winston";
5
+ import DailyRotateFile from "winston-daily-rotate-file";
6
+ //#region src/builtins/winston-logging/winston-destination.ts
7
+ /**
8
+ * Rotated-file log destination. Console output goes through the shared
9
+ * `formatLogLine` so every console sink (Winston, ConsoleDestination,
10
+ * HubForwarderDestination) emits identical lines. File output keeps a
11
+ * structured JSON shape so log tooling can query tags/meta.
12
+ */
13
+ var WinstonDestination = class {
14
+ logger = null;
15
+ async initialize(config) {
16
+ const { level = "info", retentionDays = 30, logsDir = path$1.join("camstack-data", "logs") } = config ?? {};
17
+ winston.format.printf((info) => {
18
+ const rendered = info._rendered;
19
+ return typeof rendered === "string" ? rendered : String(info.message);
20
+ });
21
+ const stripRendered = winston.format((info) => {
22
+ delete info["_rendered"];
23
+ return info;
24
+ });
25
+ const fileFormat = winston.format.combine(winston.format.timestamp(), stripRendered(), winston.format.json());
26
+ this.logger = winston.createLogger({
27
+ level,
28
+ transports: [new DailyRotateFile({
29
+ dirname: logsDir,
30
+ filename: "camstack-%DATE%.log",
31
+ datePattern: "YYYY-MM-DD",
32
+ maxFiles: `${retentionDays}d`,
33
+ format: fileFormat
34
+ })]
35
+ });
36
+ }
37
+ write(entry) {
38
+ if (!this.logger) return;
39
+ const ts = entry.timestamp instanceof Date ? entry.timestamp.toISOString() : String(entry.timestamp);
40
+ const rendered = formatLogLine(entry, { colorize: true });
41
+ this.logger.log({
42
+ level: entry.level,
43
+ message: entry.message,
44
+ _rendered: rendered,
45
+ timestamp: ts,
46
+ scope: entry.scope,
47
+ ...entry.tags ? { tags: entry.tags } : {},
48
+ ...entry.meta ? { meta: entry.meta } : {}
49
+ });
50
+ }
51
+ async query(_filter) {
52
+ return [];
53
+ }
54
+ async shutdown() {
55
+ if (!this.logger) return;
56
+ await new Promise((resolve) => {
57
+ this.logger.on("finish", resolve);
58
+ this.logger.end();
59
+ });
60
+ this.logger = null;
61
+ }
62
+ };
63
+ //#endregion
64
+ //#region src/builtins/winston-logging/winston-logging.addon.ts
65
+ /**
66
+ * Winston logging addon — rotated log files + console output.
67
+ * Settings appear under Cluster → NodeDetail → Settings.
68
+ */
69
+ var WinstonLoggingAddon = class extends BaseAddon {
70
+ destination = null;
71
+ constructor() {
72
+ super({
73
+ level: "info",
74
+ retentionDays: 30
75
+ });
76
+ }
77
+ async onInitialize() {
78
+ const logsDir = await this.ctx.api.storage.resolve.query({
79
+ location: "logs",
80
+ relativePath: ""
81
+ }).catch(() => "camstack-data/logs");
82
+ this.destination = new WinstonDestination();
83
+ await this.destination.initialize({
84
+ ...this.config,
85
+ logsDir
86
+ });
87
+ this.ctx.logger.info("Winston logging initialized");
88
+ return [{
89
+ capability: logDestinationCapability,
90
+ provider: this.destination
91
+ }];
92
+ }
93
+ async onShutdown() {
94
+ await this.destination?.shutdown();
95
+ }
96
+ getDestination() {
97
+ if (!this.destination) throw new Error("Winston not initialized");
98
+ return this.destination;
99
+ }
100
+ globalSettingsSchema() {
101
+ return this.schema({ sections: [{
102
+ id: "winston-logging",
103
+ title: "Logging",
104
+ description: "Global log verbosity + retention for rotated log files on this node.",
105
+ columns: 2,
106
+ fields: [this.field({
107
+ type: "select",
108
+ key: "level",
109
+ label: "Log Level",
110
+ default: "info",
111
+ options: [
112
+ {
113
+ value: "debug",
114
+ label: "Debug"
115
+ },
116
+ {
117
+ value: "info",
118
+ label: "Info"
119
+ },
120
+ {
121
+ value: "warn",
122
+ label: "Warn"
123
+ },
124
+ {
125
+ value: "error",
126
+ label: "Error"
127
+ }
128
+ ]
129
+ }), this.field({
130
+ type: "number",
131
+ key: "retentionDays",
132
+ label: "Retention (days)",
133
+ description: "Number of days to keep rotated log files before deletion",
134
+ min: 1,
135
+ max: 365,
136
+ step: 1,
137
+ default: 30,
138
+ unit: "days"
139
+ })]
140
+ }] });
141
+ }
142
+ };
143
+ //#endregion
144
+ export { WinstonDestination, WinstonLoggingAddon, WinstonLoggingAddon as default };
@@ -0,0 +1,21 @@
1
+ import { ILogDestination, LogEntry, LogFilter } from '@camstack/types';
2
+ interface WinstonConfig {
3
+ readonly level: string;
4
+ readonly retentionDays: number;
5
+ /** Resolved absolute path to the logs directory (replaces the old dataPath field). */
6
+ readonly logsDir: string;
7
+ }
8
+ /**
9
+ * Rotated-file log destination. Console output goes through the shared
10
+ * `formatLogLine` so every console sink (Winston, ConsoleDestination,
11
+ * HubForwarderDestination) emits identical lines. File output keeps a
12
+ * structured JSON shape so log tooling can query tags/meta.
13
+ */
14
+ export declare class WinstonDestination implements ILogDestination {
15
+ private logger;
16
+ initialize(config?: WinstonConfig): Promise<void>;
17
+ write(entry: LogEntry): void;
18
+ query(_filter: LogFilter): Promise<readonly LogEntry[]>;
19
+ shutdown(): Promise<void>;
20
+ }
21
+ export {};
@@ -0,0 +1,19 @@
1
+ import { ProviderRegistration, BaseAddon } from '@camstack/types';
2
+ import { WinstonDestination } from './winston-destination.js';
3
+ interface WinstonConfig {
4
+ readonly level: string;
5
+ readonly retentionDays: number;
6
+ }
7
+ /**
8
+ * Winston logging addon — rotated log files + console output.
9
+ * Settings appear under Cluster → NodeDetail → Settings.
10
+ */
11
+ export declare class WinstonLoggingAddon extends BaseAddon<WinstonConfig> {
12
+ private destination;
13
+ constructor();
14
+ protected onInitialize(): Promise<ProviderRegistration[]>;
15
+ protected onShutdown(): Promise<void>;
16
+ getDestination(): WinstonDestination;
17
+ protected globalSettingsSchema(): import('@camstack/types').ConfigUISchema;
18
+ }
19
+ export {};
@@ -0,0 +1,37 @@
1
+ import { createRequire } from "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
10
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
11
+ var __exportAll = (all, no_symbols) => {
12
+ let target = {};
13
+ for (var name in all) __defProp(target, name, {
14
+ get: all[name],
15
+ enumerable: true
16
+ });
17
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ return target;
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
22
+ key = keys[i];
23
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
24
+ get: ((k) => from[k]).bind(null, key),
25
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
26
+ });
27
+ }
28
+ return to;
29
+ };
30
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
+ value: mod,
32
+ enumerable: true
33
+ }) : target, mod));
34
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
36
+ //#endregion
37
+ export { __toCommonJS as a, __require as i, __esmMin as n, __toESM as o, __exportAll as r, __commonJSMin as t };
@@ -0,0 +1,64 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
9
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
+ var __exportAll = (all, no_symbols) => {
11
+ let target = {};
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
17
+ return target;
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
+ key = keys[i];
22
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
23
+ get: ((k) => from[k]).bind(null, key),
24
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
+ });
26
+ }
27
+ return to;
28
+ };
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
+ //#endregion
35
+ Object.defineProperty(exports, "__commonJSMin", {
36
+ enumerable: true,
37
+ get: function() {
38
+ return __commonJSMin;
39
+ }
40
+ });
41
+ Object.defineProperty(exports, "__esmMin", {
42
+ enumerable: true,
43
+ get: function() {
44
+ return __esmMin;
45
+ }
46
+ });
47
+ Object.defineProperty(exports, "__exportAll", {
48
+ enumerable: true,
49
+ get: function() {
50
+ return __exportAll;
51
+ }
52
+ });
53
+ Object.defineProperty(exports, "__toCommonJS", {
54
+ enumerable: true,
55
+ get: function() {
56
+ return __toCommonJS;
57
+ }
58
+ });
59
+ Object.defineProperty(exports, "__toESM", {
60
+ enumerable: true,
61
+ get: function() {
62
+ return __toESM;
63
+ }
64
+ });