@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,11 @@
1
+ import { StreamNetworkStats, ClientNetworkStats, DeviceNetworkStats, INetworkQualityTracker } from '@camstack/types';
2
+ export type { StreamNetworkStats, ClientNetworkStats, DeviceNetworkStats, INetworkQualityTracker };
3
+ export declare class NetworkQualityTracker implements INetworkQualityTracker {
4
+ private readonly devices;
5
+ private static readonly MAX_SAMPLES;
6
+ reportStreamStats(deviceId: number, streamId: string, bitrateKbps: number, packetLoss?: number): void;
7
+ reportClientStats(deviceId: number, stats: Omit<ClientNetworkStats, 'lastUpdated'>): void;
8
+ getDeviceStats(deviceId: number): DeviceNetworkStats | null;
9
+ getAllStats(): readonly DeviceNetworkStats[];
10
+ private getOrCreateDevice;
11
+ }
@@ -0,0 +1,37 @@
1
+ import { INotificationOutput, Notification, ICapabilityRegistry } from '@camstack/types';
2
+ import { IScopedLogger } from '../logging/scoped-logger.js';
3
+ /**
4
+ * Central notification service that routes notifications to configured outputs.
5
+ * Framework-agnostic — dependencies injected via constructor.
6
+ *
7
+ * Outputs are resolved from the ICapabilityRegistry's 'notification-output'
8
+ * collection on each call (proxy pattern). Falls back to a local map
9
+ * when no registry is provided (backward compat).
10
+ */
11
+ export declare class NotificationService {
12
+ private readonly logger;
13
+ private readonly localOutputs;
14
+ private readonly routing;
15
+ private readonly rateLimits;
16
+ private readonly lastSent;
17
+ private registry;
18
+ constructor(logger: IScopedLogger);
19
+ /** Set the registry for live output lookup. Called once during boot. */
20
+ setRegistry(registry: ICapabilityRegistry): void;
21
+ /** Resolve all outputs — prefers registry, falls back to local map */
22
+ private get outputs();
23
+ /** Register an output in the local fallback map (used when no registry is set). */
24
+ registerLocalOutput(output: INotificationOutput): void;
25
+ /** Remove an output from the local fallback map. */
26
+ unregisterLocalOutput(id: string): void;
27
+ setRouting(category: string, outputIds: string[]): void;
28
+ setRateLimit(category: string, minIntervalMs: number): void;
29
+ notify(notification: Notification): Promise<void>;
30
+ getOutputs(): ReadonlyArray<{
31
+ id: string;
32
+ name: string;
33
+ icon: string;
34
+ }>;
35
+ getRouting(): ReadonlyMap<string, string[]>;
36
+ getOutput(id: string): INotificationOutput | undefined;
37
+ }
@@ -0,0 +1,22 @@
1
+ import { Toast } from '@camstack/types';
2
+ export type Unsubscribe = () => void;
3
+ /**
4
+ * Service for broadcasting toast notifications to connected UI clients.
5
+ * Framework-agnostic — integrates with tRPC subscriptions via subscribe().
6
+ */
7
+ export declare class ToastService {
8
+ private readonly listeners;
9
+ /**
10
+ * Subscribe to toast events for a specific user.
11
+ * Returns an unsubscribe function.
12
+ */
13
+ subscribe(connectionId: string, userId: string, callback: (toast: Toast) => void): Unsubscribe;
14
+ /**
15
+ * Broadcast a toast to all connected clients.
16
+ */
17
+ broadcast(toast: Toast): void;
18
+ /**
19
+ * Send a toast to a specific user's connections only.
20
+ */
21
+ sendToUser(userId: string, toast: Toast): void;
22
+ }
@@ -0,0 +1,15 @@
1
+ import { IAddonResolver, IAddonCaller, IEngineManager } from '@camstack/types';
2
+ /**
3
+ * Adapter that wraps an IEngineManager + addonConfigs as an IAddonResolver.
4
+ *
5
+ * Used for backwards compatibility — the in-process AddonEngineManager
6
+ * still uses the old getOrCreateEngine(addonId, globalConfig, override) API.
7
+ * This adapter bridges it to the new resolve(addonId, config) interface.
8
+ */
9
+ export declare class EngineManagerResolver implements IAddonResolver {
10
+ private readonly engineManager;
11
+ private readonly addonConfigs;
12
+ constructor(engineManager: IEngineManager, addonConfigs: Map<string, Record<string, unknown>>);
13
+ resolve(addonId: string, config: Record<string, unknown>): Promise<IAddonCaller>;
14
+ shutdownAll(): Promise<void>;
15
+ }
@@ -0,0 +1,8 @@
1
+ import { FrameInput, PipelineConfig, PipelineResult, IAddonResolver } from '@camstack/types';
2
+ export declare class PipelineRunner {
3
+ private readonly addonResolver;
4
+ constructor(addonResolver: IAddonResolver);
5
+ run(frame: FrameInput, config: PipelineConfig): Promise<PipelineResult>;
6
+ private executeNode;
7
+ private executeChildren;
8
+ }
@@ -0,0 +1,13 @@
1
+ import { PipelineConfig, ValidationIssue, ValidationResult } from '@camstack/types';
2
+ export type { ValidationIssue, ValidationResult };
3
+ /**
4
+ * Check if a pipeline step is available in the system.
5
+ * Implementations should check the capability registry for `pipeline-step:{stepId}`.
6
+ */
7
+ export type StepExistsFn = (stepId: string) => boolean;
8
+ export declare class PipelineValidator {
9
+ private readonly stepExists;
10
+ constructor(stepExists: StepExistsFn);
11
+ validate(config: PipelineConfig): ValidationResult;
12
+ private validateNode;
13
+ }
@@ -0,0 +1,11 @@
1
+ export interface PidStats {
2
+ cpu: number;
3
+ memory: number;
4
+ }
5
+ /**
6
+ * Get CPU% and memory RSS for one or more PIDs.
7
+ * Returns a map of pid → stats. Missing/dead PIDs are silently omitted.
8
+ */
9
+ export declare function getPidStats(pids: number | readonly number[]): Promise<ReadonlyMap<number, PidStats>>;
10
+ /** Get CPU% and memory RSS for a single PID. Returns null if dead. */
11
+ export declare function getSinglePidStats(pid: number): Promise<PidStats | null>;
@@ -0,0 +1,12 @@
1
+ import { IPythonEnvironment, PythonProbeResult, PythonEnvReady } from '@camstack/types';
2
+ import { ChildProcess } from 'node:child_process';
3
+ export declare class PythonEnvManager implements IPythonEnvironment {
4
+ private venvPath;
5
+ private cachedProbe;
6
+ constructor(dataDir: string);
7
+ probe(): Promise<PythonProbeResult>;
8
+ ensure(options: {
9
+ packages: readonly string[];
10
+ }): Promise<PythonEnvReady>;
11
+ spawn(script: string, args: readonly string[]): ChildProcess;
12
+ }
@@ -0,0 +1,31 @@
1
+ import { ReplResult } from '@camstack/types';
2
+ export interface ReplScope {
3
+ readonly type: 'system' | 'provider' | 'device' | 'addon';
4
+ readonly providerId?: string;
5
+ readonly deviceId?: number;
6
+ readonly addonId?: string;
7
+ }
8
+ export interface ReplSessionContext {
9
+ readonly scope: ReplScope;
10
+ /** Pre-populated variables available in the REPL session */
11
+ readonly variables: Record<string, unknown>;
12
+ }
13
+ export type { ReplResult };
14
+ export interface IReplEngine {
15
+ execute(code: string, context: ReplSessionContext): Promise<ReplResult>;
16
+ getCompletions(partial: string, context: ReplSessionContext): Promise<string[]>;
17
+ }
18
+ /**
19
+ * Context provider that the server kernel implements.
20
+ * The REPL engine calls this to build the sandbox for each scope type.
21
+ *
22
+ * Methods may return a Promise so the kernel can warm up async
23
+ * resources (e.g. `SystemManager.init()`) before exposing them — the
24
+ * engine awaits each before evaluating user code.
25
+ */
26
+ export interface IReplContextProvider {
27
+ getSystemSandbox(): Record<string, unknown> | Promise<Record<string, unknown>>;
28
+ getDeviceSandbox(deviceId: number): Record<string, unknown> | Promise<Record<string, unknown>>;
29
+ getProviderSandbox(providerId: string): Record<string, unknown> | Promise<Record<string, unknown>>;
30
+ getAddonSandbox(addonId: string): Record<string, unknown> | Promise<Record<string, unknown>>;
31
+ }
@@ -0,0 +1,8 @@
1
+ import { IReplEngine, IReplContextProvider, ReplSessionContext, ReplResult } from './interfaces.js';
2
+ export declare class ReplEngine implements IReplEngine {
3
+ private readonly contextProvider;
4
+ constructor(contextProvider: IReplContextProvider);
5
+ execute(code: string, context: ReplSessionContext): Promise<ReplResult>;
6
+ getCompletions(partial: string, context: ReplSessionContext): Promise<string[]>;
7
+ private buildSandbox;
8
+ }
@@ -0,0 +1,57 @@
1
+ import { r as __exportAll } from "./chunk-CNf5ZN-e.mjs";
2
+ import { execFile } from "node:child_process";
3
+ //#region src/process/resource-monitor.ts
4
+ var resource_monitor_exports = /* @__PURE__ */ __exportAll({
5
+ getPidStats: () => getPidStats,
6
+ getSinglePidStats: () => getSinglePidStats
7
+ });
8
+ function execPsForPids(pids) {
9
+ return new Promise((resolve, reject) => {
10
+ execFile("ps", [
11
+ "-o",
12
+ "pid=,pcpu=,rss=",
13
+ "-p",
14
+ pids.join(",")
15
+ ], { timeout: 5e3 }, (err, stdout) => {
16
+ if (err) return reject(err);
17
+ resolve(stdout);
18
+ });
19
+ });
20
+ }
21
+ function parsePsOutput(stdout) {
22
+ const result = /* @__PURE__ */ new Map();
23
+ for (const line of stdout.trim().split("\n")) {
24
+ const trimmed = line.trim();
25
+ if (!trimmed) continue;
26
+ const parts = trimmed.split(/\s+/);
27
+ if (parts.length < 3) continue;
28
+ const pid = parseInt(parts[0], 10);
29
+ const cpu = parseFloat(parts[1]);
30
+ const rssKb = parseInt(parts[2], 10);
31
+ if (isNaN(pid) || isNaN(cpu) || isNaN(rssKb)) continue;
32
+ result.set(pid, {
33
+ cpu: Math.round(cpu * 10) / 10,
34
+ memory: rssKb * 1024
35
+ });
36
+ }
37
+ return result;
38
+ }
39
+ /**
40
+ * Get CPU% and memory RSS for one or more PIDs.
41
+ * Returns a map of pid → stats. Missing/dead PIDs are silently omitted.
42
+ */
43
+ async function getPidStats(pids) {
44
+ const pidArray = typeof pids === "number" ? [pids] : [...pids];
45
+ if (pidArray.length === 0) return /* @__PURE__ */ new Map();
46
+ try {
47
+ return parsePsOutput(await execPsForPids(pidArray));
48
+ } catch {
49
+ return /* @__PURE__ */ new Map();
50
+ }
51
+ }
52
+ /** Get CPU% and memory RSS for a single PID. Returns null if dead. */
53
+ async function getSinglePidStats(pid) {
54
+ return (await getPidStats([pid])).get(pid) ?? null;
55
+ }
56
+ //#endregion
57
+ export { getSinglePidStats as n, resource_monitor_exports as r, getPidStats as t };
@@ -0,0 +1,74 @@
1
+ const require_chunk = require("./chunk-Cek0wNdY.js");
2
+ let node_child_process = require("node:child_process");
3
+ //#region src/process/resource-monitor.ts
4
+ var resource_monitor_exports = /* @__PURE__ */ require_chunk.__exportAll({
5
+ getPidStats: () => getPidStats,
6
+ getSinglePidStats: () => getSinglePidStats
7
+ });
8
+ function execPsForPids(pids) {
9
+ return new Promise((resolve, reject) => {
10
+ (0, node_child_process.execFile)("ps", [
11
+ "-o",
12
+ "pid=,pcpu=,rss=",
13
+ "-p",
14
+ pids.join(",")
15
+ ], { timeout: 5e3 }, (err, stdout) => {
16
+ if (err) return reject(err);
17
+ resolve(stdout);
18
+ });
19
+ });
20
+ }
21
+ function parsePsOutput(stdout) {
22
+ const result = /* @__PURE__ */ new Map();
23
+ for (const line of stdout.trim().split("\n")) {
24
+ const trimmed = line.trim();
25
+ if (!trimmed) continue;
26
+ const parts = trimmed.split(/\s+/);
27
+ if (parts.length < 3) continue;
28
+ const pid = parseInt(parts[0], 10);
29
+ const cpu = parseFloat(parts[1]);
30
+ const rssKb = parseInt(parts[2], 10);
31
+ if (isNaN(pid) || isNaN(cpu) || isNaN(rssKb)) continue;
32
+ result.set(pid, {
33
+ cpu: Math.round(cpu * 10) / 10,
34
+ memory: rssKb * 1024
35
+ });
36
+ }
37
+ return result;
38
+ }
39
+ /**
40
+ * Get CPU% and memory RSS for one or more PIDs.
41
+ * Returns a map of pid → stats. Missing/dead PIDs are silently omitted.
42
+ */
43
+ async function getPidStats(pids) {
44
+ const pidArray = typeof pids === "number" ? [pids] : [...pids];
45
+ if (pidArray.length === 0) return /* @__PURE__ */ new Map();
46
+ try {
47
+ return parsePsOutput(await execPsForPids(pidArray));
48
+ } catch {
49
+ return /* @__PURE__ */ new Map();
50
+ }
51
+ }
52
+ /** Get CPU% and memory RSS for a single PID. Returns null if dead. */
53
+ async function getSinglePidStats(pid) {
54
+ return (await getPidStats([pid])).get(pid) ?? null;
55
+ }
56
+ //#endregion
57
+ Object.defineProperty(exports, "getPidStats", {
58
+ enumerable: true,
59
+ get: function() {
60
+ return getPidStats;
61
+ }
62
+ });
63
+ Object.defineProperty(exports, "getSinglePidStats", {
64
+ enumerable: true,
65
+ get: function() {
66
+ return getSinglePidStats;
67
+ }
68
+ });
69
+ Object.defineProperty(exports, "resource_monitor_exports", {
70
+ enumerable: true,
71
+ get: function() {
72
+ return resource_monitor_exports;
73
+ }
74
+ });
@@ -0,0 +1,38 @@
1
+ //#region src/builtins/shared/settle-sources.ts
2
+ /** Reject with a timeout error if `p` hasn't settled within `ms`. */
3
+ async function withTimeout(p, ms, label) {
4
+ let timer;
5
+ const timeout = new Promise((_, reject) => {
6
+ timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`source '${label}' timed out after ${ms}ms`)), ms);
7
+ });
8
+ try {
9
+ return await Promise.race([p, timeout]);
10
+ } finally {
11
+ if (timer !== void 0) clearTimeout(timer);
12
+ }
13
+ }
14
+ function toError(err) {
15
+ return err instanceof Error ? err : new Error(String(err));
16
+ }
17
+ async function settleSourcesWithTimeout(entries, timeoutMs) {
18
+ return Promise.all(entries.map(async ([id, call]) => {
19
+ try {
20
+ return [id, {
21
+ ok: true,
22
+ value: await withTimeout(Promise.resolve().then(call), timeoutMs, id)
23
+ }];
24
+ } catch (err) {
25
+ return [id, {
26
+ ok: false,
27
+ error: toError(err)
28
+ }];
29
+ }
30
+ }));
31
+ }
32
+ //#endregion
33
+ Object.defineProperty(exports, "settleSourcesWithTimeout", {
34
+ enumerable: true,
35
+ get: function() {
36
+ return settleSourcesWithTimeout;
37
+ }
38
+ });
@@ -0,0 +1,33 @@
1
+ //#region src/builtins/shared/settle-sources.ts
2
+ /** Reject with a timeout error if `p` hasn't settled within `ms`. */
3
+ async function withTimeout(p, ms, label) {
4
+ let timer;
5
+ const timeout = new Promise((_, reject) => {
6
+ timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`source '${label}' timed out after ${ms}ms`)), ms);
7
+ });
8
+ try {
9
+ return await Promise.race([p, timeout]);
10
+ } finally {
11
+ if (timer !== void 0) clearTimeout(timer);
12
+ }
13
+ }
14
+ function toError(err) {
15
+ return err instanceof Error ? err : new Error(String(err));
16
+ }
17
+ async function settleSourcesWithTimeout(entries, timeoutMs) {
18
+ return Promise.all(entries.map(async ([id, call]) => {
19
+ try {
20
+ return [id, {
21
+ ok: true,
22
+ value: await withTimeout(Promise.resolve().then(call), timeoutMs, id)
23
+ }];
24
+ } catch (err) {
25
+ return [id, {
26
+ ok: false,
27
+ error: toError(err)
28
+ }];
29
+ }
30
+ }));
31
+ }
32
+ //#endregion
33
+ export { settleSourcesWithTimeout as t };
@@ -0,0 +1,40 @@
1
+ export interface IStorageBackend {
2
+ /** Backend type identifier */
3
+ readonly type: string;
4
+ /** Base path of this backend */
5
+ readonly basePath: string;
6
+ /** Resolve a subpath to an absolute path */
7
+ resolve(subpath: string): string;
8
+ /**
9
+ * Check whether the backend is usable: either the base directory
10
+ * already exists and is writable, OR we can create it on first
11
+ * write (i.e. the nearest existing ancestor is writable).
12
+ */
13
+ isAvailable(): boolean;
14
+ /** No-op for lazy backends. Kept for API compatibility. */
15
+ initialize(): Promise<void>;
16
+ }
17
+ /**
18
+ * Filesystem storage backend — lazy by design.
19
+ *
20
+ * `initialize()` does NOT create the base directory eagerly. Instead,
21
+ * consumers that write via `FilesystemStorageProvider` (and other write
22
+ * helpers in storage-manager.ts) run `fs.mkdir(dirname(filePath), { recursive: true })`
23
+ * right before every `writeFile`, so the directory tree appears on demand.
24
+ *
25
+ * The previous behaviour eagerly mkdir'd every location declared in
26
+ * `StorageLocationManager.initializeDefaults()` — six directories (`db`,
27
+ * `media`, `recordings`, `models`, `cache`, `logs`) got created at boot
28
+ * even if the installation had no cameras, no recording addon, no
29
+ * analytics addon, etc. That meant every fresh install looked like it
30
+ * was producing data when it had nothing to write. Laziness fixes that:
31
+ * a directory only exists once an addon decides to put a file there.
32
+ */
33
+ export declare class FsStorageBackend implements IStorageBackend {
34
+ readonly type = "local";
35
+ readonly basePath: string;
36
+ constructor(basePath: string);
37
+ resolve(subpath: string): string;
38
+ isAvailable(): boolean;
39
+ initialize(): Promise<void>;
40
+ }
@@ -0,0 +1,23 @@
1
+ import { IStorageBackend } from './fs-storage-backend.js';
2
+ export type StorageLocationName = 'data' | 'media' | 'recordings' | 'models' | 'cache' | 'logs';
3
+ export declare class StorageLocationManager {
4
+ private readonly backends;
5
+ private readonly dataPath;
6
+ constructor(dataPath: string);
7
+ /** Initialize all locations with default paths */
8
+ initializeDefaults(): Promise<void>;
9
+ /** Override a specific location's backend path */
10
+ setLocationPath(name: StorageLocationName, basePath: string): Promise<void>;
11
+ /** Get the backend for a location */
12
+ getBackend(name: StorageLocationName): IStorageBackend;
13
+ /** Resolve a path within a location */
14
+ resolve(location: StorageLocationName, subpath: string): string;
15
+ /** Check if all locations are available */
16
+ getStatus(): Array<{
17
+ name: StorageLocationName;
18
+ available: boolean;
19
+ path: string;
20
+ }>;
21
+ /** All location names */
22
+ getLocationNames(): StorageLocationName[];
23
+ }
@@ -0,0 +1,83 @@
1
+ import { StorageLocationManager, StorageLocationName } from './storage-location-manager.js';
2
+ import { IStorageProvider as INewStorageProvider, ISettingsBackend, HistogramBucket } from '@camstack/types';
3
+ export interface IStorageProvider {
4
+ initialize(): Promise<void>;
5
+ shutdown(): Promise<void>;
6
+ getLocation(name: StorageLocationName): IStorageLocation;
7
+ export?(locationName: StorageLocationName): Promise<Buffer>;
8
+ import?(locationName: StorageLocationName, data: Buffer): Promise<void>;
9
+ }
10
+ export interface QueryFilter {
11
+ where?: Record<string, unknown>;
12
+ whereIn?: Record<string, unknown[]>;
13
+ whereBetween?: Record<string, [unknown, unknown]>;
14
+ orderBy?: {
15
+ field: string;
16
+ direction: 'asc' | 'desc';
17
+ };
18
+ limit?: number;
19
+ offset?: number;
20
+ }
21
+ export interface StorageRecord {
22
+ collection: string;
23
+ id: string;
24
+ data: Record<string, unknown>;
25
+ }
26
+ export interface IStructuredStorage {
27
+ query(collection: string, filter?: QueryFilter): Promise<readonly StorageRecord[]>;
28
+ insert(record: StorageRecord): Promise<StorageRecord>;
29
+ update(collection: string, id: string, data: Record<string, unknown>): Promise<StorageRecord>;
30
+ delete(collection: string, id: string): Promise<void>;
31
+ count(collection: string, filter?: QueryFilter): Promise<number>;
32
+ histogram(input: {
33
+ collection: string;
34
+ field: string;
35
+ bucketSize: number;
36
+ origin: number;
37
+ filter?: QueryFilter;
38
+ }): Promise<readonly HistogramBucket[]>;
39
+ }
40
+ export interface IFileStorage {
41
+ readFile(path: string): Promise<Buffer>;
42
+ writeFile(path: string, data: Buffer): Promise<void>;
43
+ deleteFile(path: string): Promise<void>;
44
+ listFiles(prefix?: string): Promise<readonly string[]>;
45
+ getFileUrl(path: string): Promise<string>;
46
+ exists(path: string): Promise<boolean>;
47
+ }
48
+ export interface IStorageLocation {
49
+ structured?: IStructuredStorage;
50
+ files?: IFileStorage;
51
+ }
52
+ /**
53
+ * StorageManager — bridge between legacy code (getLocation/getLocationPath)
54
+ * and the new capability-based storage system.
55
+ *
56
+ * Legacy consumers call getLocation('addon', namespace) to get structured + file storage.
57
+ * This manager builds the response from:
58
+ * - SettingsBackend (for structured queries) — provided by sqlite-settings addon
59
+ * - LocationManager (for file paths) — set during Phase 2 boot
60
+ */
61
+ export declare class StorageManager {
62
+ private legacyProvider;
63
+ private locationManager;
64
+ private newStorageProvider;
65
+ private settingsBackend;
66
+ /** @deprecated Set by legacy capability consumer — use setNewStorageProvider instead */
67
+ setProvider(provider: IStorageProvider | INewStorageProvider): void;
68
+ setNewStorageProvider(provider: INewStorageProvider): void;
69
+ setSettingsBackend(backend: ISettingsBackend): void;
70
+ getSettingsBackend(): ISettingsBackend;
71
+ getProvider(): IStorageProvider;
72
+ setLocationManager(manager: StorageLocationManager): void;
73
+ getLocationManager(): StorageLocationManager;
74
+ initializeLocations(dataPath: string): Promise<void>;
75
+ getLocationPath(name: StorageLocationName): string;
76
+ /**
77
+ * Get a storage location with optional namespace scoping.
78
+ * Builds IStorageLocation from settingsBackend (structured) + locationManager (files).
79
+ */
80
+ getLocation(name: StorageLocationName | string, namespace?: string): IStorageLocation;
81
+ private createLegacyShim;
82
+ private createNamespacedLocation;
83
+ }