@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
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import type { IScopedLogger } from '../interfaces/logging.js';
|
|
2
|
+
import type { IEventBus } from '../interfaces/event-bus.js';
|
|
3
|
+
import type { IDevice } from './device.js';
|
|
4
|
+
import type { CapabilityDefinition, InferNativeProvider } from '../capabilities/capability-definition.js';
|
|
5
|
+
import type { IKernelStreamProbe } from '../interfaces/addon.js';
|
|
6
|
+
import type { AddonApi } from '../generated/addon-api.js';
|
|
7
|
+
import type { DeviceProxy } from '../generated/device-proxy.js';
|
|
8
|
+
import type { DeviceMeta, InitialDeviceMeta } from './device-management.js';
|
|
9
|
+
export interface DeviceContext {
|
|
10
|
+
/** Progressive, system-wide unique numeric device id. Injected from the
|
|
11
|
+
* hub's `device-manager` via `DeviceManagerApi.allocateDeviceId` before
|
|
12
|
+
* `BaseDevice` is constructed, so `IDevice.id` is always populated. */
|
|
13
|
+
readonly id: number;
|
|
14
|
+
readonly stableId: string;
|
|
15
|
+
/** Numeric id of the parent device, or null when standalone. Resolved
|
|
16
|
+
* by the caller of `DeviceManagerApi.create()` from the parent IDevice. */
|
|
17
|
+
readonly parentDeviceId: number | null;
|
|
18
|
+
readonly logger: IScopedLogger;
|
|
19
|
+
readonly api: AddonApi;
|
|
20
|
+
readonly eventBus: IEventBus;
|
|
21
|
+
readonly persistConfig: (data: unknown) => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Snapshot of the persisted runtime-state blob loaded at boot.
|
|
24
|
+
* `BaseDevice` hands this to `DeviceRuntimeState.fromInitial` so
|
|
25
|
+
* the device wakes up with the last-known battery / sleep flag
|
|
26
|
+
* already populated. Empty object on first boot or for ctx
|
|
27
|
+
* factories that don't wire runtime state (tests).
|
|
28
|
+
*
|
|
29
|
+
* Runtime-state WRITES route through `fetchDevice(id).deviceState
|
|
30
|
+
* .setCapSlice(...)` — the canonical cross-layer entrypoint via the
|
|
31
|
+
* codegen DeviceProxy. `BaseDevice.runtimeState.setCapState` lazily
|
|
32
|
+
* resolves the proxy and pre-binds `deviceId`.
|
|
33
|
+
*/
|
|
34
|
+
readonly initialRuntimeState?: Record<string, unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* Snapshot of the persisted device-config blob loaded from the
|
|
37
|
+
* per-device DB at boot. Symmetric with `initialRuntimeState` —
|
|
38
|
+
* the kernel pre-loads from disk before the BaseDevice constructor
|
|
39
|
+
* runs so the in-memory `DeviceConfig` wakes up with operator-
|
|
40
|
+
* edited values without the addon having to thread `saved.config`
|
|
41
|
+
* through `kernel.devices.create()`.
|
|
42
|
+
*
|
|
43
|
+
* Optional only to support test harnesses that build a bare ctx;
|
|
44
|
+
* production kernel context factories always populate it.
|
|
45
|
+
*/
|
|
46
|
+
readonly persistedConfig?: Record<string, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* Read-only snapshot of the operator-organisational meta surface
|
|
49
|
+
* (name / location / disabled / type / parentDeviceId / addonId).
|
|
50
|
+
* Loaded by the kernel from the device-meta DB row before the
|
|
51
|
+
* device class constructor runs — `BaseDevice` reads `name` /
|
|
52
|
+
* `location` / `disabled` from here so subclass schemas don't
|
|
53
|
+
* have to duplicate the fields. Mutations go through
|
|
54
|
+
* `devices.setName / setLocation / setDisabled` — `applySettingsPatch`
|
|
55
|
+
* is hardware-config only.
|
|
56
|
+
*
|
|
57
|
+
* Always populated by the kernel in production. Test fixtures must
|
|
58
|
+
* supply a non-null value too — `BaseDevice` constructor throws
|
|
59
|
+
* when missing.
|
|
60
|
+
*/
|
|
61
|
+
readonly deviceMeta: DeviceMeta;
|
|
62
|
+
/**
|
|
63
|
+
* Lazy resolver for a device-scoped facade — same shape as
|
|
64
|
+
* `AddonContext.fetchDevice(id)`. Returns a `DeviceProxy` with
|
|
65
|
+
* `deviceId` pre-bound on every cap method, so callers say
|
|
66
|
+
* `dev.deviceState.setCapSlice({capName, slice})` instead of
|
|
67
|
+
* `ctx.api.deviceState.setCapSlice.mutate({deviceId: ctx.id, ...})`.
|
|
68
|
+
* Always wired by the production context factory; test ctx
|
|
69
|
+
* fixtures supply a stub.
|
|
70
|
+
*/
|
|
71
|
+
readonly fetchDevice: (deviceId: number) => Promise<DeviceProxy>;
|
|
72
|
+
/**
|
|
73
|
+
* Reverse-pointer hook called by `BaseDevice` constructor right
|
|
74
|
+
* after building its `runtimeState`. The kernel context factory
|
|
75
|
+
* stashes the reference so that `registerNativeCap`, fired from
|
|
76
|
+
* inside the same constructor's call chain, can install the cap's
|
|
77
|
+
* `runtimeState` schema onto the device's state without needing
|
|
78
|
+
* the device to be registered in `DeviceRegistry` yet (it isn't —
|
|
79
|
+
* register happens AFTER the constructor returns).
|
|
80
|
+
*
|
|
81
|
+
* Optional for tests / backwards compat — caps with `runtimeState`
|
|
82
|
+
* registered in a context without this hook silently skip schema
|
|
83
|
+
* installation, falling back to memory-only state.
|
|
84
|
+
*/
|
|
85
|
+
readonly bindRuntimeState?: (state: import('./device-runtime-state.js').IDeviceRuntimeState) => void;
|
|
86
|
+
readonly devices: DeviceManagerApi;
|
|
87
|
+
/**
|
|
88
|
+
* Kernel stream-probe entrypoint — same typed contract as the
|
|
89
|
+
* one exposed to addons via `ctx.kernel.streamProbe`. Mirrored
|
|
90
|
+
* onto the device context so devices that reprobe their inputs
|
|
91
|
+
* on edit (e.g. RTSP multi-stream reclassification) never need
|
|
92
|
+
* to branch on transport or reach through `ctx.api`. Optional
|
|
93
|
+
* only to support test harnesses that build a bare ctx.
|
|
94
|
+
*/
|
|
95
|
+
readonly streamProbe?: IKernelStreamProbe;
|
|
96
|
+
/** Register a native provider for `cap` on the device this context belongs to.
|
|
97
|
+
* Multiple calls for the same cap throw. */
|
|
98
|
+
registerNativeCap<TCap extends CapabilityDefinition>(cap: TCap, provider: InferNativeProvider<TCap>): void;
|
|
99
|
+
}
|
|
100
|
+
/** Constructor type for BaseDevice subclasses.
|
|
101
|
+
*
|
|
102
|
+
* Deliberately ONE-ARG: the device class receives only its `ctx`,
|
|
103
|
+
* and the kernel pre-loads the persisted config blob into
|
|
104
|
+
* `ctx.persistedConfig` BEFORE this constructor runs. This makes
|
|
105
|
+
* the device entirely self-managing — no operator-supplied config
|
|
106
|
+
* ever bypasses the per-device DB. Providers create new devices by
|
|
107
|
+
* passing initial config to `kernel.devices.create()` (or
|
|
108
|
+
* `persistInitialConfig` for the advanced flow) which writes to the
|
|
109
|
+
* DB FIRST; the constructor then reads that same blob from
|
|
110
|
+
* `ctx.persistedConfig`.
|
|
111
|
+
*
|
|
112
|
+
* Subclasses with extra constructor args (e.g. accessory child
|
|
113
|
+
* devices that take a `parent` reference) extend this contract by
|
|
114
|
+
* having their own concrete signature; the kernel-side `create()`
|
|
115
|
+
* uses `DeviceConstructor` only for the standard 1-arg path.
|
|
116
|
+
* Custom-arg subclasses go through the lower-level `allocateDeviceId
|
|
117
|
+
* + persistInitialConfig + createContext + register` flow.
|
|
118
|
+
*/
|
|
119
|
+
export type DeviceConstructor<T extends IDevice = IDevice> = new (ctx: DeviceContext) => T;
|
|
120
|
+
export interface DeviceManagerApi {
|
|
121
|
+
/**
|
|
122
|
+
* Create, register, and persist a device in one call.
|
|
123
|
+
* Handles: context creation → instantiation → registry + DB persistence.
|
|
124
|
+
*/
|
|
125
|
+
create<T extends IDevice>(stableId: string, DeviceClass: DeviceConstructor<T>, config: Record<string, unknown>, parentDeviceId?: number | null,
|
|
126
|
+
/**
|
|
127
|
+
* Operator-supplied meta (`name` / `location` / `disabled`) the
|
|
128
|
+
* kernel writes to the meta row BEFORE the device class
|
|
129
|
+
* constructor runs. The constructor reads these via
|
|
130
|
+
* `ctx.deviceMeta`. Mandatory when creating a NEW device — the
|
|
131
|
+
* placeholder `name = stableId` would otherwise stick. Restore
|
|
132
|
+
* paths omit it (the persisted row already carries the
|
|
133
|
+
* operator's edits).
|
|
134
|
+
*/
|
|
135
|
+
initialMeta?: InitialDeviceMeta): Promise<T>;
|
|
136
|
+
/**
|
|
137
|
+
* Reserve (or re-resolve) the progressive numeric id for a given
|
|
138
|
+
* `(addonId, stableId)` pair. Idempotent: repeated calls for the same
|
|
139
|
+
* stableId return the same id — allocation only happens the first time.
|
|
140
|
+
* Callers that bypass `create()` (boot-restore, discovery adoption) call
|
|
141
|
+
* this first so `createContext` and `BaseDevice` have the id to bind.
|
|
142
|
+
*/
|
|
143
|
+
allocateDeviceId(stableId: string): Promise<number>;
|
|
144
|
+
/** Low-level context creation (for hub devices managing children).
|
|
145
|
+
* `id` MUST come from `allocateDeviceId` — feeding it here binds
|
|
146
|
+
* `DeviceContext.id` so `BaseDevice` exposes it on `IDevice.id`.
|
|
147
|
+
*
|
|
148
|
+
* `persistedConfig` is stuffed into `DeviceContext.persistedConfig`
|
|
149
|
+
* so the device's BaseDevice constructor self-hydrates. Pass the
|
|
150
|
+
* result of `loadConfig(id)` for the restore path; default `{}` for
|
|
151
|
+
* a fresh device. Callers wired through `kernel.devices.create()`
|
|
152
|
+
* don't need to think about this — the standard `create()` shortcut
|
|
153
|
+
* loads it automatically. */
|
|
154
|
+
createContext(stableId: string, id: number, parentDeviceId?: number | null, persistedConfig?: Record<string, unknown>): DeviceContext;
|
|
155
|
+
/** Read the per-device persisted config blob from the DB. Returns
|
|
156
|
+
* `{}` for devices that have no persisted row yet (newly allocated
|
|
157
|
+
* but not registered). Used by callers going through the manual
|
|
158
|
+
* `allocateDeviceId + createContext + register` flow (e.g. accessory
|
|
159
|
+
* child devices that need a custom-arg constructor) to self-hydrate
|
|
160
|
+
* the child without threading `saved.config` from the addon's
|
|
161
|
+
* `onRestoreDevices` boundary. */
|
|
162
|
+
loadConfig(deviceId: number): Promise<Record<string, unknown>>;
|
|
163
|
+
/** Pre-persist an initial config blob to the per-device DB BEFORE
|
|
164
|
+
* the device class is instantiated. The constructor then reads
|
|
165
|
+
* the same blob via `ctx.persistedConfig`. Mandatory when a
|
|
166
|
+
* provider needs to seed a NEW device with operator-supplied
|
|
167
|
+
* config (form input from the Add-Device modal) — the device
|
|
168
|
+
* class never receives the config directly, only via the DB.
|
|
169
|
+
* Idempotent: calling for an already-persisted id overwrites the
|
|
170
|
+
* blob (used for re-seed flows like "operator re-edits during
|
|
171
|
+
* initial wizard"). */
|
|
172
|
+
persistInitialConfig(stableId: string, config: Record<string, unknown>): Promise<number>;
|
|
173
|
+
/** Update the device's display name. Surfaces immediately in
|
|
174
|
+
* the UI device list + on `IDevice.name` for live consumers. */
|
|
175
|
+
setName(deviceId: number, name: string): Promise<void>;
|
|
176
|
+
/** Set the operator-organisational location label
|
|
177
|
+
* ("Kitchen" / "Front yard" / …). Pass `null` to clear. */
|
|
178
|
+
setLocation(deviceId: number, location: string | null): Promise<void>;
|
|
179
|
+
/** Soft-disable the device. Disabled devices stay in the registry
|
|
180
|
+
* + DB so the operator can flip back on without re-adding, but
|
|
181
|
+
* BaseDevice gates lifecycle hooks (publishToBroker, alarm-stream
|
|
182
|
+
* subscribe, …) to skip work. */
|
|
183
|
+
setDisabled(deviceId: number, disabled: boolean): Promise<void>;
|
|
184
|
+
/** Low-level registration (for advanced use cases) */
|
|
185
|
+
register(device: IDevice): Promise<void>;
|
|
186
|
+
/** Remove a device and all its children (cascading) */
|
|
187
|
+
remove(deviceId: number): Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Tear a device (and its children) down in-memory WITHOUT touching
|
|
190
|
+
* the persisted device-meta / config / bindings. Used by addon
|
|
191
|
+
* shutdown paths (graceful SIGTERM in group-runner, in-process
|
|
192
|
+
* `restartAddon`) so each device's `removeDevice()` lifecycle hook
|
|
193
|
+
* fires (closes alarm streams, ISAPI clients, polling timers,
|
|
194
|
+
* intercom sessions, …) and native caps unregister cleanly. The
|
|
195
|
+
* persisted index remains intact so the next boot's
|
|
196
|
+
* `restoreDevices` rehydrates the same set.
|
|
197
|
+
*
|
|
198
|
+
* Difference from `remove(id)`: same in-memory teardown, but no
|
|
199
|
+
* `device-manager.removeDevice` call. Use `remove` when the operator
|
|
200
|
+
* deletes a device from the UI; use `decommission` for restart /
|
|
201
|
+
* shutdown lifecycle paths where the device should reappear on
|
|
202
|
+
* the next boot.
|
|
203
|
+
*/
|
|
204
|
+
decommission(deviceId: number): Promise<void>;
|
|
205
|
+
/** List all devices for this addon */
|
|
206
|
+
getAll(): Promise<ReadonlyArray<IDevice>>;
|
|
207
|
+
/** List children of a specific device */
|
|
208
|
+
getChildren(parentDeviceId: number): Promise<ReadonlyArray<IDevice>>;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Read-only global view of the kernel `DeviceRegistry`, exposed to addons
|
|
212
|
+
* that need to observe devices across ALL addons (not just their own).
|
|
213
|
+
*
|
|
214
|
+
* Typical consumers are infrastructure addons that provide a service
|
|
215
|
+
* to every device in the system — e.g. `addon-stream-broker` registers
|
|
216
|
+
* stream sources for every camera regardless of which provider addon
|
|
217
|
+
* instantiated it, so it needs to enumerate cameras coming from
|
|
218
|
+
* `addon-provider-rtsp`, `addon-provider-frigate`, etc.
|
|
219
|
+
*
|
|
220
|
+
* The interface is deliberately read-only: addons can list / query but
|
|
221
|
+
* never mutate the registry. Mutations still go through the per-addon
|
|
222
|
+
* `DeviceManagerApi` (`ctx.devices`) so each addon only creates devices
|
|
223
|
+
* under its own id.
|
|
224
|
+
*/
|
|
225
|
+
export interface IDeviceRegistryReader {
|
|
226
|
+
/** Return every device across every addon. Snapshot — does not subscribe. */
|
|
227
|
+
getAll(): readonly IDevice[];
|
|
228
|
+
/** Look up any registered device by its progressive numeric id. */
|
|
229
|
+
getById(id: number): IDevice | null;
|
|
230
|
+
/** Owning addonId for a registered numeric id, or null if unknown. */
|
|
231
|
+
getAddonId(id: number): string | null;
|
|
232
|
+
/** Return every child of a parent device. */
|
|
233
|
+
getChildren(parentDeviceId: number): readonly IDevice[];
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Full device registry — extends the reader with listing helpers and
|
|
237
|
+
* mutation methods. Exposed on `AddonContext.deviceRegistry` for
|
|
238
|
+
* infrastructure addons that manage devices across all providers
|
|
239
|
+
* (e.g. `device-manager`).
|
|
240
|
+
*
|
|
241
|
+
* Hub-only: agents/workers don't have a local device registry.
|
|
242
|
+
*/
|
|
243
|
+
export interface IDeviceRegistry extends IDeviceRegistryReader {
|
|
244
|
+
/** Return all devices for a specific addon. */
|
|
245
|
+
getAllForAddon(addonId: string): readonly IDevice[];
|
|
246
|
+
/** Return every device paired with its owning addon id. */
|
|
247
|
+
getAllWithAddonId(): readonly {
|
|
248
|
+
addonId: string;
|
|
249
|
+
device: IDevice;
|
|
250
|
+
}[];
|
|
251
|
+
/** Return all addon ids that have registered devices. */
|
|
252
|
+
getAddonIds(): readonly string[];
|
|
253
|
+
/** Remove a device from the registry. */
|
|
254
|
+
remove(deviceId: number): void;
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=device-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-context.d.ts","sourceRoot":"","sources":["../../src/device/device-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAA;AACzG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE3E,MAAM,WAAW,aAAa;IAC5B;;4EAEwE;IACxE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB;gFAC4E;IAC5E,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CA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z } from 'zod';
|
|
2
|
+
import type { DeviceType } from './device-type.js';
|
|
3
|
+
import type { IDevice } from './device.js';
|
|
4
|
+
export interface DeviceManualCreation {
|
|
5
|
+
getChildCreationSchema(type: DeviceType): z.ZodObject<z.core.$ZodLooseShape>;
|
|
6
|
+
createDevice(type: DeviceType, config: unknown): Promise<IDevice>;
|
|
7
|
+
}
|
|
8
|
+
export interface DeviceDiscovery {
|
|
9
|
+
discoverDevices(): Promise<readonly DiscoveredDevice[]>;
|
|
10
|
+
adoptDiscoveredDevice(candidate: DiscoveredDevice): Promise<IDevice>;
|
|
11
|
+
}
|
|
12
|
+
export interface DiscoveredDevice {
|
|
13
|
+
readonly stableId: string;
|
|
14
|
+
readonly type: DeviceType;
|
|
15
|
+
readonly suggestedName: string;
|
|
16
|
+
readonly prefilledConfig: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface SavedDevice {
|
|
19
|
+
/** Numeric id reserved at allocateDeviceId time. */
|
|
20
|
+
readonly id: number;
|
|
21
|
+
/** External-system identifier — passed to `kernel.devices.create()`. */
|
|
22
|
+
readonly stableId: string;
|
|
23
|
+
readonly type: DeviceType;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
/**
|
|
26
|
+
* Operator-organisational label (room / location / area). `null`
|
|
27
|
+
* when unset. Free-text — providers don't interpret it; the UI
|
|
28
|
+
* groups devices by this field for "show me all cameras in
|
|
29
|
+
* Kitchen" filters.
|
|
30
|
+
*/
|
|
31
|
+
readonly location: string | null;
|
|
32
|
+
/**
|
|
33
|
+
* Soft-disabled flag. When `true`, the device class is still
|
|
34
|
+
* instantiated and visible in the UI (so the operator can flip it
|
|
35
|
+
* back on without re-adding) but lifecycle hooks
|
|
36
|
+
* (publishToBroker, alarm-stream subscribe, …) are gated off by
|
|
37
|
+
* BaseDevice. Used for "this camera is in maintenance" without
|
|
38
|
+
* destroying its persisted config + bindings + per-device settings.
|
|
39
|
+
*/
|
|
40
|
+
readonly disabled: boolean;
|
|
41
|
+
readonly parentDeviceId: number | null;
|
|
42
|
+
readonly config: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Read-only snapshot of the device-meta surface, exposed on
|
|
46
|
+
* `DeviceContext.deviceMeta`. The kernel populates it before the
|
|
47
|
+
* device class constructor runs so `BaseDevice` can resolve
|
|
48
|
+
* `name` / `location` / `disabled` without each subclass
|
|
49
|
+
* duplicating those fields in its config schema.
|
|
50
|
+
*
|
|
51
|
+
* Mutations go through `kernel.devices.{setName,setLocation,
|
|
52
|
+
* setDisabled}` — never through `applySettingsPatch`. The two
|
|
53
|
+
* surfaces are deliberately disjoint: `meta` is operator-organisational
|
|
54
|
+
* (free-text labels, on/off toggle), `config` is hardware-specific
|
|
55
|
+
* (host, port, credentials, debug flags, deviceCache).
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* Free-form device metadata — hardware identity + driver-populated
|
|
59
|
+
* facts the operator can both read and edit. Mirrors Scrypted's
|
|
60
|
+
* `info: { manufacturer, model, serialNumber, ... }` device-level
|
|
61
|
+
* surface but stored as a single JSON blob so future fields (HA
|
|
62
|
+
* matter id, ONVIF profile token, …) don't require schema changes.
|
|
63
|
+
*
|
|
64
|
+
* Conventional keys (drivers should populate when known):
|
|
65
|
+
* - `manufacturer` e.g. 'Reolink'
|
|
66
|
+
* - `model` e.g. 'Argus PT Ultra'
|
|
67
|
+
* - `serialNumber`
|
|
68
|
+
* - `firmware` software version
|
|
69
|
+
* - `hardware` hardware revision
|
|
70
|
+
* - `mac` MAC address
|
|
71
|
+
* - `uid` vendor-specific globally-unique id (Reolink, etc.)
|
|
72
|
+
*
|
|
73
|
+
* Anything else the driver knows can land alongside (`onvifProfile`,
|
|
74
|
+
* `ipAddress`, `apiPort`, …). All values must be JSON-serializable.
|
|
75
|
+
*/
|
|
76
|
+
export type DeviceMetadata = Record<string, unknown>;
|
|
77
|
+
export interface DeviceMeta {
|
|
78
|
+
readonly id: number;
|
|
79
|
+
readonly stableId: string;
|
|
80
|
+
readonly addonId: string;
|
|
81
|
+
readonly type: DeviceType;
|
|
82
|
+
readonly name: string;
|
|
83
|
+
readonly location: string | null;
|
|
84
|
+
readonly disabled: boolean;
|
|
85
|
+
readonly parentDeviceId: number | null;
|
|
86
|
+
/** Hardware + identity blob; null when nothing has been populated yet. */
|
|
87
|
+
readonly metadata: DeviceMetadata | null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Initial meta a provider supplies on `onCreateDevice`. Differs
|
|
91
|
+
* from `DeviceMeta` in that `id` / `stableId` / `addonId` are
|
|
92
|
+
* kernel-allocated, not operator-supplied.
|
|
93
|
+
*/
|
|
94
|
+
export interface InitialDeviceMeta {
|
|
95
|
+
readonly type: DeviceType;
|
|
96
|
+
readonly name: string;
|
|
97
|
+
readonly location?: string | null;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Single-call payload returned by `BaseDeviceProvider.onCreateDevice`.
|
|
101
|
+
* Splits operator-organisational labels (`meta`) from hardware-
|
|
102
|
+
* specific config (`config`) — kernel handles the rest:
|
|
103
|
+
* stableId allocation, persistence, instantiation, register.
|
|
104
|
+
*
|
|
105
|
+
* `onAfterCreate` is the escape hatch for providers that need to
|
|
106
|
+
* inject creation-time-only state into the freshly-built device
|
|
107
|
+
* (e.g. Reolink's autodetect handshake hands a live Baichuan API
|
|
108
|
+
* instance; adoption skips a second login). Fires AFTER `register`
|
|
109
|
+
* + `device.onCreated` + accessory auto-spawn complete — the
|
|
110
|
+
* device is fully alive when the callback runs. Best-effort:
|
|
111
|
+
* failures log but don't unwind the already-registered device.
|
|
112
|
+
*/
|
|
113
|
+
export interface CreateDeviceSpec {
|
|
114
|
+
readonly meta: InitialDeviceMeta;
|
|
115
|
+
readonly config: Record<string, unknown>;
|
|
116
|
+
readonly onAfterCreate?: (device: IDevice) => Promise<void> | void;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=device-management.d.ts.map
|
|
@@ -0,0 +1 @@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AG,IAAI,CAAA;CACnE"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bindings × Modes contract
|
|
3
|
+
* ─────────────────────────
|
|
4
|
+
*
|
|
5
|
+
* Two independent layers gate every analyzer phase (detection / audio):
|
|
6
|
+
*
|
|
7
|
+
* 1. **Bindings** (low-level wiring, escape hatch)
|
|
8
|
+
* The cap-router decides whether the addon is MOUNTED for a
|
|
9
|
+
* device at all. `setWrapperActive(deviceId, capName, false)`
|
|
10
|
+
* fully dismounts the cap; nothing the cap exposes (provider
|
|
11
|
+
* methods, runtime-state, events) is reachable. The operator
|
|
12
|
+
* rarely touches this from the UI — it's the "uninstall this
|
|
13
|
+
* addon for this device" button. Default: every wrapper bound.
|
|
14
|
+
*
|
|
15
|
+
* 2. **Modes** (operator-facing scheduling)
|
|
16
|
+
* The `detectionMode` / `audioMode` selectors decide WHEN the
|
|
17
|
+
* mounted cap actually fires. `'disabled'` is the runtime-level
|
|
18
|
+
* off switch — the cap stays mounted, schema present, RPCs
|
|
19
|
+
* callable, but the runner / orchestrator skip the substream
|
|
20
|
+
* subscriber. The other 2 modes (`'always-on'`, `'on-motion'`)
|
|
21
|
+
* drive when the subscribe + analyze cycle runs.
|
|
22
|
+
*
|
|
23
|
+
* **AND-gate semantics**: a phase fires iff `(binding bound) AND
|
|
24
|
+
* (mode != 'disabled')`. Either layer disables → cap inactive.
|
|
25
|
+
* Neither layer overrides the other; the operator picks whichever
|
|
26
|
+
* lever maps to their intent.
|
|
27
|
+
*
|
|
28
|
+
* - "I never want SW detection on this camera" → unbind via
|
|
29
|
+
* bindings UI (extreme — also disables the cap surface).
|
|
30
|
+
* - "Pause detection for now, keep wired" → set
|
|
31
|
+
* `detectionMode = 'disabled'`. Settings still surface; no
|
|
32
|
+
* substream demand.
|
|
33
|
+
* - "Detection only when motion fires" → `detectionMode = 'on-motion'`,
|
|
34
|
+
* binding stays bound.
|
|
35
|
+
*
|
|
36
|
+
* Profile defaults populate modes when the operator hasn't picked.
|
|
37
|
+
* Bindings are bound by their wrappers' `defaultActive: true` flag,
|
|
38
|
+
* unaffected by the profile.
|
|
39
|
+
*
|
|
40
|
+
* ─────────────────────────
|
|
41
|
+
*
|
|
42
|
+
* DeviceProfile — declarative defaults applied to devices that match a
|
|
43
|
+
* feature predicate.
|
|
44
|
+
*
|
|
45
|
+
* Solves the "battery cams shouldn't run continuous analyzers" problem
|
|
46
|
+
* (and adjacent policy questions like low-bandwidth fallback) by
|
|
47
|
+
* centralising the operator-facing defaults in ONE place. The profile
|
|
48
|
+
* does NOT touch capability bindings — those stay as the low-level
|
|
49
|
+
* wiring escape hatch. Instead the profile drives the per-device
|
|
50
|
+
* pipeline behaviour through three operator-visible "mode" knobs that
|
|
51
|
+
* the runner / orchestrator interpret directly.
|
|
52
|
+
*
|
|
53
|
+
* - `motionSources` — already a per-device setting today; the profile
|
|
54
|
+
* just supplies a sensible default (`['onboard']` when firmware
|
|
55
|
+
* motion is available; `[]` otherwise so a battery cam with no PIR
|
|
56
|
+
* and no firmware push gates everything off until the operator opts
|
|
57
|
+
* into `'analyzer'` SW motion).
|
|
58
|
+
*
|
|
59
|
+
* - `audioMode` (NEW) — selects when the audio classifier runs:
|
|
60
|
+
* `'disabled'`, `'always-on'`, `'on-motion'`. Replaces the implicit
|
|
61
|
+
* "audio runs when wrapper bound" behaviour. Wrappers stay bound;
|
|
62
|
+
* the addon reads this mode at runtime to decide whether to
|
|
63
|
+
* subscribe to the audio decoded stream.
|
|
64
|
+
*
|
|
65
|
+
* - `detectionMode` (NEW) — selects when object detection runs:
|
|
66
|
+
* `'disabled'`, `'always-on'`, `'on-motion'`. Mirrors `audioMode`
|
|
67
|
+
* and replaces the legacy `priority: 'default'|'always-on'` toggle
|
|
68
|
+
* with explicit semantics.
|
|
69
|
+
*
|
|
70
|
+
* ─── Sticky-by-construction ───────────────────────────────────────────
|
|
71
|
+
*
|
|
72
|
+
* Nothing in the runtime re-applies a profile. Operator changes always
|
|
73
|
+
* win because the persistence layer captures them as concrete entries
|
|
74
|
+
* (config blob value); the profile is consulted only when no entry
|
|
75
|
+
* exists yet. If a setting is absent from the blob the resolver falls
|
|
76
|
+
* back to the profile's default, then the schema's static default.
|
|
77
|
+
*/
|
|
78
|
+
import type { DeviceFeature } from './device-type.js';
|
|
79
|
+
/**
|
|
80
|
+
* Match clause: the profile applies to a device iff its `features`
|
|
81
|
+
* array contains `hasFeature`. Single-feature gate keeps matching
|
|
82
|
+
* cheap; the profile-stack iterates in order and the first match wins.
|
|
83
|
+
*/
|
|
84
|
+
export interface DeviceProfileMatch {
|
|
85
|
+
readonly hasFeature: DeviceFeature;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* When-mode selector for analyzer phases (audio classification, object
|
|
89
|
+
* detection). `'disabled'` keeps the addon idle; `'always-on'` runs
|
|
90
|
+
* continuously; `'on-motion'` activates only when the motion-gate is
|
|
91
|
+
* open (firmware motion event OR analyzer-derived motion).
|
|
92
|
+
*/
|
|
93
|
+
export type PipelinePhaseMode = 'disabled' | 'always-on' | 'on-motion';
|
|
94
|
+
/**
|
|
95
|
+
* Operator-facing settings the profile populates at creation time +
|
|
96
|
+
* resolver fallback time. These are NOT tightly bound to a single
|
|
97
|
+
* config schema field — the resolver (in pipeline-orchestrator) reads
|
|
98
|
+
* them when computing the runner config, and persists operator changes
|
|
99
|
+
* back to the same keys via the existing per-device store.
|
|
100
|
+
*/
|
|
101
|
+
export interface DeviceProfileDefaults {
|
|
102
|
+
/** Default `motionSources` array when the operator hasn't picked
|
|
103
|
+
* one. Empty array means "no motion source" — useful for battery
|
|
104
|
+
* cams without firmware motion (operator opts into `'analyzer'`
|
|
105
|
+
* explicitly to enable SW motion). PIR-sourced motion currently
|
|
106
|
+
* flows through `'onboard'` because Reolink's accessory PIRs feed
|
|
107
|
+
* the parent camera's firmware motion event channel. */
|
|
108
|
+
readonly motionSources?: readonly ('onboard' | 'analyzer')[];
|
|
109
|
+
readonly audioMode?: PipelinePhaseMode;
|
|
110
|
+
readonly detectionMode?: PipelinePhaseMode;
|
|
111
|
+
}
|
|
112
|
+
export interface DeviceProfile {
|
|
113
|
+
readonly id: string;
|
|
114
|
+
readonly label: string;
|
|
115
|
+
readonly when: DeviceProfileMatch;
|
|
116
|
+
/**
|
|
117
|
+
* Default phase modes + motion-source pick. Resolver reads these
|
|
118
|
+
* when no operator value is persisted; profile never overrides a
|
|
119
|
+
* concrete operator choice.
|
|
120
|
+
*/
|
|
121
|
+
readonly defaults: DeviceProfileDefaults;
|
|
122
|
+
/**
|
|
123
|
+
* Generic settings overrides (snapshot interval, pre-buffer flag,
|
|
124
|
+
* etc.). Same sticky semantics as defaults — applied on first read,
|
|
125
|
+
* operator override wins. Keys are dot-paths interpreted by the
|
|
126
|
+
* per-driver / per-addon config schema.
|
|
127
|
+
*/
|
|
128
|
+
readonly settings: Readonly<Record<string, unknown>>;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Heuristic check — `device.features?.includes(profile.when.hasFeature)`.
|
|
132
|
+
*/
|
|
133
|
+
export declare function deviceMatchesProfile(features: readonly string[] | undefined, profile: DeviceProfile): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Battery-operated cameras default policy. The substream stays dialed
|
|
136
|
+
* only when there's something for the runner to actually process —
|
|
137
|
+
* audio is off, detection only runs on motion.
|
|
138
|
+
*
|
|
139
|
+
* `motionSources` is NOT in the profile defaults: the orchestrator's
|
|
140
|
+
* resolver already prefers `'onboard'` whenever the device exposes a
|
|
141
|
+
* native motion cap (firmware-driven motion), independent of profile.
|
|
142
|
+
* Battery cams without firmware motion fall back to `[]` (no source) —
|
|
143
|
+
* the operator must opt into `'analyzer'` SW motion explicitly.
|
|
144
|
+
*
|
|
145
|
+
* Object detection on motion: when motion fires, the runner attaches
|
|
146
|
+
* the substream + runs detection until the motion gate closes, then
|
|
147
|
+
* releases. Firmware idle-disconnect fires shortly after, the camera
|
|
148
|
+
* goes back to sleep.
|
|
149
|
+
*/
|
|
150
|
+
export declare const BATTERY_DEVICE_PROFILE: DeviceProfile;
|
|
151
|
+
/**
|
|
152
|
+
* Profile registry — order matters when multiple profiles match the
|
|
153
|
+
* same device (first match wins). Today there's only one entry.
|
|
154
|
+
*/
|
|
155
|
+
export declare const DEVICE_PROFILES: readonly DeviceProfile[];
|
|
156
|
+
/**
|
|
157
|
+
* Resolve the profile that matches a device's features, or `null` when
|
|
158
|
+
* no profile matches. First-match-wins.
|
|
159
|
+
*/
|
|
160
|
+
export declare function resolveDeviceProfile(features: readonly string[] | undefined): DeviceProfile | null;
|
|
161
|
+
//# sourceMappingURL=device-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device-profile.d.ts","sourceRoot":"","sources":["../../src/device/device-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGrD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAA;CACnC;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,WAAW,GACX,WAAW,CAAA;AAEf;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;6DAKyD;IACzD,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC,SAAS,GAAG,UAAU,CAAC,EAAE,CAAA;IAC5D,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAA;IACtC,QAAQ,CAAC,aAAa,CAAC,EAAE,iBAAiB,CAAA;CAC3C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IA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