@camstack/types 0.1.14 → 0.1.16
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.
- package/dist/addon/base-addon.d.ts +262 -0
- package/dist/addon/base-addon.d.ts.map +1 -0
- package/dist/auth-records-BDg37fy9.mjs +8297 -0
- package/dist/auth-records-BDg37fy9.mjs.map +1 -0
- package/dist/auth-records-D5ZNaUos.js +8296 -0
- package/dist/auth-records-D5ZNaUos.js.map +1 -0
- package/dist/capabilities/accessories.cap.d.ts +42 -0
- package/dist/capabilities/accessories.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-pages-source.cap.d.ts +41 -0
- package/dist/capabilities/addon-pages-source.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-pages.cap.d.ts +36 -0
- package/dist/capabilities/addon-pages.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-routes.cap.d.ts +22 -0
- package/dist/capabilities/addon-routes.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-settings.cap.d.ts +170 -0
- package/dist/capabilities/addon-settings.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-widgets-source.cap.d.ts +103 -0
- package/dist/capabilities/addon-widgets-source.cap.d.ts.map +1 -0
- package/dist/capabilities/addon-widgets.cap.d.ts +98 -0
- package/dist/capabilities/addon-widgets.cap.d.ts.map +1 -0
- package/dist/capabilities/addons.cap.d.ts +356 -0
- package/dist/capabilities/addons.cap.d.ts.map +1 -0
- package/dist/capabilities/admin-ui.cap.d.ts +14 -0
- package/dist/capabilities/admin-ui.cap.d.ts.map +1 -0
- package/dist/capabilities/advanced-notifier.cap.d.ts +60 -0
- package/dist/capabilities/advanced-notifier.cap.d.ts.map +1 -0
- package/dist/capabilities/alerts.cap.d.ts +164 -0
- package/dist/capabilities/alerts.cap.d.ts.map +1 -0
- package/dist/capabilities/audio-analysis.cap.d.ts +46 -0
- package/dist/capabilities/audio-analysis.cap.d.ts.map +1 -0
- package/dist/capabilities/audio-analyzer.cap.d.ts +148 -0
- package/dist/capabilities/audio-analyzer.cap.d.ts.map +1 -0
- package/dist/capabilities/audio-codec.cap.d.ts +202 -0
- package/dist/capabilities/audio-codec.cap.d.ts.map +1 -0
- package/dist/capabilities/audio-metrics.cap.d.ts +174 -0
- package/dist/capabilities/audio-metrics.cap.d.ts.map +1 -0
- package/dist/capabilities/auth-provider.cap.d.ts +49 -0
- package/dist/capabilities/auth-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/authentication.cap.d.ts +83 -0
- package/dist/capabilities/authentication.cap.d.ts.map +1 -0
- package/dist/capabilities/backup.cap.d.ts +269 -0
- package/dist/capabilities/backup.cap.d.ts.map +1 -0
- package/dist/capabilities/battery.cap.d.ts +85 -0
- package/dist/capabilities/battery.cap.d.ts.map +1 -0
- package/dist/capabilities/brightness.cap.d.ts +64 -0
- package/dist/capabilities/brightness.cap.d.ts.map +1 -0
- package/dist/capabilities/camera-credentials.cap.d.ts +102 -0
- package/dist/capabilities/camera-credentials.cap.d.ts.map +1 -0
- package/dist/capabilities/camera-streams.cap.d.ts +214 -0
- package/dist/capabilities/camera-streams.cap.d.ts.map +1 -0
- package/dist/capabilities/capability-definition.d.ts +474 -0
- package/dist/capabilities/capability-definition.d.ts.map +1 -0
- package/dist/capabilities/custom-actions.d.ts +47 -0
- package/dist/capabilities/custom-actions.d.ts.map +1 -0
- package/dist/capabilities/decoder.cap.d.ts +173 -0
- package/dist/capabilities/decoder.cap.d.ts.map +1 -0
- package/dist/capabilities/detection-pipeline.cap.d.ts +34 -0
- package/dist/capabilities/detection-pipeline.cap.d.ts.map +1 -0
- package/dist/capabilities/device-discovery.cap.d.ts +247 -0
- package/dist/capabilities/device-discovery.cap.d.ts.map +1 -0
- package/dist/capabilities/device-manager.cap.d.ts +709 -0
- package/dist/capabilities/device-manager.cap.d.ts.map +1 -0
- package/dist/capabilities/device-ops.cap.d.ts +87 -0
- package/dist/capabilities/device-ops.cap.d.ts.map +1 -0
- package/dist/capabilities/device-provider.cap.d.ts +151 -0
- package/dist/capabilities/device-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/device-state.cap.d.ts +97 -0
- package/dist/capabilities/device-state.cap.d.ts.map +1 -0
- package/dist/capabilities/device-status.cap.d.ts +54 -0
- package/dist/capabilities/device-status.cap.d.ts.map +1 -0
- package/dist/capabilities/doorbell.cap.d.ts +62 -0
- package/dist/capabilities/doorbell.cap.d.ts.map +1 -0
- package/dist/capabilities/embedding-encoder.cap.d.ts +41 -0
- package/dist/capabilities/embedding-encoder.cap.d.ts.map +1 -0
- package/dist/capabilities/events.cap.d.ts +48 -0
- package/dist/capabilities/events.cap.d.ts.map +1 -0
- package/dist/capabilities/feature-probe.cap.d.ts +79 -0
- package/dist/capabilities/feature-probe.cap.d.ts.map +1 -0
- package/dist/capabilities/index.d.ts +191 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/integrations.cap.d.ts +182 -0
- package/dist/capabilities/integrations.cap.d.ts.map +1 -0
- package/dist/capabilities/intercom.cap.d.ts +108 -0
- package/dist/capabilities/intercom.cap.d.ts.map +1 -0
- package/dist/capabilities/local-network.cap.d.ts +216 -0
- package/dist/capabilities/local-network.cap.d.ts.map +1 -0
- package/dist/capabilities/log-destination.cap.d.ts +70 -0
- package/dist/capabilities/log-destination.cap.d.ts.map +1 -0
- package/dist/capabilities/mesh-network.cap.d.ts +160 -0
- package/dist/capabilities/mesh-network.cap.d.ts.map +1 -0
- package/dist/capabilities/mesh-orchestrator.cap.d.ts +96 -0
- package/dist/capabilities/mesh-orchestrator.cap.d.ts.map +1 -0
- package/dist/capabilities/metrics-provider.cap.d.ts +522 -0
- package/dist/capabilities/metrics-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/motion-detection.cap.d.ts +107 -0
- package/dist/capabilities/motion-detection.cap.d.ts.map +1 -0
- package/dist/capabilities/motion-trigger.cap.d.ts +78 -0
- package/dist/capabilities/motion-trigger.cap.d.ts.map +1 -0
- package/dist/capabilities/motion.cap.d.ts +122 -0
- package/dist/capabilities/motion.cap.d.ts.map +1 -0
- package/dist/capabilities/native-object-detection.cap.d.ts +127 -0
- package/dist/capabilities/native-object-detection.cap.d.ts.map +1 -0
- package/dist/capabilities/network-access.cap.d.ts +67 -0
- package/dist/capabilities/network-access.cap.d.ts.map +1 -0
- package/dist/capabilities/network-quality.cap.d.ts +95 -0
- package/dist/capabilities/network-quality.cap.d.ts.map +1 -0
- package/dist/capabilities/nodes.cap.d.ts +200 -0
- package/dist/capabilities/nodes.cap.d.ts.map +1 -0
- package/dist/capabilities/notification-output.cap.d.ts +44 -0
- package/dist/capabilities/notification-output.cap.d.ts.map +1 -0
- package/dist/capabilities/osd.cap.d.ts +236 -0
- package/dist/capabilities/osd.cap.d.ts.map +1 -0
- package/dist/capabilities/pipeline-analytics.cap.d.ts +501 -0
- package/dist/capabilities/pipeline-analytics.cap.d.ts.map +1 -0
- package/dist/capabilities/pipeline-executor.cap.d.ts +922 -0
- package/dist/capabilities/pipeline-executor.cap.d.ts.map +1 -0
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts +793 -0
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts.map +1 -0
- package/dist/capabilities/pipeline-runner.cap.d.ts +393 -0
- package/dist/capabilities/pipeline-runner.cap.d.ts.map +1 -0
- package/dist/capabilities/platform-probe.cap.d.ts +168 -0
- package/dist/capabilities/platform-probe.cap.d.ts.map +1 -0
- package/dist/capabilities/ptz-autotrack.cap.d.ts +188 -0
- package/dist/capabilities/ptz-autotrack.cap.d.ts.map +1 -0
- package/dist/capabilities/ptz.cap.d.ts +80 -0
- package/dist/capabilities/ptz.cap.d.ts.map +1 -0
- package/dist/capabilities/reboot.cap.d.ts +32 -0
- package/dist/capabilities/reboot.cap.d.ts.map +1 -0
- package/dist/capabilities/recording-engine.cap.d.ts +477 -0
- package/dist/capabilities/recording-engine.cap.d.ts.map +1 -0
- package/dist/capabilities/recording.cap.d.ts +43 -0
- package/dist/capabilities/recording.cap.d.ts.map +1 -0
- package/dist/capabilities/remote-access.cap.d.ts +103 -0
- package/dist/capabilities/remote-access.cap.d.ts.map +1 -0
- package/dist/capabilities/restreamer.cap.d.ts +51 -0
- package/dist/capabilities/restreamer.cap.d.ts.map +1 -0
- package/dist/capabilities/schemas/detection-shared.d.ts +63 -0
- package/dist/capabilities/schemas/detection-shared.d.ts.map +1 -0
- package/dist/capabilities/schemas/orchestrator-metrics.d.ts +44 -0
- package/dist/capabilities/schemas/orchestrator-metrics.d.ts.map +1 -0
- package/dist/capabilities/schemas/streaming-shared.d.ts +177 -0
- package/dist/capabilities/schemas/streaming-shared.d.ts.map +1 -0
- package/dist/capabilities/schemas/zone-rule.d.ts +74 -0
- package/dist/capabilities/schemas/zone-rule.d.ts.map +1 -0
- package/dist/capabilities/settings-store.cap.d.ts +198 -0
- package/dist/capabilities/settings-store.cap.d.ts.map +1 -0
- package/dist/capabilities/snapshot-provider.cap.d.ts +40 -0
- package/dist/capabilities/snapshot-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/snapshot.cap.d.ts +78 -0
- package/dist/capabilities/snapshot.cap.d.ts.map +1 -0
- package/dist/capabilities/storage-provider.cap.d.ts +432 -0
- package/dist/capabilities/storage-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/storage.cap.d.ts +367 -0
- package/dist/capabilities/storage.cap.d.ts.map +1 -0
- package/dist/capabilities/stream-broker.cap.d.ts +416 -0
- package/dist/capabilities/stream-broker.cap.d.ts.map +1 -0
- package/dist/capabilities/streaming-engine.cap.d.ts +58 -0
- package/dist/capabilities/streaming-engine.cap.d.ts.map +1 -0
- package/dist/capabilities/switch.cap.d.ts +66 -0
- package/dist/capabilities/switch.cap.d.ts.map +1 -0
- package/dist/capabilities/system.cap.d.ts +86 -0
- package/dist/capabilities/system.cap.d.ts.map +1 -0
- package/dist/capabilities/toast.cap.d.ts +56 -0
- package/dist/capabilities/toast.cap.d.ts.map +1 -0
- package/dist/capabilities/turn-orchestrator.cap.d.ts +74 -0
- package/dist/capabilities/turn-orchestrator.cap.d.ts.map +1 -0
- package/dist/capabilities/turn-provider.cap.d.ts +43 -0
- package/dist/capabilities/turn-provider.cap.d.ts.map +1 -0
- package/dist/capabilities/user-management.cap.d.ts +378 -0
- package/dist/capabilities/user-management.cap.d.ts.map +1 -0
- package/dist/capabilities/webrtc-session.cap.d.ts +181 -0
- package/dist/capabilities/webrtc-session.cap.d.ts.map +1 -0
- package/dist/capabilities/webrtc.cap.d.ts +72 -0
- package/dist/capabilities/webrtc.cap.d.ts.map +1 -0
- package/dist/capabilities/zone-analytics.cap.d.ts +213 -0
- package/dist/capabilities/zone-analytics.cap.d.ts.map +1 -0
- package/dist/capabilities/zone-rules.cap.d.ts +129 -0
- package/dist/capabilities/zone-rules.cap.d.ts.map +1 -0
- package/dist/capabilities/zones.cap.d.ts +151 -0
- package/dist/capabilities/zones.cap.d.ts.map +1 -0
- package/dist/catalogs/audio-classmap.d.ts +16 -0
- package/dist/catalogs/audio-classmap.d.ts.map +1 -0
- package/dist/catalogs/coco-classmap.d.ts.map +1 -1
- package/dist/constants.d.ts +50 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/deps/binary-downloader.d.ts +41 -0
- package/dist/deps/binary-downloader.d.ts.map +1 -0
- package/dist/deps/ffmpeg-downloader.d.ts +13 -0
- package/dist/deps/ffmpeg-downloader.d.ts.map +1 -0
- package/dist/deps/index.d.ts +4 -0
- package/dist/deps/index.d.ts.map +1 -0
- package/dist/deps/python-downloader.d.ts +34 -0
- package/dist/deps/python-downloader.d.ts.map +1 -0
- package/dist/device/accessory.d.ts +62 -0
- package/dist/device/accessory.d.ts.map +1 -0
- package/dist/device/base-device-provider.d.ts +178 -0
- package/dist/device/base-device-provider.d.ts.map +1 -0
- package/dist/device/base-device.d.ts +287 -0
- package/dist/device/base-device.d.ts.map +1 -0
- package/dist/device/camera-device.d.ts +49 -0
- package/dist/device/camera-device.d.ts.map +1 -0
- package/dist/device/device-binding.d.ts +23 -0
- package/dist/device/device-binding.d.ts.map +1 -0
- package/dist/device/device-config.d.ts +65 -0
- package/dist/device/device-config.d.ts.map +1 -0
- package/dist/device/device-context.d.ts +256 -0
- package/dist/device/device-context.d.ts.map +1 -0
- package/dist/device/device-management.d.ts +118 -0
- package/dist/device/device-management.d.ts.map +1 -0
- package/dist/device/device-profile.d.ts +161 -0
- package/dist/device/device-profile.d.ts.map +1 -0
- package/dist/device/device-runtime-state.d.ts +124 -0
- package/dist/device/device-runtime-state.d.ts.map +1 -0
- package/dist/device/device-state-handle.d.ts +161 -0
- package/dist/device/device-state-handle.d.ts.map +1 -0
- package/dist/device/device-type.d.ts +68 -0
- package/dist/device/device-type.d.ts.map +1 -0
- package/dist/device/device.d.ts +87 -0
- package/dist/device/device.d.ts.map +1 -0
- package/dist/device/features.d.ts +29 -0
- package/dist/device/features.d.ts.map +1 -0
- package/dist/device/index.d.ts +20 -0
- package/dist/device/index.d.ts.map +1 -0
- package/dist/device/runtime-state-helpers.d.ts +69 -0
- package/dist/device/runtime-state-helpers.d.ts.map +1 -0
- package/dist/device/system-mirror.d.ts +318 -0
- package/dist/device/system-mirror.d.ts.map +1 -0
- package/dist/device/zod-to-config-ui.d.ts +23 -0
- package/dist/device/zod-to-config-ui.d.ts.map +1 -0
- package/dist/disposer-chain.d.ts +32 -0
- package/dist/disposer-chain.d.ts.map +1 -0
- package/dist/enums/event-category.d.ts +361 -0
- package/dist/enums/event-category.d.ts.map +1 -0
- package/dist/enums/event-source-type.d.ts +8 -0
- package/dist/enums/event-source-type.d.ts.map +1 -0
- package/dist/enums/index.d.ts +3 -0
- package/dist/enums/index.d.ts.map +1 -0
- package/dist/generated/addon-api.d.ts +14604 -3217
- package/dist/generated/addon-api.d.ts.map +1 -1
- package/dist/generated/cap-status-types.d.ts +51 -0
- package/dist/generated/cap-status-types.d.ts.map +1 -0
- package/dist/generated/capability-router-map.d.ts +278 -0
- package/dist/generated/capability-router-map.d.ts.map +1 -0
- package/dist/generated/device-local-state.d.ts +82 -0
- package/dist/generated/device-local-state.d.ts.map +1 -0
- package/dist/generated/device-proxy.d.ts +146 -0
- package/dist/generated/device-proxy.d.ts.map +1 -0
- package/dist/generated/system-proxy.d.ts +92 -0
- package/dist/generated/system-proxy.d.ts.map +1 -0
- package/dist/helpers/bind-addon-actions.d.ts +19 -0
- package/dist/helpers/bind-addon-actions.d.ts.map +1 -0
- package/dist/index.d.ts +91 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4843 -477
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4832 -415
- package/dist/index.mjs.map +1 -1
- package/dist/interfaces/addon.d.ts +760 -132
- package/dist/interfaces/addon.d.ts.map +1 -1
- package/dist/interfaces/advanced-notifier.d.ts +3 -2
- package/dist/interfaces/advanced-notifier.d.ts.map +1 -1
- package/dist/interfaces/agent-protocol.d.ts +17 -173
- package/dist/interfaces/agent-protocol.d.ts.map +1 -1
- package/dist/interfaces/agent.d.ts +61 -0
- package/dist/interfaces/agent.d.ts.map +1 -1
- package/dist/interfaces/alerts.d.ts +14 -0
- package/dist/interfaces/alerts.d.ts.map +1 -0
- package/dist/interfaces/analysis-persistence.d.ts +37 -19
- package/dist/interfaces/analysis-persistence.d.ts.map +1 -1
- package/dist/interfaces/analysis.d.ts +33 -4
- package/dist/interfaces/analysis.d.ts.map +1 -1
- package/dist/interfaces/api-responses.d.ts +124 -0
- package/dist/interfaces/api-responses.d.ts.map +1 -0
- package/dist/interfaces/api-shared.d.ts +5 -79
- package/dist/interfaces/api-shared.d.ts.map +1 -1
- package/dist/interfaces/audio-analyzer.d.ts +49 -0
- package/dist/interfaces/audio-analyzer.d.ts.map +1 -0
- package/dist/interfaces/audio-codec.d.ts +123 -0
- package/dist/interfaces/audio-codec.d.ts.map +1 -0
- package/dist/interfaces/audio-inference-engine.d.ts +19 -0
- package/dist/interfaces/audio-inference-engine.d.ts.map +1 -0
- package/dist/interfaces/auth-provider.d.ts.map +1 -1
- package/dist/interfaces/auth.d.ts +4 -25
- package/dist/interfaces/auth.d.ts.map +1 -1
- package/dist/interfaces/camera-pipeline.d.ts +7 -20
- package/dist/interfaces/camera-pipeline.d.ts.map +1 -1
- package/dist/interfaces/capability.d.ts +171 -24
- package/dist/interfaces/capability.d.ts.map +1 -1
- package/dist/interfaces/config-ui.d.ts +746 -24
- package/dist/interfaces/config-ui.d.ts.map +1 -1
- package/dist/interfaces/context.d.ts +9 -4
- package/dist/interfaces/context.d.ts.map +1 -1
- package/dist/interfaces/decoder.d.ts +38 -3
- package/dist/interfaces/decoder.d.ts.map +1 -1
- package/dist/interfaces/detection-addon.d.ts +6 -6
- package/dist/interfaces/detection-addon.d.ts.map +1 -1
- package/dist/interfaces/device-capabilities/camera.d.ts +95 -18
- package/dist/interfaces/device-capabilities/camera.d.ts.map +1 -1
- package/dist/interfaces/device-capabilities/index.d.ts +0 -13
- package/dist/interfaces/device-capabilities/index.d.ts.map +1 -1
- package/dist/interfaces/device-provider.d.ts +18 -16
- package/dist/interfaces/device-provider.d.ts.map +1 -1
- package/dist/interfaces/device.d.ts +4 -21
- package/dist/interfaces/device.d.ts.map +1 -1
- package/dist/interfaces/embedding-encoder.d.ts +19 -0
- package/dist/interfaces/embedding-encoder.d.ts.map +1 -0
- package/dist/interfaces/engine-slots.d.ts +10 -0
- package/dist/interfaces/engine-slots.d.ts.map +1 -0
- package/dist/interfaces/event-bus.d.ts +710 -26
- package/dist/interfaces/event-bus.d.ts.map +1 -1
- package/dist/interfaces/inference-capabilities.d.ts +0 -17
- package/dist/interfaces/inference-capabilities.d.ts.map +1 -1
- package/dist/interfaces/inference-engine.d.ts +30 -10
- package/dist/interfaces/inference-engine.d.ts.map +1 -1
- package/dist/interfaces/integration-registry.d.ts +20 -20
- package/dist/interfaces/integration-registry.d.ts.map +1 -1
- package/dist/interfaces/kernel-abstractions.d.ts +83 -0
- package/dist/interfaces/kernel-abstractions.d.ts.map +1 -0
- package/dist/interfaces/logging.d.ts +89 -8
- package/dist/interfaces/logging.d.ts.map +1 -1
- package/dist/interfaces/metrics-provider.d.ts +17 -0
- package/dist/interfaces/metrics-provider.d.ts.map +1 -0
- package/dist/interfaces/network-quality.d.ts +4 -4
- package/dist/interfaces/network.d.ts +0 -16
- package/dist/interfaces/network.d.ts.map +1 -1
- package/dist/interfaces/notification.d.ts +1 -1
- package/dist/interfaces/pipeline-executor-capability.d.ts +200 -0
- package/dist/interfaces/pipeline-executor-capability.d.ts.map +1 -0
- package/dist/interfaces/pipeline-orchestrator-capability.d.ts +165 -0
- package/dist/interfaces/pipeline-orchestrator-capability.d.ts.map +1 -0
- package/dist/interfaces/pipeline-runner-capability.d.ts +147 -0
- package/dist/interfaces/pipeline-runner-capability.d.ts.map +1 -0
- package/dist/interfaces/pipeline-runner.d.ts +18 -2
- package/dist/interfaces/pipeline-runner.d.ts.map +1 -1
- package/dist/interfaces/platform.d.ts +1 -1
- package/dist/interfaces/platform.d.ts.map +1 -1
- package/dist/interfaces/queryable.d.ts +26 -0
- package/dist/interfaces/queryable.d.ts.map +1 -0
- package/dist/interfaces/raw-tensor-engine.d.ts +16 -0
- package/dist/interfaces/raw-tensor-engine.d.ts.map +1 -0
- package/dist/interfaces/readiness.d.ts +101 -0
- package/dist/interfaces/readiness.d.ts.map +1 -0
- package/dist/interfaces/repl.d.ts +1 -1
- package/dist/interfaces/restreamer.d.ts +3 -3
- package/dist/interfaces/scoped-token.d.ts +1 -21
- package/dist/interfaces/scoped-token.d.ts.map +1 -1
- package/dist/interfaces/server-analysis.d.ts +30 -87
- package/dist/interfaces/server-analysis.d.ts.map +1 -1
- package/dist/interfaces/storage-location.d.ts +120 -0
- package/dist/interfaces/storage-location.d.ts.map +1 -0
- package/dist/interfaces/storage.d.ts +124 -50
- package/dist/interfaces/storage.d.ts.map +1 -1
- package/dist/interfaces/stream-broker.d.ts +285 -17
- package/dist/interfaces/stream-broker.d.ts.map +1 -1
- package/dist/interfaces/webrtc-provider.d.ts +24 -0
- package/dist/interfaces/webrtc-provider.d.ts.map +1 -1
- package/dist/node.d.ts +6 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +481 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +443 -0
- package/dist/node.mjs.map +1 -0
- package/dist/readiness/index.d.ts +3 -0
- package/dist/readiness/index.d.ts.map +1 -0
- package/dist/readiness/readiness-registry.d.ts +183 -0
- package/dist/readiness/readiness-registry.d.ts.map +1 -0
- package/dist/schemas/auth-records.d.ts +81 -0
- package/dist/schemas/auth-records.d.ts.map +1 -0
- package/dist/storage/filesystem-storage-provider.d.ts +37 -0
- package/dist/storage/filesystem-storage-provider.d.ts.map +1 -0
- package/dist/types/agent-pipeline-settings.d.ts +94 -0
- package/dist/types/agent-pipeline-settings.d.ts.map +1 -0
- package/dist/types/camera-pipeline.d.ts +58 -0
- package/dist/types/camera-pipeline.d.ts.map +1 -0
- package/dist/types/detection.d.ts +195 -38
- package/dist/types/detection.d.ts.map +1 -1
- package/dist/types/device-type.d.ts +4 -0
- package/dist/types/device-type.d.ts.map +1 -1
- package/dist/types/engine-output.d.ts +24 -0
- package/dist/types/engine-output.d.ts.map +1 -0
- package/dist/types/io.d.ts +57 -3
- package/dist/types/io.d.ts.map +1 -1
- package/dist/types/models.d.ts +3 -1
- package/dist/types/models.d.ts.map +1 -1
- package/dist/types/pipeline-schema.d.ts +15 -72
- package/dist/types/pipeline-schema.d.ts.map +1 -1
- package/dist/types/pipeline-step.d.ts +201 -0
- package/dist/types/pipeline-step.d.ts.map +1 -0
- package/dist/types/pipeline.d.ts +24 -1
- package/dist/types/pipeline.d.ts.map +1 -1
- package/dist/utils/element-config-store.d.ts +29 -0
- package/dist/utils/element-config-store.d.ts.map +1 -0
- package/dist/utils/err-msg.d.ts +7 -0
- package/dist/utils/err-msg.d.ts.map +1 -0
- package/dist/utils/json-safe.d.ts +33 -0
- package/dist/utils/json-safe.d.ts.map +1 -0
- package/dist/utils/mask-url.d.ts +10 -0
- package/dist/utils/mask-url.d.ts.map +1 -0
- package/dist/utils/ring-buffer.d.ts +16 -0
- package/dist/utils/ring-buffer.d.ts.map +1 -0
- package/dist/utils/run-inference-step.d.ts +26 -0
- package/dist/utils/run-inference-step.d.ts.map +1 -0
- package/dist/utils/runtime-mapping.d.ts +88 -0
- package/dist/utils/runtime-mapping.d.ts.map +1 -0
- package/dist/utils/zone-rule-eval.d.ts +47 -0
- package/dist/utils/zone-rule-eval.d.ts.map +1 -0
- package/package.json +11 -2
- package/dist/__tests__/addon-capability-provider.test.d.ts +0 -2
- package/dist/__tests__/addon-capability-provider.test.d.ts.map +0 -1
- package/dist/__tests__/addon-declaration.test.d.ts +0 -2
- package/dist/__tests__/addon-declaration.test.d.ts.map +0 -1
- package/dist/__tests__/capability.test.d.ts +0 -2
- package/dist/__tests__/capability.test.d.ts.map +0 -1
- package/dist/interfaces/addon-i18n.d.ts +0 -41
- package/dist/interfaces/addon-i18n.d.ts.map +0 -1
- package/dist/interfaces/classifier.d.ts +0 -8
- package/dist/interfaces/classifier.d.ts.map +0 -1
- package/dist/interfaces/cropper.d.ts +0 -8
- package/dist/interfaces/cropper.d.ts.map +0 -1
- package/dist/interfaces/detector.d.ts +0 -8
- package/dist/interfaces/detector.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/accessory.d.ts +0 -14
- package/dist/interfaces/device-capabilities/accessory.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/audio-detector.d.ts +0 -12
- package/dist/interfaces/device-capabilities/audio-detector.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/doorbell.d.ts +0 -10
- package/dist/interfaces/device-capabilities/doorbell.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/events.d.ts +0 -47
- package/dist/interfaces/device-capabilities/events.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/motion-sensor.d.ts +0 -7
- package/dist/interfaces/device-capabilities/motion-sensor.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/native-detection.d.ts +0 -14
- package/dist/interfaces/device-capabilities/native-detection.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/object-detector.d.ts +0 -59
- package/dist/interfaces/device-capabilities/object-detector.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/pan-tilt-zoom.d.ts +0 -29
- package/dist/interfaces/device-capabilities/pan-tilt-zoom.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/recording.d.ts +0 -18
- package/dist/interfaces/device-capabilities/recording.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/siren.d.ts +0 -8
- package/dist/interfaces/device-capabilities/siren.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/status-light.d.ts +0 -7
- package/dist/interfaces/device-capabilities/status-light.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/switch.d.ts +0 -8
- package/dist/interfaces/device-capabilities/switch.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/two-way-audio.d.ts +0 -8
- package/dist/interfaces/device-capabilities/two-way-audio.d.ts.map +0 -1
- package/dist/interfaces/device-capability.d.ts +0 -14
- package/dist/interfaces/device-capability.d.ts.map +0 -1
- package/dist/interfaces/model-catalog.d.ts +0 -25
- package/dist/interfaces/model-catalog.d.ts.map +0 -1
- package/dist/interfaces/refiner.d.ts +0 -8
- package/dist/interfaces/refiner.d.ts.map +0 -1
- package/dist/interfaces/repositories.d.ts +0 -20
- package/dist/interfaces/repositories.d.ts.map +0 -1
- package/dist/interfaces/scene-intelligence.d.ts +0 -21
- package/dist/interfaces/scene-intelligence.d.ts.map +0 -1
- package/dist/interfaces/storage-backend.d.ts +0 -27
- package/dist/interfaces/storage-backend.d.ts.map +0 -1
- package/dist/interfaces/worker-protocol.d.ts +0 -110
- package/dist/interfaces/worker-protocol.d.ts.map +0 -1
- package/dist/schemas/system-settings-schemas.d.ts +0 -27
- package/dist/schemas/system-settings-schemas.d.ts.map +0 -1
- package/dist/types/benchmark.d.ts +0 -112
- package/dist/types/benchmark.d.ts.map +0 -1
- package/dist/types/zones.d.ts +0 -48
- package/dist/types/zones.d.ts.map +0 -1
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
import type { PipelineSlot } from '../types/pipeline.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { IAddonRouter } from './router.js';
|
|
4
|
-
import type { INetworkProvider } from './network.js';
|
|
2
|
+
import type { ConfigUISchemaWithValues, FieldProbeResult } from './config-ui.js';
|
|
5
3
|
import type { IScopedLogger } from './logging.js';
|
|
6
|
-
import type { IEventBus } from './event-bus.js';
|
|
7
|
-
import type {
|
|
8
|
-
import type { CapabilityDeclaration
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
4
|
+
import type { IEventBus, ReadinessScope } from './event-bus.js';
|
|
5
|
+
import type { ICapabilityHandle } from './readiness.js';
|
|
6
|
+
import type { CapabilityDeclaration } from './capability.js';
|
|
7
|
+
import type { ICapabilityRegistry } from './kernel-abstractions.js';
|
|
8
|
+
import type { CapabilityDefinition, InferProvider } from '../capabilities/capability-definition.js';
|
|
9
|
+
import type { CustomActionsSpec } from '../capabilities/custom-actions.js';
|
|
10
|
+
import type { z } from 'zod';
|
|
11
|
+
/** Sub-process info (inlined from deleted worker-protocol.ts) */
|
|
12
|
+
export interface SubProcessInfo {
|
|
13
|
+
readonly pid: number;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly command: string;
|
|
16
|
+
readonly state: 'running' | 'stopped' | 'crashed';
|
|
17
|
+
readonly cpuPercent: number;
|
|
18
|
+
readonly memoryRss: number;
|
|
19
|
+
readonly uptimeSeconds: number;
|
|
20
|
+
}
|
|
21
|
+
/** Worker process stats (inlined from deleted worker-protocol.ts) */
|
|
22
|
+
export interface WorkerProcessStats {
|
|
23
|
+
readonly pid: number;
|
|
24
|
+
readonly cpuPercent: number;
|
|
25
|
+
readonly memoryRss: number;
|
|
26
|
+
readonly heapUsed?: number;
|
|
27
|
+
readonly uptimeSeconds: number;
|
|
28
|
+
readonly restartCount: number;
|
|
29
|
+
readonly state: 'starting' | 'running' | 'stopping' | 'stopped' | 'crashed';
|
|
30
|
+
}
|
|
12
31
|
/** Storage interface for addon file operations */
|
|
13
32
|
export interface IAddonFileStorage {
|
|
14
33
|
readFile(path: string): Promise<Buffer>;
|
|
@@ -17,83 +36,11 @@ export interface IAddonFileStorage {
|
|
|
17
36
|
listFiles(prefix?: string): Promise<readonly string[]>;
|
|
18
37
|
exists(path: string): Promise<boolean>;
|
|
19
38
|
}
|
|
20
|
-
/** Storage interface for addon structured data (DB) */
|
|
21
|
-
export interface IAddonStructuredStorage {
|
|
22
|
-
query(collection: string, filter?: Record<string, unknown>): Promise<readonly unknown[]>;
|
|
23
|
-
insert(collection: string, data: Record<string, unknown>): Promise<void>;
|
|
24
|
-
update(collection: string, id: string, data: Record<string, unknown>): Promise<void>;
|
|
25
|
-
delete(collection: string, id: string): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
/** Named file storage locations available to addons */
|
|
28
|
-
export type AddonFileLocationName = 'data' | 'media' | 'recordings' | 'models' | 'cache' | 'logs';
|
|
29
|
-
/** Named structured storage locations available to addons */
|
|
30
|
-
export type AddonStructuredLocationName = 'data' | 'events' | 'config';
|
|
31
|
-
/** Combined storage location name (union of file and structured) */
|
|
32
|
-
export type AddonStorageLocationName = AddonFileLocationName | AddonStructuredLocationName;
|
|
33
|
-
/** Storage access for addons -- replaces raw AddonLocationPaths */
|
|
34
|
-
export interface AddonStorageLocations {
|
|
35
|
-
/** Get file storage for a named location */
|
|
36
|
-
getFiles(location: AddonFileLocationName): IAddonFileStorage;
|
|
37
|
-
/** Get structured storage (DB) for a named location */
|
|
38
|
-
getStructured(location: AddonStructuredLocationName): IAddonStructuredStorage;
|
|
39
|
-
}
|
|
40
|
-
export type AddonCapability = 'storage' | 'backup' | 'log-destination' | 'device-exporter' | 'network-access' | 'turn-provider' | 'webrtc-provider' | 'remote-access' | 'recording-engine' | 'notification-output' | 'streaming-engine' | 'pipeline-consumer' | 'detection-engine' | 'object-detector' | 'motion-analyzer' | 'sub-detector' | 'face-detector' | 'plate-detector' | 'recognizer' | 'face-recognizer' | 'plate-recognizer' | 'audio-classifier' | 'device-provider' | 'stream-broker' | 'analysis-data-persistence' | 'analysis-pipeline';
|
|
41
39
|
export interface RequiredStep {
|
|
42
40
|
readonly slot: PipelineSlot;
|
|
43
41
|
readonly outputClasses: readonly string[];
|
|
44
42
|
readonly description: string;
|
|
45
43
|
}
|
|
46
|
-
export interface AddonManifest {
|
|
47
|
-
readonly id: string;
|
|
48
|
-
readonly name: string;
|
|
49
|
-
readonly version: string;
|
|
50
|
-
readonly description?: string;
|
|
51
|
-
/** Relative path to SVG icon asset within the addon package */
|
|
52
|
-
readonly icon?: string;
|
|
53
|
-
/** Brand hex color for UI display (e.g., "#3b82f6") */
|
|
54
|
-
readonly color?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Whether multiple instances of this provider can be created.
|
|
57
|
-
* 'unique' — only one instance allowed (e.g., RTSP, ONVIF)
|
|
58
|
-
* 'multiple' — user can create N instances (e.g., Frigate, Scrypted)
|
|
59
|
-
* Default: 'multiple'
|
|
60
|
-
*/
|
|
61
|
-
readonly instanceMode?: 'unique' | 'multiple';
|
|
62
|
-
/** Whether this addon is protected (required by the system, cannot be uninstalled) */
|
|
63
|
-
readonly protected?: boolean;
|
|
64
|
-
readonly packageName?: string;
|
|
65
|
-
readonly capabilities?: readonly (AddonCapability | {
|
|
66
|
-
name: string;
|
|
67
|
-
mode: string;
|
|
68
|
-
})[];
|
|
69
|
-
readonly requiredFeatures?: readonly string[];
|
|
70
|
-
readonly slot?: PipelineSlot;
|
|
71
|
-
readonly inputClasses?: readonly string[];
|
|
72
|
-
readonly outputClasses?: readonly string[];
|
|
73
|
-
readonly requiredSteps?: readonly RequiredStep[];
|
|
74
|
-
readonly supportsCustomModels?: boolean;
|
|
75
|
-
readonly mayRequirePython?: boolean;
|
|
76
|
-
readonly defaultConfig?: Readonly<Record<string, unknown>>;
|
|
77
|
-
/** Whether this addon performs active inference with models.
|
|
78
|
-
* Passive addons (e.g. motion-detection) set this to false
|
|
79
|
-
* and are excluded from the inference pipeline schema. Default: true. */
|
|
80
|
-
readonly passive?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Label output type — declares what kind of label this addon produces
|
|
83
|
-
* when used as a classifier/recognizer in the pipeline.
|
|
84
|
-
* Used to tag LabelData.origin so the UI can render labels appropriately.
|
|
85
|
-
*/
|
|
86
|
-
readonly labelOutputType?: import('../types/detection.js').LabelOrigin;
|
|
87
|
-
}
|
|
88
|
-
/** @deprecated Use IStorageProvider.resolve() instead of raw paths */
|
|
89
|
-
export interface AddonLocationPaths {
|
|
90
|
-
readonly data: string;
|
|
91
|
-
readonly media: string;
|
|
92
|
-
readonly recordings: string;
|
|
93
|
-
readonly models: string;
|
|
94
|
-
readonly logs: string;
|
|
95
|
-
readonly cache: string;
|
|
96
|
-
}
|
|
97
44
|
/**
|
|
98
45
|
* Minimal model-management API exposed to addons via AddonContext.
|
|
99
46
|
*/
|
|
@@ -106,8 +53,6 @@ export interface IAddonModelManager {
|
|
|
106
53
|
getModelsDir(): string;
|
|
107
54
|
/** Check if a model is already downloaded. */
|
|
108
55
|
isDownloaded(modelId: string, format?: import('../types/models.js').ModelFormat): boolean;
|
|
109
|
-
/** @deprecated Use ensure() instead. Legacy API kept for backward compatibility. */
|
|
110
|
-
downloadModel(id: string): Promise<string>;
|
|
111
56
|
}
|
|
112
57
|
/** Process management for addon sub-processes (ffmpeg, python, etc.) */
|
|
113
58
|
export interface IAddonProcessManager {
|
|
@@ -158,6 +103,13 @@ export interface IAddonDepsManager {
|
|
|
158
103
|
ensurePython(): Promise<string | null>;
|
|
159
104
|
/** Install Python packages in the managed Python environment */
|
|
160
105
|
installPythonPackages(packages: readonly string[]): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Install a pip requirements file into the embedded Python.
|
|
108
|
+
* Idempotent: keyed on (file basename + sha256 of contents). Marker
|
|
109
|
+
* lives under the python install dir so re-downloading python wipes
|
|
110
|
+
* everything together.
|
|
111
|
+
*/
|
|
112
|
+
installPythonRequirements(requirementsFile: string): Promise<void>;
|
|
161
113
|
/** Get the deps directory path */
|
|
162
114
|
getDepsDir(): string;
|
|
163
115
|
}
|
|
@@ -176,67 +128,531 @@ export interface IAddonDepsManager {
|
|
|
176
128
|
*
|
|
177
129
|
* To regenerate after changing routers: npx tsx scripts/generate-api-types.ts
|
|
178
130
|
*/
|
|
179
|
-
|
|
131
|
+
/**
|
|
132
|
+
* A capability provider binding returned from `ICamstackAddon.initialize()`.
|
|
133
|
+
* The kernel registers each entry in the CapabilityRegistry after init completes.
|
|
134
|
+
*/
|
|
135
|
+
export interface ProviderRegistration<TCap extends CapabilityDefinition = CapabilityDefinition> {
|
|
136
|
+
/** Capability definition this provider implements. Read `capability.name` to look up by name. */
|
|
137
|
+
readonly capability: TCap;
|
|
138
|
+
/**
|
|
139
|
+
* The provider object implementing the capability interface.
|
|
140
|
+
*
|
|
141
|
+
* - With a specific `TCap` (e.g. `ProviderRegistration<typeof metricsProviderCapability>`)
|
|
142
|
+
* the provider is strictly checked against `InferProvider<TCap>`.
|
|
143
|
+
* - With the default `TCap = CapabilityDefinition` (used by heterogeneous arrays like
|
|
144
|
+
* `ProviderRegistration[]` returned from `onInitialize()`) the provider is typed as
|
|
145
|
+
* `object`: a mapped type over the default `Record<string, CapabilityMethodSchema>`
|
|
146
|
+
* collapses to an index signature that class instances cannot satisfy structurally.
|
|
147
|
+
* The runtime capability router enforces the contract; the strict compile-time check
|
|
148
|
+
* is applied at the specific-cap boundary (ProviderRegistration<typeof xxxCap>) instead.
|
|
149
|
+
*/
|
|
150
|
+
readonly provider: CapabilityDefinition extends TCap ? object : InferProvider<TCap>;
|
|
151
|
+
/** 'native' (default) — absolute provider.
|
|
152
|
+
* 'wrapper' — user-toggleable decorator that delegates to a native via `ctx.getNativeProvider`. */
|
|
153
|
+
readonly kind?: 'native' | 'wrapper';
|
|
154
|
+
/** Wrapper only — active by default for every compatible device. */
|
|
155
|
+
readonly defaultActive?: boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Return value of `ICamstackAddon.initialize()`. Both sections are optional —
|
|
159
|
+
* addons that provide only capabilities omit `customActions`; addons that only
|
|
160
|
+
* expose actions omit `providers`; pure consumers may return void.
|
|
161
|
+
*/
|
|
162
|
+
export interface AddonInitResult<TCatalog extends CustomActionsSpec = CustomActionsSpec> {
|
|
163
|
+
readonly providers?: readonly ProviderRegistration[];
|
|
164
|
+
readonly customActions?: TCatalog;
|
|
165
|
+
/**
|
|
166
|
+
* Required iff `customActions` is set. One async handler per catalog entry —
|
|
167
|
+
* a typed dispatch map rather than a single generic function so that each
|
|
168
|
+
* handler's input/output types collapse to the concrete `z.infer<...>` of
|
|
169
|
+
* its schema at the provider site (TypeScript cannot unify the output of a
|
|
170
|
+
* generic `<K>(action: K, input) => Promise<...>` signature with a concrete
|
|
171
|
+
* per-action return type, so the map form is strictly more typeable).
|
|
172
|
+
*/
|
|
173
|
+
readonly actionHandlers?: {
|
|
174
|
+
readonly [K in keyof TCatalog & string]: (input: z.infer<TCatalog[K]['input']>) => Promise<z.infer<TCatalog[K]['output']>>;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Infrastructure services injected by the kernel at boot time.
|
|
179
|
+
* Grouped under `ctx.kernel` to separate kernel plumbing from
|
|
180
|
+
* addon-level concerns (logger, settings, devices, api).
|
|
181
|
+
*/
|
|
182
|
+
export interface IKernelServices {
|
|
183
|
+
/**
|
|
184
|
+
* The Moleculer nodeID for this process (e.g. `'hub'` on the hub, or the
|
|
185
|
+
* agent's own name on remote nodes). Addons use this to distinguish local
|
|
186
|
+
* dispatch from remote dispatch without a direct Moleculer dependency.
|
|
187
|
+
*/
|
|
188
|
+
readonly localNodeId?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Local storage provider — direct filesystem access with zero serialization.
|
|
191
|
+
* Use for file I/O (write/read with Buffer data) that can't go through tRPC.
|
|
192
|
+
* Always co-located: storage is a kernel-level service injected at boot.
|
|
193
|
+
*/
|
|
194
|
+
readonly storage?: import('./storage.js').IStorageProvider;
|
|
195
|
+
/**
|
|
196
|
+
* Per-process system-readiness tracker. One `ReadinessRegistry` is
|
|
197
|
+
* created per broker by the kernel at boot and shared across every
|
|
198
|
+
* addon on that broker — consumers that need `awaitReady` /
|
|
199
|
+
* `onReadyState` should use this singleton rather than constructing
|
|
200
|
+
* their own so subscriptions on the event bus stay de-duplicated and
|
|
201
|
+
* the snapshot is consistent across the process.
|
|
202
|
+
*
|
|
203
|
+
* Tests that run without a real kernel (no `ctx.kernel`) should
|
|
204
|
+
* either inject a mock or fall back to creating a local
|
|
205
|
+
* `ReadinessRegistry`; the production code in kernel always
|
|
206
|
+
* populates this field.
|
|
207
|
+
*/
|
|
208
|
+
readonly readinessRegistry?: import('../capabilities/index.js').ITypedReadinessRegistry;
|
|
209
|
+
/**
|
|
210
|
+
* Global device registry — read + mutate devices across all addons.
|
|
211
|
+
* Hub-only: workers don't have a local registry (use `ctx.devices`
|
|
212
|
+
* for per-addon scoped management, or `ctx.api.deviceManager.*` for
|
|
213
|
+
* cross-process access).
|
|
214
|
+
*/
|
|
215
|
+
readonly deviceRegistry?: import('../device/device-context.js').IDeviceRegistry;
|
|
216
|
+
/**
|
|
217
|
+
* Per-addon scoped device management — create, register, remove, list devices.
|
|
218
|
+
* Used by device provider addons (rtsp, onvif, frigate) to manage cameras.
|
|
219
|
+
*/
|
|
220
|
+
readonly devices: import('../device/device-context.js').DeviceManagerApi;
|
|
221
|
+
/**
|
|
222
|
+
* Cluster runtime — exposes the underlying message broker for addons that
|
|
223
|
+
* need to participate in cluster-wide RPC outside the capability/tRPC
|
|
224
|
+
* surface (e.g. log forwarding, hub readiness probes).
|
|
225
|
+
*
|
|
226
|
+
* Optional: only the agent and hub processes populate this. Forked workers
|
|
227
|
+
* receive their broker through their own runner harness — they do not see
|
|
228
|
+
* `cluster.broker` on ctx.kernel.
|
|
229
|
+
*/
|
|
230
|
+
readonly cluster?: {
|
|
231
|
+
readonly broker: IClusterBroker;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Kernel stream-probe bundle. Both entrypoints land on the same
|
|
235
|
+
* hub-side `StreamProbeService` (ffprobe + HTTP reachability check
|
|
236
|
+
* with a 1h cache). Hub resolves them directly; forked workers +
|
|
237
|
+
* remote agents route through the `$stream-probe.*` Moleculer
|
|
238
|
+
* broker service. Providers that call
|
|
239
|
+
* `ctx.kernel.streamProbe.probe(url)` don't need to know where
|
|
240
|
+
* they run.
|
|
241
|
+
*/
|
|
242
|
+
readonly streamProbe?: IKernelStreamProbe;
|
|
243
|
+
/**
|
|
244
|
+
* Kernel hardware-accel resolver. Platform-probe that picks an
|
|
245
|
+
* ordered preference list of hw decode backends for the **local
|
|
246
|
+
* host**. Every node (hub + forked worker + remote agent) runs its
|
|
247
|
+
* own probe because hwaccel is inherently hardware-bound: decoder
|
|
248
|
+
* addons on an NVIDIA agent get `['cuda', 'nvdec']`, the same addon
|
|
249
|
+
* on a Mac hub gets `['videotoolbox']`. Cross-node queries for the
|
|
250
|
+
* admin UI go via the `$hwaccel.resolve` Moleculer service
|
|
251
|
+
* registered on every node.
|
|
252
|
+
*/
|
|
253
|
+
readonly hwaccel?: IKernelHwAccel;
|
|
254
|
+
/**
|
|
255
|
+
* Capability registry — provider lookups, native-cap resolution, wrapper listing.
|
|
256
|
+
* Hub-only: forked workers don't see this (they use `ctx.api` for cross-process calls).
|
|
257
|
+
*/
|
|
258
|
+
readonly capabilityRegistry?: ICapabilityRegistry;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Canonical hwaccel backend names. Accepted by both the `ffmpeg` CLI
|
|
262
|
+
* (`-hwaccel <name>`) and node-av `HardwareDeviceContext.create()`
|
|
263
|
+
* (`AV_HWDEVICE_TYPE_<upper>`), so a single string drives both layers.
|
|
264
|
+
*/
|
|
265
|
+
export type HwAccelBackend = 'videotoolbox' | 'cuda' | 'nvdec' | 'vaapi' | 'qsv' | 'd3d11va' | 'dxva2' | 'amf' | 'vdpau' | 'drm';
|
|
266
|
+
/** Resolution output — preference list + rationale for observability. */
|
|
267
|
+
export interface HwAccelResolution {
|
|
268
|
+
readonly preferred: readonly HwAccelBackend[];
|
|
269
|
+
readonly rationale: string;
|
|
270
|
+
}
|
|
271
|
+
export interface IKernelHwAccel {
|
|
272
|
+
/**
|
|
273
|
+
* Probe the local host and return the preferred backends.
|
|
274
|
+
*
|
|
275
|
+
* `prefer` accepts:
|
|
276
|
+
* - `null` / `undefined` → auto, use platform probe
|
|
277
|
+
* - `'none'` → hwaccel disabled; returns empty list
|
|
278
|
+
* - an explicit backend name → single-entry list (skip probe)
|
|
279
|
+
*
|
|
280
|
+
* Implementations are pure functions over the host — safe to call
|
|
281
|
+
* repeatedly; results are deterministic per host.
|
|
282
|
+
*/
|
|
283
|
+
readonly resolve: (prefer?: HwAccelBackend | 'none' | null) => Promise<HwAccelResolution>;
|
|
284
|
+
}
|
|
285
|
+
export interface IKernelStreamProbe {
|
|
286
|
+
/**
|
|
287
|
+
* Run ffprobe on an RTSP / HTTP stream URL and return the raw
|
|
288
|
+
* metadata. Use this when you need the width/height/codec/fps data
|
|
289
|
+
* for profile classification. `classifyStream` / `classifyStreams`
|
|
290
|
+
* in `@camstack/types` turn the metadata into a `StreamQuality`.
|
|
291
|
+
*/
|
|
292
|
+
readonly probe: (url: string, options?: {
|
|
293
|
+
force?: boolean;
|
|
294
|
+
}) => Promise<import('./device-capabilities/camera.js').StreamMetadata>;
|
|
295
|
+
/**
|
|
296
|
+
* Generic field probe dispatcher — keys starting with `stream` run
|
|
297
|
+
* ffprobe, others run an HTTP GET that aborts at response headers.
|
|
298
|
+
* Returns a `FieldProbeResult` suitable for the admin UI's "Test"
|
|
299
|
+
* button on any `probe`-typed form field.
|
|
300
|
+
*/
|
|
301
|
+
readonly probeField: (key: string, value: unknown) => Promise<FieldProbeResult>;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Minimal structural shape of a cluster-message-broker (Moleculer in the
|
|
305
|
+
* current implementation). Captured in @camstack/types so cluster-aware
|
|
306
|
+
* addons can consume it without pulling a moleculer dependency.
|
|
307
|
+
*
|
|
308
|
+
* Add new methods sparingly — every addition becomes a contract the broker
|
|
309
|
+
* implementation must satisfy.
|
|
310
|
+
*/
|
|
311
|
+
export interface IClusterBroker {
|
|
312
|
+
readonly nodeID: string;
|
|
313
|
+
call<TParams = unknown, TResult = unknown>(action: string, params?: TParams, opts?: {
|
|
314
|
+
nodeID?: string;
|
|
315
|
+
timeout?: number;
|
|
316
|
+
}): Promise<TResult>;
|
|
317
|
+
waitForServices(service: string | readonly string[], timeout?: number): Promise<void>;
|
|
318
|
+
readonly localBus: {
|
|
319
|
+
on(event: string, handler: (payload: {
|
|
320
|
+
node: {
|
|
321
|
+
id: string;
|
|
322
|
+
};
|
|
323
|
+
}) => void): void;
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
export interface AddonContext<TConfig = Record<string, unknown>> {
|
|
180
327
|
/** Immutable progressive ID */
|
|
181
328
|
readonly id: string;
|
|
182
329
|
/** Pre-scoped logger */
|
|
183
330
|
readonly logger: IScopedLogger;
|
|
184
331
|
/** System event bus */
|
|
185
332
|
readonly eventBus: IEventBus;
|
|
186
|
-
/** Scoped storage location (legacy — use storageProvider instead) */
|
|
187
|
-
readonly storage: IStorageLocation;
|
|
188
|
-
/** Persisted config store */
|
|
189
|
-
readonly config: IElementConfig;
|
|
190
333
|
/** Bootstrap configuration from server settings (read-only) */
|
|
191
|
-
readonly addonConfig: Readonly<
|
|
192
|
-
/** Model management -- download default models or retrieve cached paths. */
|
|
193
|
-
models?: IAddonModelManager;
|
|
194
|
-
/** @deprecated Use storageProvider.resolve() instead */
|
|
195
|
-
readonly locationPaths: AddonLocationPaths;
|
|
196
|
-
/** File storage provider — resolve paths, read/write files per location type */
|
|
197
|
-
readonly storageProvider?: IStorageProvider;
|
|
198
|
-
/** Settings backend — query/insert structured data (events, settings, metadata) */
|
|
199
|
-
readonly settingsBackend?: ISettingsBackend;
|
|
200
|
-
/** Embeddings backend — vector storage for similarity search */
|
|
201
|
-
readonly embeddingsBackend?: IEmbeddingsBackend;
|
|
334
|
+
readonly addonConfig: Readonly<TConfig>;
|
|
202
335
|
/**
|
|
203
336
|
* Private data directory for this addon.
|
|
204
337
|
* Resolved via storageProvider.resolve('addons-data', '{addonId}/').
|
|
205
338
|
* The addon owns this directory exclusively.
|
|
206
339
|
*/
|
|
207
340
|
readonly dataDir: string;
|
|
208
|
-
/**
|
|
209
|
-
readonly
|
|
210
|
-
/**
|
|
211
|
-
|
|
341
|
+
/** Infrastructure services provided by the kernel. */
|
|
342
|
+
readonly kernel: IKernelServices;
|
|
343
|
+
/**
|
|
344
|
+
* Capability settings API — 3-level resolution (defaults → global → per-device).
|
|
345
|
+
* Replaces context.config (IElementConfig) and context.addonConfig.
|
|
346
|
+
*/
|
|
212
347
|
/**
|
|
213
|
-
*
|
|
214
|
-
*
|
|
348
|
+
* Three-level settings store API.
|
|
349
|
+
*
|
|
350
|
+
* Raw, non-merging accessors for the addon's `addon_settings` row and
|
|
351
|
+
* per-device overrides, plus a `(getSection, setSection)` pair for the
|
|
352
|
+
* cluster-wide yml-backed sections consumed by the built-in
|
|
353
|
+
* `system-config` addon.
|
|
354
|
+
*
|
|
355
|
+
* The addon combines these raw reads with its own schema via
|
|
356
|
+
* `hydrateSchema()` inside `getAddonSettings / getGlobalSettings /
|
|
357
|
+
* getDeviceSettings` on `ICamstackAddon`. There is no defaults
|
|
358
|
+
* injection or cross-level merge at this layer.
|
|
359
|
+
*
|
|
360
|
+
* Cleanup note: the earlier `getGlobal / getDevice / updateGlobal /
|
|
361
|
+
* updateDevice` trio (with a polymorphic `getGlobal({ section })`
|
|
362
|
+
* overload) was removed after every caller migrated. The only
|
|
363
|
+
* consumer of the yml-section path was `system-config`, which now
|
|
364
|
+
* goes through the explicit `getSection / setSection` pair below.
|
|
215
365
|
*/
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
366
|
+
readonly settings?: {
|
|
367
|
+
/**
|
|
368
|
+
* Read the raw addon store for this addon. Holds both `addon`-level
|
|
369
|
+
* and `global`-level values; they're disjoint by schema invariant so
|
|
370
|
+
* they can share one physical store. No defaults merged in. Returns
|
|
371
|
+
* an empty object if the addon has never written anything.
|
|
372
|
+
*/
|
|
373
|
+
readAddonStore(): Promise<Record<string, unknown>>;
|
|
374
|
+
/**
|
|
375
|
+
* Write a patch into the addon store. Keys not in the patch are
|
|
376
|
+
* preserved. Keys explicitly set to `null` are preserved as-is (they
|
|
377
|
+
* do NOT fall back to schema default on subsequent reads — that
|
|
378
|
+
* layering happens only at `hydrateSchema` time).
|
|
379
|
+
*/
|
|
380
|
+
writeAddonStore(patch: Record<string, unknown>): Promise<void>;
|
|
381
|
+
/**
|
|
382
|
+
* Read the raw per-device store for this addon + device. No defaults,
|
|
383
|
+
* no merge with the addon store. Returns `{}` when no overrides exist.
|
|
384
|
+
*/
|
|
385
|
+
readDeviceStore(deviceId: number): Promise<Record<string, unknown>>;
|
|
386
|
+
/**
|
|
387
|
+
* Write a patch into the per-device store. Does NOT touch the
|
|
388
|
+
* addon-level store. Keys preserved as in `writeAddonStore`.
|
|
389
|
+
*/
|
|
390
|
+
writeDeviceStore(deviceId: number, patch: Record<string, unknown>): Promise<void>;
|
|
391
|
+
/**
|
|
392
|
+
* Delete all keys for a device from the per-device store.
|
|
393
|
+
* Use on device removal to guarantee no orphaned settings rows remain.
|
|
394
|
+
*/
|
|
395
|
+
clearDeviceStore(deviceId: number): Promise<void>;
|
|
396
|
+
/**
|
|
397
|
+
* Read a device's runtime-state blob — separate namespace from
|
|
398
|
+
* `readDeviceStore` (which is the addon's config blob). Holds
|
|
399
|
+
* mutable runtime signals discovered after boot (battery
|
|
400
|
+
* snapshot, sleep flag, last-seen) that survive restart. Stored
|
|
401
|
+
* under the kernel's reserved `__device-state` namespace so the
|
|
402
|
+
* addon's config schema never sees it.
|
|
403
|
+
*/
|
|
404
|
+
readDeviceRuntimeState(deviceId: number): Promise<Record<string, unknown>>;
|
|
405
|
+
/**
|
|
406
|
+
* Replace the runtime-state blob for a device. The kernel's
|
|
407
|
+
* `DeviceRuntimeState` always hands over the FULL persistent
|
|
408
|
+
* slice — no shallow merge here, the latest blob wins.
|
|
409
|
+
*/
|
|
410
|
+
writeDeviceRuntimeState(deviceId: number, data: Record<string, unknown>): Promise<void>;
|
|
411
|
+
/**
|
|
412
|
+
* Delete the device's runtime-state blob. Use on device removal
|
|
413
|
+
* so a recreated device with the same id starts clean instead
|
|
414
|
+
* of inheriting stale runtime state from the previous lifetime.
|
|
415
|
+
*/
|
|
416
|
+
clearDeviceRuntimeState(deviceId: number): Promise<void>;
|
|
417
|
+
/**
|
|
418
|
+
* Read a cluster-wide yml-backed section (server, auth, ffmpeg,
|
|
419
|
+
* logging, recording, retention — whatever
|
|
420
|
+
* `ConfigManager.getSection` recognises). Returns the raw section
|
|
421
|
+
* record with no schema merging. Used by the built-in
|
|
422
|
+
* `system-config` addon to surface the legacy `config.yaml`
|
|
423
|
+
* sections through its `getGlobalSettings()` method.
|
|
424
|
+
*/
|
|
425
|
+
getSection(section: string): Promise<Record<string, unknown>>;
|
|
426
|
+
/**
|
|
427
|
+
* Write a cluster-wide yml-backed section. Shallow-merges the patch
|
|
428
|
+
* into the existing section so unrelated keys are preserved.
|
|
429
|
+
* Hub-only — agents have no concept of yml sections and will
|
|
430
|
+
* throw. Used by the `system-config` addon's
|
|
431
|
+
* `updateGlobalSettings()` implementation.
|
|
432
|
+
*/
|
|
433
|
+
setSection(section: string, patch: Record<string, unknown>): Promise<void>;
|
|
434
|
+
};
|
|
221
435
|
/**
|
|
222
436
|
* Full tRPC client — same API as the frontend.
|
|
223
437
|
* Transport is transparent: direct caller (in-process), WSS (worker), or WSS (remote agent).
|
|
224
438
|
* Use this for all server interactions: storage, events, devices, streaming, etc.
|
|
225
439
|
*/
|
|
226
|
-
readonly api
|
|
440
|
+
readonly api: import('../generated/addon-api.js').AddonApi;
|
|
441
|
+
/**
|
|
442
|
+
* Binary / tool dependency manager. Addons call
|
|
443
|
+
* `ctx.deps.ensureBinary(...)` / `ensureFfmpeg()` / `ensurePython()` to
|
|
444
|
+
* materialise per-addon runtime deps under the shared `data/deps` tree.
|
|
445
|
+
* Injected by the addon host so addons never import the concrete
|
|
446
|
+
* implementation from `@camstack/core` directly.
|
|
447
|
+
*/
|
|
448
|
+
readonly deps: IAddonDepsManager;
|
|
449
|
+
/**
|
|
450
|
+
* Typed handle to the native provider of `cap` for `deviceId`. Bypasses the
|
|
451
|
+
* currently-active wrapper — call this ONLY from the wrapper that owns
|
|
452
|
+
* `cap`. Every other consumer should use `fetchDevice(id).<cap>.<method>()`
|
|
453
|
+
* instead, which routes through the cap-router and respects the wrapper
|
|
454
|
+
* chain.
|
|
455
|
+
*
|
|
456
|
+
* Wrapper-vs-consumer rule (memorise this):
|
|
457
|
+
* - "I am the wrapper for this cap and I need to delegate to the camera
|
|
458
|
+
* driver" → `getNativeProvider(cap, id)` (bypasses self, no recursion).
|
|
459
|
+
* - "I am consuming someone else's cap" → `fetchDevice(id).<cap>...`
|
|
460
|
+
* (uses the wrapper chain — cache, fallback, validation, etc.).
|
|
461
|
+
*
|
|
462
|
+
* Calling `fetchDevice` from inside the cap's own wrapper would re-enter
|
|
463
|
+
* the wrapper and produce infinite recursion through the cap-router.
|
|
464
|
+
*
|
|
465
|
+
* Returns `null` when no addon has published a native provider for this
|
|
466
|
+
* `(cap, deviceId)` — e.g. a camera driver that doesn't implement the cap
|
|
467
|
+
* natively (RtspCamera without `snapshotUrl` does not register snapshot).
|
|
468
|
+
* Wrappers use this to decide between native delegation and their own
|
|
469
|
+
* fallback strategy; they MUST check for null.
|
|
470
|
+
*
|
|
471
|
+
* When the native is registered in this process, returns the local object
|
|
472
|
+
* directly (zero serialization). When it lives in a forked worker, returns
|
|
473
|
+
* a Moleculer-backed proxy constructed by the hub's native-cap fallback
|
|
474
|
+
* (see `CapabilityRegistry.setNativeFallback`) — standard
|
|
475
|
+
* `<addonId>.native-provider.<capName>.<method>` RPC path.
|
|
476
|
+
*/
|
|
477
|
+
getNativeProvider<TCap extends CapabilityDefinition>(cap: TCap, deviceId: number): InferProvider<TCap> | null;
|
|
478
|
+
/**
|
|
479
|
+
* Fetch a typed proxy for a device. THE canonical entry point for any
|
|
480
|
+
* consumer that wants to read state, subscribe to changes, or dispatch
|
|
481
|
+
* cap methods on a device — equivalent to `BackendClient.fetchDevice(id)`
|
|
482
|
+
* on the client side.
|
|
483
|
+
*
|
|
484
|
+
* What you can do with the returned proxy:
|
|
485
|
+
* - Read live state slices: `dev.state.battery.value` (typed
|
|
486
|
+
* `BatteryStatus | undefined`, no provider call — reads the kernel's
|
|
487
|
+
* mirrored snapshot).
|
|
488
|
+
* - Subscribe to slice changes: `dev.state.battery.subscribe(cb)` —
|
|
489
|
+
* refcounted, auto-seeds the callback with the current value.
|
|
490
|
+
* - Invoke cap methods through the wrapper chain:
|
|
491
|
+
* `await dev.snapshot.getSnapshot({...})`. Methods are typed against
|
|
492
|
+
* each cap's definition; absent caps appear as `undefined`.
|
|
493
|
+
*
|
|
494
|
+
* Routing semantics: every method call on the returned proxy goes through
|
|
495
|
+
* the tRPC cap-router → the active wrapper (if any) → the native provider.
|
|
496
|
+
* That means a wrapper consuming its OWN cap via `fetchDevice` would
|
|
497
|
+
* recurse — wrappers must use `getNativeProvider` instead. See the rule
|
|
498
|
+
* documented on `getNativeProvider` above.
|
|
499
|
+
*
|
|
500
|
+
* Bindings are cached per-addon-context: the first call resolves bindings
|
|
501
|
+
* via `deviceManager.getBindings.query`, subsequent calls reuse the cache.
|
|
502
|
+
* The cache is invalidated implicitly when the device is removed.
|
|
503
|
+
*/
|
|
504
|
+
fetchDevice(deviceId: number): Promise<import('../generated/device-proxy.js').DeviceProxy>;
|
|
505
|
+
/**
|
|
506
|
+
* Runtime accessor for the capability registry — exposed to addons that
|
|
507
|
+
* need to enumerate peers of a collection cap (e.g. `turn-provider`) or
|
|
508
|
+
* grab the active singleton for a system cap. Injected by the kernel at
|
|
509
|
+
* addon instantiation; absent when the addon is loaded in isolation
|
|
510
|
+
* (tests, tooling), which is why the field is optional.
|
|
511
|
+
*/
|
|
512
|
+
readonly capabilities?: CapabilitiesAccess;
|
|
513
|
+
/**
|
|
514
|
+
* Returns a capability handle immediately (non-blocking). The handle tracks
|
|
515
|
+
* ready/down state via the ReadinessRegistry and gates calls accordingly.
|
|
516
|
+
* Repeated calls with the same `(capName, scope)` return the same cached instance.
|
|
517
|
+
*
|
|
518
|
+
* Use for runtime cap consumption where the cap may not be ready yet and
|
|
519
|
+
* you want calls to block transparently via `handle.call(fn)`.
|
|
520
|
+
*/
|
|
521
|
+
useCapability<T = unknown>(capName: string, scope?: ReadinessScope): ICapabilityHandle<T>;
|
|
522
|
+
/**
|
|
523
|
+
* Blocks until the capability is ready, then returns the cached handle.
|
|
524
|
+
* Throws `CapabilityUnavailableError` if the cap does not become ready
|
|
525
|
+
* within `timeoutMs` (default 15 000ms).
|
|
526
|
+
*
|
|
527
|
+
* Use for boot sequencing where downstream work must not start until
|
|
528
|
+
* the cap is confirmed available.
|
|
529
|
+
*/
|
|
530
|
+
acquireCapability<T = unknown>(capName: string, scope?: ReadinessScope, opts?: {
|
|
531
|
+
timeoutMs?: number;
|
|
532
|
+
}): Promise<ICapabilityHandle<T>>;
|
|
533
|
+
/**
|
|
534
|
+
* Subscribe to capability state changes (ready / down).
|
|
535
|
+
* Returns an unsubscribe function. Thin wrapper over `ReadinessRegistry.onReadyState`.
|
|
536
|
+
*/
|
|
537
|
+
onCapabilityStateChange(capName: string, scope: ReadinessScope, handler: (state: 'ready' | 'down') => void): () => void;
|
|
538
|
+
/**
|
|
539
|
+
* Register a teardown callback that runs automatically when this
|
|
540
|
+
* addon is shut down or restarted (e.g. by `restartAddon` after a
|
|
541
|
+
* runtime update from the admin UI). Disposers run in LIFO order so
|
|
542
|
+
* later registrations clean up before the resources they depend on.
|
|
543
|
+
*
|
|
544
|
+
* Use this for any side effect that survives across function calls
|
|
545
|
+
* — `setInterval`, native socket listeners, watchers, file handles.
|
|
546
|
+
* Capability/event subscriptions returned by `onCapabilityStateChange`
|
|
547
|
+
* / `eventBus.subscribe` are unsubscribe functions you can pass
|
|
548
|
+
* straight to `addDisposer`. Returns a manual unsubscribe so the
|
|
549
|
+
* addon can drop the disposer early if needed.
|
|
550
|
+
*
|
|
551
|
+
* const stopTimer = setInterval(...);
|
|
552
|
+
* ctx.addDisposer(() => clearInterval(stopTimer));
|
|
553
|
+
*
|
|
554
|
+
* const unsub = ctx.eventBus.subscribe('motion', cb);
|
|
555
|
+
* ctx.addDisposer(unsub);
|
|
556
|
+
*
|
|
557
|
+
* The kernel calls each disposer once during `addon.shutdown()`. A
|
|
558
|
+
* disposer that throws is logged and skipped — subsequent disposers
|
|
559
|
+
* still run.
|
|
560
|
+
*/
|
|
561
|
+
addDisposer(fn: () => void | Promise<void>): () => void;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Runtime-only capability registry surface — kept minimal on purpose.
|
|
565
|
+
* `getCollection` returns every registered provider for a collection cap
|
|
566
|
+
* (order-unstable); `get` returns the active provider for a singleton.
|
|
567
|
+
* Both return `undefined` when the cap isn't declared or has no provider.
|
|
568
|
+
*/
|
|
569
|
+
export interface CapabilitiesAccess {
|
|
570
|
+
/** All providers registered on a collection capability (by cap name). */
|
|
571
|
+
getCollection<T = unknown>(name: string): readonly T[] | undefined;
|
|
572
|
+
/**
|
|
573
|
+
* Like `getCollection` but returns `[addonId, provider]` tuples so
|
|
574
|
+
* callers can attribute work back to the contributing addon. The
|
|
575
|
+
* `addonId` for cap-routed remote providers is `<addonName>@<workerNodeId>`
|
|
576
|
+
* (e.g. `decoder-nodeav@dev-agent-1/decoder-nodeav`); local providers
|
|
577
|
+
* are just `<addonName>` (no `@`). Used by stream-broker to filter the
|
|
578
|
+
* decoder collection by the orchestrator's per-camera placement
|
|
579
|
+
* decision (`getDecoderAssignment.decoderNodeId`).
|
|
580
|
+
*/
|
|
581
|
+
getCollectionEntries<T = unknown>(name: string): readonly (readonly [string, T])[] | undefined;
|
|
582
|
+
/** The active provider of a singleton capability (by cap name). */
|
|
583
|
+
get<T = unknown>(name: string): T | undefined;
|
|
227
584
|
}
|
|
228
585
|
export interface ICamstackAddon {
|
|
229
586
|
readonly id?: string;
|
|
230
|
-
|
|
231
|
-
|
|
587
|
+
/** Addon declaration — injected by the framework from package.json. Do not declare in addon class. */
|
|
588
|
+
readonly manifest?: AddonDeclaration;
|
|
589
|
+
/**
|
|
590
|
+
* Initialize the addon. Return capability provider bindings for the kernel
|
|
591
|
+
* to register in the CapabilityRegistry. Returning `void` or an empty array
|
|
592
|
+
* is valid for addons that don't provide capabilities (e.g. pure consumers).
|
|
593
|
+
*
|
|
594
|
+
* The kernel validates that every capability declared in `package.json`
|
|
595
|
+
* has a corresponding entry in the returned array.
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* ```ts
|
|
599
|
+
* async initialize(ctx: AddonContext): Promise<AddonInitResult> {
|
|
600
|
+
* this.detector = new WasmMotionDetector()
|
|
601
|
+
* await this.detector.load()
|
|
602
|
+
* return { providers: [{ capability: motionDetectionCapability, provider: this }] }
|
|
603
|
+
* }
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
initialize(context: AddonContext): Promise<ProviderRegistration[] | AddonInitResult | void>;
|
|
607
|
+
/**
|
|
608
|
+
* Called by the isolated-process runner after `broker.start()`.
|
|
609
|
+
* In-process addons never need this — the hub broker is already running
|
|
610
|
+
* when `initialize()` fires. Forked children emit readiness inside
|
|
611
|
+
* `initialize()` before the broker is live; this re-emits it once the
|
|
612
|
+
* transport is ready so consumers actually receive the event.
|
|
613
|
+
*/
|
|
614
|
+
postBrokerStart(): void;
|
|
615
|
+
/**
|
|
616
|
+
* Optional hook. Fires on forked workers / remote agents once the
|
|
617
|
+
* broker has started AND the hub node has been discovered via the
|
|
618
|
+
* Moleculer `$node.connected` event — the moment at which
|
|
619
|
+
* `ctx.api.*` calls to hub-provided capabilities become safe.
|
|
620
|
+
*
|
|
621
|
+
* Use this instead of `initialize()` for any bootstrap work that
|
|
622
|
+
* needs to query the hub (e.g. restoring persisted state, reading
|
|
623
|
+
* hub-owned settings). Calling `ctx.api.*` from `initialize()` on a
|
|
624
|
+
* worker is a documented foot-gun: the broker is not connected yet
|
|
625
|
+
* and requests either time out or throw "Service not found".
|
|
626
|
+
*
|
|
627
|
+
* On the hub itself this never fires (the hub is its own node; there
|
|
628
|
+
* is no separate hub to wait for).
|
|
629
|
+
*/
|
|
630
|
+
onHubReachable?(): Promise<void> | void;
|
|
232
631
|
shutdown(): Promise<void>;
|
|
233
|
-
|
|
632
|
+
/** Level 1 — node-global settings (schema + values). Appears in
|
|
633
|
+
* Cluster → Settings tab. `overlay` is an optional preview merge
|
|
634
|
+
* consumed by override-mode UIs (benchmark) so cascade-aware
|
|
635
|
+
* addons can re-derive dependent options without touching the
|
|
636
|
+
* persisted store. */
|
|
637
|
+
getGlobalSettings?(overlay?: Record<string, unknown>): Promise<ConfigUISchemaWithValues>;
|
|
638
|
+
updateGlobalSettings?(patch: Record<string, unknown>): Promise<void>;
|
|
639
|
+
/** Level 2 — per-device settings (schema + values). Appears in
|
|
640
|
+
* Device Overrides. */
|
|
641
|
+
getDeviceSettings?(deviceId: number): Promise<ConfigUISchemaWithValues>;
|
|
642
|
+
updateDeviceSettings?(deviceId: number, patch: Record<string, unknown>): Promise<void>;
|
|
234
643
|
/**
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
* Returns null if this addon does not provide the requested capability.
|
|
644
|
+
* Called at boot after initialize() with all previously persisted devices.
|
|
645
|
+
* The addon should re-instantiate device objects and register them via context.devices.register().
|
|
238
646
|
*/
|
|
239
|
-
|
|
647
|
+
restoreDevices?(savedDevices: readonly import('../device/device-management.js').SavedDevice[]): Promise<void>;
|
|
648
|
+
getModelCatalog?(): unknown[];
|
|
649
|
+
/** Load/prepare a model engine for a given modelId. Called before process()/classifyAudio(). */
|
|
650
|
+
ensureEngine?(modelId: string): Promise<void>;
|
|
651
|
+
/** Unified vision inference — handles detection, cropping, classification, refinement.
|
|
652
|
+
* Input is FrameInput (root) or CropInput (child node). Output shape determines slot. */
|
|
653
|
+
process?(input: unknown): Promise<unknown>;
|
|
654
|
+
/** Audio classification — separate from vision pipeline */
|
|
655
|
+
classifyAudio?(input: unknown): Promise<unknown>;
|
|
240
656
|
}
|
|
241
657
|
/** Declaration of a UI page provided by an addon */
|
|
242
658
|
export interface AddonPageDeclaration {
|
|
@@ -248,47 +664,259 @@ export interface AddonPageDeclaration {
|
|
|
248
664
|
readonly icon: string;
|
|
249
665
|
/** Route path (e.g., '/benchmark') */
|
|
250
666
|
readonly path: string;
|
|
251
|
-
/**
|
|
667
|
+
/**
|
|
668
|
+
* Module Federation remote name — must match the `name` field on the
|
|
669
|
+
* page addon's `federation()` plugin config. Used by admin-ui's
|
|
670
|
+
* `<AddonPageLoader>` to call `loadRemote('<remoteName>/page')`.
|
|
671
|
+
* Conventionally `addon_<id>_page` (snake_case; MF names cannot
|
|
672
|
+
* contain hyphens).
|
|
673
|
+
*/
|
|
674
|
+
readonly remoteName: string;
|
|
675
|
+
/**
|
|
676
|
+
* Bundle filename inside the addon's `dist/` dir served at
|
|
677
|
+
* `/api/addon-pages/<addonId>/<bundle>`. With Module Federation this
|
|
678
|
+
* is always `'remoteEntry.js'`.
|
|
679
|
+
*/
|
|
252
680
|
readonly bundle: string;
|
|
253
|
-
/** @deprecated Web component element name — addon pages now export React components */
|
|
254
|
-
readonly element?: string;
|
|
255
681
|
}
|
|
256
682
|
/** Provider interface for addons that expose UI pages */
|
|
257
683
|
export interface IAddonPageProvider {
|
|
258
684
|
readonly id: string;
|
|
259
|
-
|
|
685
|
+
listPages(): readonly AddonPageDeclaration[];
|
|
260
686
|
}
|
|
261
687
|
/** Provider interface for the admin UI shell (singleton capability) */
|
|
262
688
|
export interface IAdminUI {
|
|
263
689
|
getStaticDir(): string;
|
|
264
690
|
getVersion(): string;
|
|
265
691
|
}
|
|
692
|
+
/**
|
|
693
|
+
* Full addon declaration — lives in package.json `camstack.addons[]`.
|
|
694
|
+
* This is the SINGLE SOURCE OF TRUTH for addon identity and metadata.
|
|
695
|
+
* Addon classes no longer declare a `manifest` property.
|
|
696
|
+
*/
|
|
266
697
|
export interface AddonDeclaration {
|
|
267
698
|
readonly id: string;
|
|
268
|
-
|
|
269
|
-
readonly
|
|
699
|
+
/** JS entry point relative to package root (e.g., "./dist/addon.js") */
|
|
700
|
+
readonly entry?: string;
|
|
701
|
+
/** Human-readable name */
|
|
702
|
+
readonly name?: string;
|
|
703
|
+
/** Semver version */
|
|
704
|
+
readonly version?: string;
|
|
705
|
+
/** Short description */
|
|
706
|
+
readonly description?: string;
|
|
270
707
|
/** Relative path to SVG icon asset within the addon package */
|
|
271
708
|
readonly icon?: string;
|
|
272
|
-
/** Brand hex color for UI display */
|
|
709
|
+
/** Brand hex color for UI display (e.g., "#3b82f6") */
|
|
273
710
|
readonly color?: string;
|
|
711
|
+
readonly slot?: PipelineSlot | null;
|
|
274
712
|
/** Instance mode: 'unique' or 'multiple'. Default: 'multiple' */
|
|
275
713
|
readonly instanceMode?: 'unique' | 'multiple';
|
|
276
|
-
/**
|
|
277
|
-
readonly
|
|
714
|
+
/** Whether this addon is protected (required by the system, cannot be uninstalled) */
|
|
715
|
+
readonly protected?: boolean;
|
|
278
716
|
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
717
|
+
* Group-runner execution model.
|
|
718
|
+
*
|
|
719
|
+
* Every addon lives in a forked subprocess; the question is which one.
|
|
720
|
+
* Addons sharing the same `group` value share one subprocess and one
|
|
721
|
+
* Moleculer broker, so cap calls between them resolve in-process via
|
|
722
|
+
* `localProviderLink` (zero IPC). Different groups speak via Moleculer
|
|
723
|
+
* TCP.
|
|
724
|
+
*
|
|
725
|
+
* Defaults (when `execution` is omitted entirely):
|
|
726
|
+
* - `placement: 'hub-only'` — addon does NOT deploy to agents.
|
|
727
|
+
* - `group: 'main-group'` — joins the catch-all subprocess.
|
|
728
|
+
*
|
|
729
|
+
* Examples:
|
|
730
|
+
* ```jsonc
|
|
731
|
+
* // hub-only addon, joins main-group (most common)
|
|
732
|
+
* "execution": {}
|
|
733
|
+
*
|
|
734
|
+
* // deployable to any node (cluster scenario)
|
|
735
|
+
* "execution": { "placement": "any-node" }
|
|
736
|
+
*
|
|
737
|
+
* // bundle detection on a dedicated subprocess
|
|
738
|
+
* "execution": { "placement": "any-node", "group": "detection" }
|
|
739
|
+
*
|
|
740
|
+
* // hardware-bound, only runs on agents (no hub instance)
|
|
741
|
+
* "execution": { "placement": "agent-only" }
|
|
742
|
+
*
|
|
743
|
+
* // crash-isolated (private subprocess; unique group per addon)
|
|
744
|
+
* "execution": { "group": "untrusted-foo" }
|
|
745
|
+
* ```
|
|
282
746
|
*/
|
|
283
|
-
readonly
|
|
284
|
-
/** Capabilities this addon provides
|
|
747
|
+
readonly execution?: AddonExecution;
|
|
748
|
+
/** Capabilities this addon provides */
|
|
285
749
|
readonly capabilities?: readonly CapabilityDeclaration[];
|
|
286
750
|
/** UI pages provided by this addon */
|
|
287
751
|
readonly pages?: readonly AddonPageDeclaration[];
|
|
752
|
+
readonly requiredFeatures?: readonly string[];
|
|
753
|
+
readonly inputClasses?: readonly string[];
|
|
754
|
+
readonly outputClasses?: readonly string[];
|
|
755
|
+
readonly requiredSteps?: readonly RequiredStep[];
|
|
756
|
+
readonly supportsCustomModels?: boolean;
|
|
757
|
+
readonly mayRequirePython?: boolean;
|
|
758
|
+
/** Whether this addon performs active inference. Passive addons are excluded from inference pipeline. Default: true. */
|
|
759
|
+
readonly passive?: boolean;
|
|
760
|
+
/**
|
|
761
|
+
* Label output type for classifier/recognizer addons.
|
|
762
|
+
*
|
|
763
|
+
* `classification` — generic class name (e.g. `'bird'`, `'labrador'`)
|
|
764
|
+
* `face` — recognised face identity
|
|
765
|
+
* `plate` — recognised licence plate OCR
|
|
766
|
+
* `recognition` — generic recognition result (embedding gallery)
|
|
767
|
+
*/
|
|
768
|
+
readonly labelOutputType?: 'classification' | 'face' | 'plate' | 'recognition';
|
|
769
|
+
/**
|
|
770
|
+
* Optional Python runtime dependencies. Declares the pip requirements
|
|
771
|
+
* file the kernel must install into the embedded portable Python
|
|
772
|
+
* before this addon's `onInitialize()` runs. Resolved relative to the
|
|
773
|
+
* addon's package root.
|
|
774
|
+
*
|
|
775
|
+
* Idempotent: install is keyed on (file basename + sha256 of contents)
|
|
776
|
+
* via the marker dir under the python install — back-to-back boots
|
|
777
|
+
* skip the pip subprocess after the first install.
|
|
778
|
+
*
|
|
779
|
+
* Example:
|
|
780
|
+
* ```jsonc
|
|
781
|
+
* "camstack": {
|
|
782
|
+
* "addons": [{
|
|
783
|
+
* "id": "detection-pipeline",
|
|
784
|
+
* "python": { "requirements": "./python/requirements.txt" }
|
|
785
|
+
* }]
|
|
786
|
+
* }
|
|
787
|
+
* ```
|
|
788
|
+
*
|
|
789
|
+
* Backend / feature-specific deps that depend on user settings should
|
|
790
|
+
* NOT be listed here — addons install those lazily via
|
|
791
|
+
* `ctx.deps.installPythonRequirements(absolutePath)`.
|
|
792
|
+
*/
|
|
793
|
+
readonly python?: AddonPythonRequirements;
|
|
794
|
+
/** Default configuration values */
|
|
795
|
+
readonly defaultConfig?: Readonly<Record<string, unknown>>;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Manifest declaration for an addon's Python runtime dependencies.
|
|
799
|
+
* See `AddonDeclaration.python`.
|
|
800
|
+
*/
|
|
801
|
+
export interface AddonPythonRequirements {
|
|
802
|
+
/**
|
|
803
|
+
* Path to the pip requirements file the kernel installs into the
|
|
804
|
+
* embedded portable Python before `onInitialize()` runs. Resolved
|
|
805
|
+
* relative to the addon package root.
|
|
806
|
+
*/
|
|
807
|
+
readonly requirements: string;
|
|
288
808
|
}
|
|
289
809
|
export interface AddonPackageManifest {
|
|
290
810
|
/** Human-readable package name for UI display (e.g., "CamStack Vision") */
|
|
291
811
|
readonly displayName?: string;
|
|
292
812
|
readonly addons: readonly AddonDeclaration[];
|
|
813
|
+
/**
|
|
814
|
+
* Optional bundle metadata for npm packages that ship multiple addon
|
|
815
|
+
* entries (e.g., `@camstack/addon-pipeline` with 7 entries,
|
|
816
|
+
* `@camstack/addon-remote-storage` with 3 entries). When set, the
|
|
817
|
+
* Addons admin UI renders the entries as collapsible children under a
|
|
818
|
+
* single bundle card. The npm package boundary IS the install/update
|
|
819
|
+
* unit — operator-facing actions (Install, Update, Uninstall) act on
|
|
820
|
+
* the bundle, not on individual children. Per-child enable/disable +
|
|
821
|
+
* settings are still surfaced individually.
|
|
822
|
+
*
|
|
823
|
+
* Single-entry packages omit this field; their UI stays a standalone
|
|
824
|
+
* card. Multi-entry packages WITHOUT this field fall back to deriving
|
|
825
|
+
* displayName from `package.json:name`.
|
|
826
|
+
*/
|
|
827
|
+
readonly bundle?: AddonBundleManifest;
|
|
828
|
+
/**
|
|
829
|
+
* Native node modules that the addon needs at runtime but cannot be
|
|
830
|
+
* bundled (`.node` binary files require ABI-matched compilation).
|
|
831
|
+
* Phase E of the bundles + builder modernization spec — mirror of
|
|
832
|
+
* the Python `requirements.txt` pattern, but for native Node deps.
|
|
833
|
+
*
|
|
834
|
+
* Format: package name → semver range, exactly like
|
|
835
|
+
* `package.json#dependencies`. NOT listed in the package's regular
|
|
836
|
+
* `dependencies` field (so workspace `npm install` skips them), but
|
|
837
|
+
* the addon installer reads this field at install time and runs:
|
|
838
|
+
*
|
|
839
|
+
* npm install --prefix <addonDir> <name>@<range>
|
|
840
|
+
* electron-rebuild -m <addonDir> -w <name> (for Electron host)
|
|
841
|
+
* npm rebuild --prefix <addonDir> <name> (for plain Node host)
|
|
842
|
+
*
|
|
843
|
+
* The host's runtime ABI (Electron 35 = Node ABI 127, plain Node 22 =
|
|
844
|
+
* ABI 133) is detected at install time. Both targets are first-class.
|
|
845
|
+
*
|
|
846
|
+
* Example:
|
|
847
|
+
* ```jsonc
|
|
848
|
+
* "camstack": {
|
|
849
|
+
* "nativeDependencies": {
|
|
850
|
+
* "better-sqlite3": "^12.8.0",
|
|
851
|
+
* "ssh2": "^1.16.0"
|
|
852
|
+
* }
|
|
853
|
+
* }
|
|
854
|
+
* ```
|
|
855
|
+
*
|
|
856
|
+
* Phase E will also produce prebuilt `.node` binaries for both ABIs
|
|
857
|
+
* during `npm publish`, shipped in the tarball under
|
|
858
|
+
* `dist/native-prebuilds/<runtime>-<abi>-<arch>/`. The installer
|
|
859
|
+
* tries the matching prebuild first; falls back to source rebuild
|
|
860
|
+
* only when no prebuild exists for the host triple.
|
|
861
|
+
*/
|
|
862
|
+
readonly nativeDependencies?: Readonly<Record<string, string>>;
|
|
863
|
+
}
|
|
864
|
+
export interface AddonBundleManifest {
|
|
865
|
+
/** Display name shown on the bundle card header (e.g., "Pipeline"). */
|
|
866
|
+
readonly displayName: string;
|
|
867
|
+
/** Optional 1-2 sentence description for the operator. */
|
|
868
|
+
readonly description?: string;
|
|
869
|
+
/** Optional icon path relative to the package root. */
|
|
870
|
+
readonly icon?: string;
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Where an addon may be deployed. The kernel honours this when picking
|
|
874
|
+
* which node hosts the group-runner that will load the addon.
|
|
875
|
+
*
|
|
876
|
+
* - `'hub-only'` — runs only on the hub process. Default.
|
|
877
|
+
* - `'agent-only'` — runs only on remote agent processes.
|
|
878
|
+
* - `'any-node'` — eligible to run on either hub or agents.
|
|
879
|
+
*/
|
|
880
|
+
export type AddonPlacement = 'hub-only' | 'agent-only' | 'any-node';
|
|
881
|
+
/**
|
|
882
|
+
* Effective execution model for an addon. See `AddonDeclaration.execution`
|
|
883
|
+
* for the full semantics.
|
|
884
|
+
*/
|
|
885
|
+
export interface AddonExecution {
|
|
886
|
+
readonly placement?: AddonPlacement;
|
|
887
|
+
/**
|
|
888
|
+
* Subprocess group label. Addons sharing the same value share one
|
|
889
|
+
* forked subprocess + one Moleculer broker. Defaults to `'main-group'`
|
|
890
|
+
* — the catch-all bucket for every addon that doesn't opt out.
|
|
891
|
+
*/
|
|
892
|
+
readonly group?: string;
|
|
893
|
+
}
|
|
894
|
+
export declare const DEFAULT_ADDON_GROUP = "main-group";
|
|
895
|
+
export declare const DEFAULT_ADDON_PLACEMENT: AddonPlacement;
|
|
896
|
+
/**
|
|
897
|
+
* Resolve the effective `AddonExecution` for an addon. Returns a fully
|
|
898
|
+
* populated value (placement + group always set) so callers can read
|
|
899
|
+
* either field without a separate fallback.
|
|
900
|
+
*/
|
|
901
|
+
export declare function resolveAddonExecution(decl: Pick<AddonDeclaration, 'execution'>): Required<AddonExecution>;
|
|
902
|
+
/** True when the addon may run on a remote agent (deployable from hub). */
|
|
903
|
+
export declare function isDeployableToAgent(decl: Pick<AddonDeclaration, 'execution'>): boolean;
|
|
904
|
+
/** True when the addon is skipped on the hub (agent-only deployment). */
|
|
905
|
+
export declare function isAgentOnlyPlacement(decl: Pick<AddonDeclaration, 'execution'>): boolean;
|
|
906
|
+
/** Convenience accessor — the resolved subprocess group label. */
|
|
907
|
+
export declare function resolveAddonGroup(decl: Pick<AddonDeclaration, 'execution'>): string;
|
|
908
|
+
/** Convenience accessor — the resolved placement (defaults to `hub-only`). */
|
|
909
|
+
export declare function resolveAddonPlacement(decl: Pick<AddonDeclaration, 'execution'>): AddonPlacement;
|
|
910
|
+
/**
|
|
911
|
+
* Extended AddonContext used exclusively by the kernel (hub + worker boot
|
|
912
|
+
* sequences) to wire providers into the CapabilityRegistry after
|
|
913
|
+
* `initialize()` returns. Addon code never sees this — it only receives
|
|
914
|
+
* the public `AddonContext`.
|
|
915
|
+
*/
|
|
916
|
+
export interface InternalAddonContext extends AddonContext {
|
|
917
|
+
/** Register a provider in the local capability registry. Kernel-only. */
|
|
918
|
+
registerProvider(capabilityName: string, provider: unknown): void;
|
|
919
|
+
/** Resolve the preferred provider for a capability. Kernel-only. */
|
|
920
|
+
resolveProvider<T = unknown>(capabilityName: string): T | null;
|
|
293
921
|
}
|
|
294
922
|
//# sourceMappingURL=addon.d.ts.map
|