@camstack/types 0.1.41 → 0.2.0
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 +0 -1
- package/dist/addon/build-addon-route-provider.d.ts +0 -1
- package/dist/addon/durable-state.d.ts +0 -1
- package/dist/capabilities/accessories.cap.d.ts +0 -1
- package/dist/capabilities/addon-pages-source.cap.d.ts +0 -1
- package/dist/capabilities/addon-pages.cap.d.ts +0 -1
- package/dist/capabilities/addon-routes.cap.d.ts +0 -1
- package/dist/capabilities/addon-settings.cap.d.ts +0 -1
- package/dist/capabilities/addon-widgets-source.cap.d.ts +0 -1
- package/dist/capabilities/addon-widgets.cap.d.ts +0 -1
- package/dist/capabilities/addons.cap.d.ts +0 -1
- package/dist/capabilities/admin-ui.cap.d.ts +0 -1
- package/dist/capabilities/advanced-notifier.cap.d.ts +0 -1
- package/dist/capabilities/air-quality-sensor.cap.d.ts +0 -1
- package/dist/capabilities/alarm-panel.cap.d.ts +0 -1
- package/dist/capabilities/alerts.cap.d.ts +0 -1
- package/dist/capabilities/ambient-light-sensor.cap.d.ts +0 -1
- package/dist/capabilities/audio-analysis.cap.d.ts +0 -1
- package/dist/capabilities/audio-analyzer.cap.d.ts +1 -2
- package/dist/capabilities/audio-codec.cap.d.ts +0 -1
- package/dist/capabilities/audio-metrics.cap.d.ts +0 -1
- package/dist/capabilities/auth-provider.cap.d.ts +0 -1
- package/dist/capabilities/automation-control.cap.d.ts +0 -1
- package/dist/capabilities/backup.cap.d.ts +0 -1
- package/dist/capabilities/battery.cap.d.ts +0 -1
- package/dist/capabilities/binary.cap.d.ts +0 -1
- package/dist/capabilities/brightness.cap.d.ts +0 -1
- package/dist/capabilities/broker.cap.d.ts +0 -1
- package/dist/capabilities/button.cap.d.ts +0 -1
- package/dist/capabilities/camera-credentials.cap.d.ts +0 -1
- package/dist/capabilities/camera-pipeline-config.cap.d.ts +0 -1
- package/dist/capabilities/camera-streams.cap.d.ts +0 -1
- package/dist/capabilities/capability-definition.d.ts +0 -1
- package/dist/capabilities/carbon-monoxide.cap.d.ts +0 -1
- package/dist/capabilities/climate-control.cap.d.ts +0 -1
- package/dist/capabilities/color.cap.d.ts +0 -1
- package/dist/capabilities/connectivity.cap.d.ts +0 -1
- package/dist/capabilities/consumables.cap.d.ts +0 -1
- package/dist/capabilities/contact.cap.d.ts +0 -1
- package/dist/capabilities/control.cap.d.ts +0 -1
- package/dist/capabilities/cover.cap.d.ts +0 -1
- package/dist/capabilities/custom-actions.d.ts +0 -1
- package/dist/capabilities/decoder.cap.d.ts +0 -1
- package/dist/capabilities/detection-pipeline.cap.d.ts +0 -1
- package/dist/capabilities/device-adoption.cap.d.ts +0 -1
- package/dist/capabilities/device-discovery.cap.d.ts +0 -1
- package/dist/capabilities/device-export.cap.d.ts +0 -1
- package/dist/capabilities/device-manager.cap.d.ts +1 -2
- package/dist/capabilities/device-ops.cap.d.ts +0 -1
- package/dist/capabilities/device-provider.cap.d.ts +0 -1
- package/dist/capabilities/device-state.cap.d.ts +0 -1
- package/dist/capabilities/device-status.cap.d.ts +0 -1
- package/dist/capabilities/doorbell.cap.d.ts +0 -1
- package/dist/capabilities/embedding-encoder.cap.d.ts +0 -1
- package/dist/capabilities/enum-sensor.cap.d.ts +0 -1
- package/dist/capabilities/event-emitter.cap.d.ts +0 -1
- package/dist/capabilities/events.cap.d.ts +0 -1
- package/dist/capabilities/face-gallery.cap.d.ts +157 -0
- package/dist/capabilities/fan-control.cap.d.ts +0 -1
- package/dist/capabilities/feature-probe.cap.d.ts +0 -1
- package/dist/capabilities/filesystem-browse.cap.d.ts +38 -0
- package/dist/capabilities/flood.cap.d.ts +0 -1
- package/dist/capabilities/gas.cap.d.ts +0 -1
- package/dist/capabilities/humidifier.cap.d.ts +0 -1
- package/dist/capabilities/humidity-sensor.cap.d.ts +0 -1
- package/dist/capabilities/image.cap.d.ts +0 -1
- package/dist/capabilities/index.d.ts +56 -51
- package/dist/capabilities/integrations.cap.d.ts +0 -1
- package/dist/capabilities/intercom.cap.d.ts +0 -1
- package/dist/capabilities/lawn-mower-control.cap.d.ts +0 -1
- package/dist/capabilities/local-network.cap.d.ts +0 -1
- package/dist/capabilities/lock-control.cap.d.ts +0 -1
- package/dist/capabilities/log-destination.cap.d.ts +0 -1
- package/dist/capabilities/mask-shape.d.ts +0 -1
- package/dist/capabilities/media-player.cap.d.ts +0 -1
- package/dist/capabilities/mesh-network.cap.d.ts +0 -1
- package/dist/capabilities/metrics-provider.cap.d.ts +0 -1
- package/dist/capabilities/motion-detection.cap.d.ts +0 -1
- package/dist/capabilities/motion-trigger.cap.d.ts +0 -1
- package/dist/capabilities/motion-zones.cap.d.ts +0 -1
- package/dist/capabilities/motion.cap.d.ts +0 -1
- package/dist/capabilities/mqtt-broker.cap.d.ts +0 -1
- package/dist/capabilities/native-object-detection.cap.d.ts +0 -1
- package/dist/capabilities/network-access.cap.d.ts +0 -1
- package/dist/capabilities/network-quality.cap.d.ts +1 -2
- package/dist/capabilities/nodes.cap.d.ts +0 -1
- package/dist/capabilities/notification-output.cap.d.ts +0 -1
- package/dist/capabilities/notifier.cap.d.ts +0 -1
- package/dist/capabilities/numeric-sensor.cap.d.ts +0 -1
- package/dist/capabilities/oauth-integration.cap.d.ts +0 -1
- package/dist/capabilities/osd.cap.d.ts +0 -1
- package/dist/capabilities/pipeline-analytics.cap.d.ts +69 -2
- package/dist/capabilities/pipeline-executor.cap.d.ts +0 -1
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts +0 -1
- package/dist/capabilities/pipeline-runner.cap.d.ts +4 -1
- package/dist/capabilities/plate-gallery.cap.d.ts +100 -0
- package/dist/capabilities/platform-probe.cap.d.ts +0 -1
- package/dist/capabilities/power-meter.cap.d.ts +0 -1
- package/dist/capabilities/presence.cap.d.ts +0 -1
- package/dist/capabilities/pressure-sensor.cap.d.ts +0 -1
- package/dist/capabilities/privacy-mask.cap.d.ts +0 -1
- package/dist/capabilities/ptz-autotrack.cap.d.ts +0 -1
- package/dist/capabilities/ptz.cap.d.ts +1 -2
- package/dist/capabilities/reboot.cap.d.ts +0 -1
- package/dist/capabilities/recording.cap.d.ts +191 -1
- package/dist/capabilities/restreamer.cap.d.ts +0 -1
- package/dist/capabilities/schemas/detection-shared.d.ts +0 -1
- package/dist/capabilities/schemas/orchestrator-metrics.d.ts +0 -1
- package/dist/capabilities/schemas/streaming-shared.d.ts +0 -1
- package/dist/capabilities/schemas/zone-rule.d.ts +0 -1
- package/dist/capabilities/script-runner.cap.d.ts +0 -1
- package/dist/capabilities/settings-store.cap.d.ts +0 -1
- package/dist/capabilities/smoke.cap.d.ts +0 -1
- package/dist/capabilities/smtp-provider.cap.d.ts +0 -1
- package/dist/capabilities/snapshot-provider.cap.d.ts +0 -1
- package/dist/capabilities/snapshot.cap.d.ts +0 -1
- package/dist/capabilities/sso-bridge.cap.d.ts +0 -1
- package/dist/capabilities/storage-evictable.cap.d.ts +0 -1
- package/dist/capabilities/storage-provider.cap.d.ts +15 -1
- package/dist/capabilities/storage.cap.d.ts +6 -1
- package/dist/capabilities/stream-broker.cap.d.ts +16 -1
- package/dist/capabilities/stream-catalog.cap.d.ts +0 -1
- package/dist/capabilities/stream-params-config-schema.d.ts +0 -1
- package/dist/capabilities/stream-params.cap.d.ts +0 -1
- package/dist/capabilities/streaming-engine.cap.d.ts +0 -1
- package/dist/capabilities/switch.cap.d.ts +0 -1
- package/dist/capabilities/system.cap.d.ts +1 -2
- package/dist/capabilities/tamper.cap.d.ts +0 -1
- package/dist/capabilities/temperature-sensor.cap.d.ts +0 -1
- package/dist/capabilities/toast.cap.d.ts +0 -1
- package/dist/capabilities/turn-provider.cap.d.ts +1 -2
- package/dist/capabilities/update.cap.d.ts +0 -1
- package/dist/capabilities/user-management.cap.d.ts +0 -1
- package/dist/capabilities/user-passkeys.cap.d.ts +1 -2
- package/dist/capabilities/vacuum-control.cap.d.ts +0 -1
- package/dist/capabilities/valve.cap.d.ts +0 -1
- package/dist/capabilities/vibration.cap.d.ts +0 -1
- package/dist/capabilities/videoclips.cap.d.ts +76 -0
- package/dist/capabilities/water-heater.cap.d.ts +0 -1
- package/dist/capabilities/weather.cap.d.ts +0 -1
- package/dist/capabilities/webrtc-session.cap.d.ts +0 -1
- package/dist/capabilities/webrtc.cap.d.ts +0 -1
- package/dist/capabilities/zone-analytics.cap.d.ts +0 -1
- package/dist/capabilities/zone-rules.cap.d.ts +0 -1
- package/dist/capabilities/zones.cap.d.ts +0 -1
- package/dist/catalogs/audio-classmap.d.ts +0 -1
- package/dist/catalogs/coco-classmap.d.ts +0 -1
- package/dist/catalogs/index.d.ts +0 -1
- package/dist/constants.d.ts +1 -2
- package/dist/deps/binary-downloader.d.ts +0 -1
- package/dist/deps/ffmpeg-downloader.d.ts +0 -1
- package/dist/deps/index.d.ts +1 -2
- package/dist/deps/python-downloader.d.ts +0 -1
- package/dist/device/accessory.d.ts +1 -2
- package/dist/device/base-device-provider.d.ts +0 -1
- package/dist/device/base-device.d.ts +0 -1
- package/dist/device/camera-device.d.ts +0 -1
- package/dist/device/device-binding.d.ts +0 -1
- package/dist/device/device-config.d.ts +0 -1
- package/dist/device/device-context.d.ts +1 -2
- package/dist/device/device-link-transform.d.ts +0 -1
- package/dist/device/device-management.d.ts +0 -1
- package/dist/device/device-profile.d.ts +0 -1
- package/dist/device/device-runtime-state.d.ts +0 -1
- package/dist/device/device-state-handle.d.ts +0 -1
- package/dist/device/device-type.d.ts +0 -1
- package/dist/device/device.d.ts +0 -1
- package/dist/device/features.d.ts +0 -1
- package/dist/device/index.d.ts +5 -6
- package/dist/device/path-util.d.ts +0 -1
- package/dist/device/runtime-state-helpers.d.ts +0 -1
- package/dist/device/schema-fields.d.ts +0 -1
- package/dist/device/source-info.d.ts +0 -1
- package/dist/device/system-mirror.d.ts +0 -1
- package/dist/device/zod-to-config-ui.d.ts +0 -1
- package/dist/disposer-chain.d.ts +0 -1
- package/dist/encode-profile.d.ts +0 -1
- package/dist/enums/event-category.d.ts +12 -2
- package/dist/enums/event-source-type.d.ts +0 -1
- package/dist/enums/index.d.ts +0 -1
- package/dist/generated/addon-api.d.ts +1128 -17
- package/dist/generated/cap-status-types.d.ts +0 -1
- package/dist/generated/capability-router-map.d.ts +14 -3
- package/dist/generated/device-local-state.d.ts +0 -1
- package/dist/generated/device-proxy.d.ts +7 -2
- package/dist/generated/method-access-map.d.ts +1 -2
- package/dist/generated/provider-kind-map.d.ts +0 -1
- package/dist/generated/scope-presets.d.ts +0 -1
- package/dist/generated/system-proxy.d.ts +5 -2
- package/dist/health/wiring-health.d.ts +0 -1
- package/dist/helpers/bind-addon-actions.d.ts +0 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +28780 -7364
- package/dist/index.mjs +28207 -7478
- package/dist/interfaces/addon-data-plane.d.ts +0 -1
- package/dist/interfaces/addon-routes.d.ts +0 -1
- package/dist/interfaces/addon.d.ts +0 -1
- package/dist/interfaces/advanced-notifier.d.ts +0 -1
- package/dist/interfaces/agent-protocol.d.ts +0 -1
- package/dist/interfaces/agent.d.ts +0 -1
- package/dist/interfaces/alerts.d.ts +0 -1
- package/dist/interfaces/analysis-persistence.d.ts +0 -1
- package/dist/interfaces/analysis.d.ts +0 -1
- package/dist/interfaces/api-responses.d.ts +0 -1
- package/dist/interfaces/api-shared.d.ts +0 -1
- package/dist/interfaces/audio-analyzer.d.ts +0 -1
- package/dist/interfaces/audio-codec.d.ts +0 -1
- package/dist/interfaces/audio-inference-engine.d.ts +0 -1
- package/dist/interfaces/auth.d.ts +0 -1
- package/dist/interfaces/camera-pipeline.d.ts +0 -1
- package/dist/interfaces/capability.d.ts +47 -48
- package/dist/interfaces/config-ui.d.ts +3 -4
- package/dist/interfaces/context.d.ts +0 -1
- package/dist/interfaces/decoder.d.ts +0 -1
- package/dist/interfaces/detection-addon.d.ts +0 -1
- package/dist/interfaces/device-capabilities/camera.d.ts +0 -1
- package/dist/interfaces/device-capabilities/index.d.ts +0 -1
- package/dist/interfaces/device-provider.d.ts +0 -1
- package/dist/interfaces/device.d.ts +0 -1
- package/dist/interfaces/embedding-encoder.d.ts +0 -1
- package/dist/interfaces/engine-slots.d.ts +0 -1
- package/dist/interfaces/event-bus.d.ts +16 -6
- package/dist/interfaces/feature-flags.d.ts +0 -1
- package/dist/interfaces/ffmpeg.d.ts +0 -1
- package/dist/interfaces/frame-handle.d.ts +0 -1
- package/dist/interfaces/inference-capabilities.d.ts +0 -1
- package/dist/interfaces/inference-engine.d.ts +0 -1
- package/dist/interfaces/integration-registry.d.ts +0 -1
- package/dist/interfaces/kernel-abstractions.d.ts +0 -1
- package/dist/interfaces/lifecycle.d.ts +0 -1
- package/dist/interfaces/logging.d.ts +0 -1
- package/dist/interfaces/metrics-provider.d.ts +0 -1
- package/dist/interfaces/network-quality.d.ts +0 -1
- package/dist/interfaces/network.d.ts +0 -1
- package/dist/interfaces/notification.d.ts +0 -1
- package/dist/interfaces/pipeline-executor-capability.d.ts +0 -1
- package/dist/interfaces/pipeline-orchestrator-capability.d.ts +0 -1
- package/dist/interfaces/pipeline-runner-capability.d.ts +4 -1
- package/dist/interfaces/pipeline-runner.d.ts +0 -1
- package/dist/interfaces/pipeline-slot.d.ts +0 -1
- package/dist/interfaces/platform.d.ts +0 -1
- package/dist/interfaces/process.d.ts +0 -1
- package/dist/interfaces/python-env.d.ts +0 -1
- package/dist/interfaces/queryable.d.ts +0 -1
- package/dist/interfaces/raw-tensor-engine.d.ts +0 -1
- package/dist/interfaces/readiness.d.ts +0 -1
- package/dist/interfaces/recording-config-migrate.d.ts +12 -0
- package/dist/interfaces/recording-config.d.ts +119 -2
- package/dist/interfaces/repl.d.ts +0 -1
- package/dist/interfaces/restreamer.d.ts +0 -1
- package/dist/interfaces/router.d.ts +0 -1
- package/dist/interfaces/rtp-egress.d.ts +0 -1
- package/dist/interfaces/scoped-token.d.ts +0 -1
- package/dist/interfaces/server-analysis.d.ts +2 -3
- package/dist/interfaces/server-network.d.ts +0 -1
- package/dist/interfaces/storage-location-declaration.d.ts +0 -1
- package/dist/interfaces/storage-location.d.ts +1 -1
- package/dist/interfaces/storage.d.ts +0 -1
- package/dist/interfaces/stream-broker.d.ts +2 -1
- package/dist/interfaces/streaming.d.ts +0 -1
- package/dist/interfaces/task-handler.d.ts +0 -1
- package/dist/interfaces/timezones.d.ts +0 -1
- package/dist/interfaces/webrtc-provider.d.ts +0 -1
- package/dist/node.d.ts +0 -1
- package/dist/node.js +624 -462
- package/dist/node.mjs +604 -443
- package/dist/readiness/index.d.ts +0 -1
- package/dist/readiness/readiness-registry.d.ts +0 -1
- package/dist/schemas/auth-records.d.ts +0 -1
- package/dist/storage/filesystem-storage-provider.d.ts +0 -1
- package/dist/stream-selection.d.ts +0 -1
- package/dist/types/agent-pipeline-settings.d.ts +0 -1
- package/dist/types/analytics.d.ts +0 -1
- package/dist/types/camera-detection.d.ts +0 -1
- package/dist/types/camera-pipeline.d.ts +0 -1
- package/dist/types/config.d.ts +0 -1
- package/dist/types/detection.d.ts +12 -1
- package/dist/types/device-type.d.ts +0 -1
- package/dist/types/engine-output.d.ts +0 -1
- package/dist/types/entities.d.ts +0 -1
- package/dist/types/events.d.ts +0 -1
- package/dist/types/io.d.ts +0 -1
- package/dist/types/labels.d.ts +0 -1
- package/dist/types/live-state.d.ts +0 -1
- package/dist/types/models.d.ts +8 -1
- package/dist/types/pipeline-schema.d.ts +0 -1
- package/dist/types/pipeline-step.d.ts +0 -1
- package/dist/types/pipeline.d.ts +0 -1
- package/dist/types/tracked.d.ts +0 -1
- package/dist/util/location-match.d.ts +0 -1
- package/dist/utils/canonical-hash.d.ts +0 -1
- package/dist/utils/cosine-similarity.d.ts +0 -1
- package/dist/utils/element-config-store.d.ts +0 -1
- package/dist/utils/err-msg.d.ts +0 -1
- package/dist/utils/export-reconciler.d.ts +0 -1
- package/dist/utils/hf-url.d.ts +0 -1
- package/dist/utils/json-safe.d.ts +0 -1
- package/dist/utils/mask-url.d.ts +0 -1
- package/dist/utils/privacy-grid-raster.d.ts +0 -1
- package/dist/utils/ring-buffer.d.ts +0 -1
- package/dist/utils/run-inference-step.d.ts +0 -1
- package/dist/utils/runtime-mapping.d.ts +0 -1
- package/dist/utils/sleep.d.ts +0 -1
- package/dist/utils/zone-rule-eval.d.ts +0 -1
- package/package.json +3 -2
- package/dist/addon/base-addon.d.ts.map +0 -1
- package/dist/addon/build-addon-route-provider.d.ts.map +0 -1
- package/dist/addon/durable-state.d.ts.map +0 -1
- package/dist/capabilities/accessories.cap.d.ts.map +0 -1
- package/dist/capabilities/addon-pages-source.cap.d.ts.map +0 -1
- package/dist/capabilities/addon-pages.cap.d.ts.map +0 -1
- package/dist/capabilities/addon-routes.cap.d.ts.map +0 -1
- package/dist/capabilities/addon-settings.cap.d.ts.map +0 -1
- package/dist/capabilities/addon-widgets-source.cap.d.ts.map +0 -1
- package/dist/capabilities/addon-widgets.cap.d.ts.map +0 -1
- package/dist/capabilities/addons.cap.d.ts.map +0 -1
- package/dist/capabilities/admin-ui.cap.d.ts.map +0 -1
- package/dist/capabilities/advanced-notifier.cap.d.ts.map +0 -1
- package/dist/capabilities/air-quality-sensor.cap.d.ts.map +0 -1
- package/dist/capabilities/alarm-panel.cap.d.ts.map +0 -1
- package/dist/capabilities/alerts.cap.d.ts.map +0 -1
- package/dist/capabilities/ambient-light-sensor.cap.d.ts.map +0 -1
- package/dist/capabilities/audio-analysis.cap.d.ts.map +0 -1
- package/dist/capabilities/audio-analyzer.cap.d.ts.map +0 -1
- package/dist/capabilities/audio-codec.cap.d.ts.map +0 -1
- package/dist/capabilities/audio-metrics.cap.d.ts.map +0 -1
- package/dist/capabilities/auth-provider.cap.d.ts.map +0 -1
- package/dist/capabilities/automation-control.cap.d.ts.map +0 -1
- package/dist/capabilities/backup.cap.d.ts.map +0 -1
- package/dist/capabilities/battery.cap.d.ts.map +0 -1
- package/dist/capabilities/binary.cap.d.ts.map +0 -1
- package/dist/capabilities/brightness.cap.d.ts.map +0 -1
- package/dist/capabilities/broker.cap.d.ts.map +0 -1
- package/dist/capabilities/button.cap.d.ts.map +0 -1
- package/dist/capabilities/camera-credentials.cap.d.ts.map +0 -1
- package/dist/capabilities/camera-pipeline-config.cap.d.ts.map +0 -1
- package/dist/capabilities/camera-streams.cap.d.ts.map +0 -1
- package/dist/capabilities/capability-definition.d.ts.map +0 -1
- package/dist/capabilities/carbon-monoxide.cap.d.ts.map +0 -1
- package/dist/capabilities/climate-control.cap.d.ts.map +0 -1
- package/dist/capabilities/color.cap.d.ts.map +0 -1
- package/dist/capabilities/connectivity.cap.d.ts.map +0 -1
- package/dist/capabilities/consumables.cap.d.ts.map +0 -1
- package/dist/capabilities/contact.cap.d.ts.map +0 -1
- package/dist/capabilities/control.cap.d.ts.map +0 -1
- package/dist/capabilities/cover.cap.d.ts.map +0 -1
- package/dist/capabilities/custom-actions.d.ts.map +0 -1
- package/dist/capabilities/decoder.cap.d.ts.map +0 -1
- package/dist/capabilities/detection-pipeline.cap.d.ts.map +0 -1
- package/dist/capabilities/device-adoption.cap.d.ts.map +0 -1
- package/dist/capabilities/device-discovery.cap.d.ts.map +0 -1
- package/dist/capabilities/device-export.cap.d.ts.map +0 -1
- package/dist/capabilities/device-manager.cap.d.ts.map +0 -1
- package/dist/capabilities/device-ops.cap.d.ts.map +0 -1
- package/dist/capabilities/device-provider.cap.d.ts.map +0 -1
- package/dist/capabilities/device-state.cap.d.ts.map +0 -1
- package/dist/capabilities/device-status.cap.d.ts.map +0 -1
- package/dist/capabilities/doorbell.cap.d.ts.map +0 -1
- package/dist/capabilities/embedding-encoder.cap.d.ts.map +0 -1
- package/dist/capabilities/enum-sensor.cap.d.ts.map +0 -1
- package/dist/capabilities/event-emitter.cap.d.ts.map +0 -1
- package/dist/capabilities/events.cap.d.ts.map +0 -1
- package/dist/capabilities/fan-control.cap.d.ts.map +0 -1
- package/dist/capabilities/feature-probe.cap.d.ts.map +0 -1
- package/dist/capabilities/flood.cap.d.ts.map +0 -1
- package/dist/capabilities/gas.cap.d.ts.map +0 -1
- package/dist/capabilities/humidifier.cap.d.ts.map +0 -1
- package/dist/capabilities/humidity-sensor.cap.d.ts.map +0 -1
- package/dist/capabilities/image.cap.d.ts.map +0 -1
- package/dist/capabilities/index.d.ts.map +0 -1
- package/dist/capabilities/integrations.cap.d.ts.map +0 -1
- package/dist/capabilities/intercom.cap.d.ts.map +0 -1
- package/dist/capabilities/lawn-mower-control.cap.d.ts.map +0 -1
- package/dist/capabilities/local-network.cap.d.ts.map +0 -1
- package/dist/capabilities/lock-control.cap.d.ts.map +0 -1
- package/dist/capabilities/log-destination.cap.d.ts.map +0 -1
- package/dist/capabilities/mask-shape.d.ts.map +0 -1
- package/dist/capabilities/media-player.cap.d.ts.map +0 -1
- package/dist/capabilities/mesh-network.cap.d.ts.map +0 -1
- package/dist/capabilities/metrics-provider.cap.d.ts.map +0 -1
- package/dist/capabilities/motion-detection.cap.d.ts.map +0 -1
- package/dist/capabilities/motion-trigger.cap.d.ts.map +0 -1
- package/dist/capabilities/motion-zones.cap.d.ts.map +0 -1
- package/dist/capabilities/motion.cap.d.ts.map +0 -1
- package/dist/capabilities/mqtt-broker.cap.d.ts.map +0 -1
- package/dist/capabilities/native-object-detection.cap.d.ts.map +0 -1
- package/dist/capabilities/network-access.cap.d.ts.map +0 -1
- package/dist/capabilities/network-quality.cap.d.ts.map +0 -1
- package/dist/capabilities/nodes.cap.d.ts.map +0 -1
- package/dist/capabilities/notification-output.cap.d.ts.map +0 -1
- package/dist/capabilities/notifier.cap.d.ts.map +0 -1
- package/dist/capabilities/numeric-sensor.cap.d.ts.map +0 -1
- package/dist/capabilities/oauth-integration.cap.d.ts.map +0 -1
- package/dist/capabilities/osd.cap.d.ts.map +0 -1
- package/dist/capabilities/pipeline-analytics.cap.d.ts.map +0 -1
- package/dist/capabilities/pipeline-executor.cap.d.ts.map +0 -1
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts.map +0 -1
- package/dist/capabilities/pipeline-runner.cap.d.ts.map +0 -1
- package/dist/capabilities/platform-probe.cap.d.ts.map +0 -1
- package/dist/capabilities/power-meter.cap.d.ts.map +0 -1
- package/dist/capabilities/presence.cap.d.ts.map +0 -1
- package/dist/capabilities/pressure-sensor.cap.d.ts.map +0 -1
- package/dist/capabilities/privacy-mask.cap.d.ts.map +0 -1
- package/dist/capabilities/ptz-autotrack.cap.d.ts.map +0 -1
- package/dist/capabilities/ptz.cap.d.ts.map +0 -1
- package/dist/capabilities/reboot.cap.d.ts.map +0 -1
- package/dist/capabilities/recording.cap.d.ts.map +0 -1
- package/dist/capabilities/restreamer.cap.d.ts.map +0 -1
- package/dist/capabilities/schemas/detection-shared.d.ts.map +0 -1
- package/dist/capabilities/schemas/orchestrator-metrics.d.ts.map +0 -1
- package/dist/capabilities/schemas/streaming-shared.d.ts.map +0 -1
- package/dist/capabilities/schemas/zone-rule.d.ts.map +0 -1
- package/dist/capabilities/script-runner.cap.d.ts.map +0 -1
- package/dist/capabilities/settings-store.cap.d.ts.map +0 -1
- package/dist/capabilities/smoke.cap.d.ts.map +0 -1
- package/dist/capabilities/smtp-provider.cap.d.ts.map +0 -1
- package/dist/capabilities/snapshot-provider.cap.d.ts.map +0 -1
- package/dist/capabilities/snapshot.cap.d.ts.map +0 -1
- package/dist/capabilities/sso-bridge.cap.d.ts.map +0 -1
- package/dist/capabilities/storage-evictable.cap.d.ts.map +0 -1
- package/dist/capabilities/storage-provider.cap.d.ts.map +0 -1
- package/dist/capabilities/storage.cap.d.ts.map +0 -1
- package/dist/capabilities/stream-broker.cap.d.ts.map +0 -1
- package/dist/capabilities/stream-catalog.cap.d.ts.map +0 -1
- package/dist/capabilities/stream-params-config-schema.d.ts.map +0 -1
- package/dist/capabilities/stream-params.cap.d.ts.map +0 -1
- package/dist/capabilities/streaming-engine.cap.d.ts.map +0 -1
- package/dist/capabilities/switch.cap.d.ts.map +0 -1
- package/dist/capabilities/system.cap.d.ts.map +0 -1
- package/dist/capabilities/tamper.cap.d.ts.map +0 -1
- package/dist/capabilities/temperature-sensor.cap.d.ts.map +0 -1
- package/dist/capabilities/toast.cap.d.ts.map +0 -1
- package/dist/capabilities/turn-provider.cap.d.ts.map +0 -1
- package/dist/capabilities/update.cap.d.ts.map +0 -1
- package/dist/capabilities/user-management.cap.d.ts.map +0 -1
- package/dist/capabilities/user-passkeys.cap.d.ts.map +0 -1
- package/dist/capabilities/vacuum-control.cap.d.ts.map +0 -1
- package/dist/capabilities/valve.cap.d.ts.map +0 -1
- package/dist/capabilities/vibration.cap.d.ts.map +0 -1
- package/dist/capabilities/water-heater.cap.d.ts.map +0 -1
- package/dist/capabilities/weather.cap.d.ts.map +0 -1
- package/dist/capabilities/webrtc-session.cap.d.ts.map +0 -1
- package/dist/capabilities/webrtc.cap.d.ts.map +0 -1
- package/dist/capabilities/zone-analytics.cap.d.ts.map +0 -1
- package/dist/capabilities/zone-rules.cap.d.ts.map +0 -1
- package/dist/capabilities/zones.cap.d.ts.map +0 -1
- package/dist/catalogs/audio-classmap.d.ts.map +0 -1
- package/dist/catalogs/coco-classmap.d.ts.map +0 -1
- package/dist/catalogs/index.d.ts.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/deps/binary-downloader.d.ts.map +0 -1
- package/dist/deps/ffmpeg-downloader.d.ts.map +0 -1
- package/dist/deps/index.d.ts.map +0 -1
- package/dist/deps/python-downloader.d.ts.map +0 -1
- package/dist/device/accessory.d.ts.map +0 -1
- package/dist/device/base-device-provider.d.ts.map +0 -1
- package/dist/device/base-device.d.ts.map +0 -1
- package/dist/device/camera-device.d.ts.map +0 -1
- package/dist/device/device-binding.d.ts.map +0 -1
- package/dist/device/device-config.d.ts.map +0 -1
- package/dist/device/device-context.d.ts.map +0 -1
- package/dist/device/device-link-transform.d.ts.map +0 -1
- package/dist/device/device-management.d.ts.map +0 -1
- package/dist/device/device-profile.d.ts.map +0 -1
- package/dist/device/device-runtime-state.d.ts.map +0 -1
- package/dist/device/device-state-handle.d.ts.map +0 -1
- package/dist/device/device-type.d.ts.map +0 -1
- package/dist/device/device.d.ts.map +0 -1
- package/dist/device/features.d.ts.map +0 -1
- package/dist/device/index.d.ts.map +0 -1
- package/dist/device/path-util.d.ts.map +0 -1
- package/dist/device/runtime-state-helpers.d.ts.map +0 -1
- package/dist/device/schema-fields.d.ts.map +0 -1
- package/dist/device/source-info.d.ts.map +0 -1
- package/dist/device/system-mirror.d.ts.map +0 -1
- package/dist/device/zod-to-config-ui.d.ts.map +0 -1
- package/dist/disposer-chain.d.ts.map +0 -1
- package/dist/encode-profile.d.ts.map +0 -1
- package/dist/enums/event-category.d.ts.map +0 -1
- package/dist/enums/event-source-type.d.ts.map +0 -1
- package/dist/enums/index.d.ts.map +0 -1
- package/dist/generated/addon-api.d.ts.map +0 -1
- package/dist/generated/cap-status-types.d.ts.map +0 -1
- package/dist/generated/capability-router-map.d.ts.map +0 -1
- package/dist/generated/device-local-state.d.ts.map +0 -1
- package/dist/generated/device-proxy.d.ts.map +0 -1
- package/dist/generated/method-access-map.d.ts.map +0 -1
- package/dist/generated/provider-kind-map.d.ts.map +0 -1
- package/dist/generated/scope-presets.d.ts.map +0 -1
- package/dist/generated/system-proxy.d.ts.map +0 -1
- package/dist/health/wiring-health.d.ts.map +0 -1
- package/dist/helpers/bind-addon-actions.d.ts.map +0 -1
- package/dist/index-BSA_TBea.js +0 -13311
- package/dist/index-BSA_TBea.js.map +0 -1
- package/dist/index-Bpj3ScIH.mjs +0 -13312
- package/dist/index-Bpj3ScIH.mjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/interfaces/addon-data-plane.d.ts.map +0 -1
- package/dist/interfaces/addon-routes.d.ts.map +0 -1
- package/dist/interfaces/addon.d.ts.map +0 -1
- package/dist/interfaces/advanced-notifier.d.ts.map +0 -1
- package/dist/interfaces/agent-protocol.d.ts.map +0 -1
- package/dist/interfaces/agent.d.ts.map +0 -1
- package/dist/interfaces/alerts.d.ts.map +0 -1
- package/dist/interfaces/analysis-persistence.d.ts.map +0 -1
- package/dist/interfaces/analysis.d.ts.map +0 -1
- package/dist/interfaces/api-responses.d.ts.map +0 -1
- package/dist/interfaces/api-shared.d.ts.map +0 -1
- package/dist/interfaces/audio-analyzer.d.ts.map +0 -1
- package/dist/interfaces/audio-codec.d.ts.map +0 -1
- package/dist/interfaces/audio-inference-engine.d.ts.map +0 -1
- package/dist/interfaces/auth.d.ts.map +0 -1
- package/dist/interfaces/camera-pipeline.d.ts.map +0 -1
- package/dist/interfaces/capability.d.ts.map +0 -1
- package/dist/interfaces/config-ui.d.ts.map +0 -1
- package/dist/interfaces/context.d.ts.map +0 -1
- package/dist/interfaces/decoder.d.ts.map +0 -1
- package/dist/interfaces/detection-addon.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/camera.d.ts.map +0 -1
- package/dist/interfaces/device-capabilities/index.d.ts.map +0 -1
- package/dist/interfaces/device-provider.d.ts.map +0 -1
- package/dist/interfaces/device.d.ts.map +0 -1
- package/dist/interfaces/embedding-encoder.d.ts.map +0 -1
- package/dist/interfaces/engine-slots.d.ts.map +0 -1
- package/dist/interfaces/event-bus.d.ts.map +0 -1
- package/dist/interfaces/feature-flags.d.ts.map +0 -1
- package/dist/interfaces/ffmpeg.d.ts.map +0 -1
- package/dist/interfaces/frame-handle.d.ts.map +0 -1
- package/dist/interfaces/inference-capabilities.d.ts.map +0 -1
- package/dist/interfaces/inference-engine.d.ts.map +0 -1
- package/dist/interfaces/integration-registry.d.ts.map +0 -1
- package/dist/interfaces/kernel-abstractions.d.ts.map +0 -1
- package/dist/interfaces/lifecycle.d.ts.map +0 -1
- package/dist/interfaces/logging.d.ts.map +0 -1
- package/dist/interfaces/metrics-provider.d.ts.map +0 -1
- package/dist/interfaces/network-quality.d.ts.map +0 -1
- package/dist/interfaces/network.d.ts.map +0 -1
- package/dist/interfaces/notification.d.ts.map +0 -1
- package/dist/interfaces/pipeline-executor-capability.d.ts.map +0 -1
- package/dist/interfaces/pipeline-orchestrator-capability.d.ts.map +0 -1
- package/dist/interfaces/pipeline-runner-capability.d.ts.map +0 -1
- package/dist/interfaces/pipeline-runner.d.ts.map +0 -1
- package/dist/interfaces/pipeline-slot.d.ts.map +0 -1
- package/dist/interfaces/platform.d.ts.map +0 -1
- package/dist/interfaces/process.d.ts.map +0 -1
- package/dist/interfaces/python-env.d.ts.map +0 -1
- package/dist/interfaces/queryable.d.ts.map +0 -1
- package/dist/interfaces/raw-tensor-engine.d.ts.map +0 -1
- package/dist/interfaces/readiness.d.ts.map +0 -1
- package/dist/interfaces/recording-config.d.ts.map +0 -1
- package/dist/interfaces/repl.d.ts.map +0 -1
- package/dist/interfaces/restreamer.d.ts.map +0 -1
- package/dist/interfaces/router.d.ts.map +0 -1
- package/dist/interfaces/rtp-egress.d.ts.map +0 -1
- package/dist/interfaces/scoped-token.d.ts.map +0 -1
- package/dist/interfaces/server-analysis.d.ts.map +0 -1
- package/dist/interfaces/server-network.d.ts.map +0 -1
- package/dist/interfaces/storage-location-declaration.d.ts.map +0 -1
- package/dist/interfaces/storage-location.d.ts.map +0 -1
- package/dist/interfaces/storage.d.ts.map +0 -1
- package/dist/interfaces/stream-broker.d.ts.map +0 -1
- package/dist/interfaces/streaming.d.ts.map +0 -1
- package/dist/interfaces/task-handler.d.ts.map +0 -1
- package/dist/interfaces/timezones.d.ts.map +0 -1
- package/dist/interfaces/webrtc-provider.d.ts.map +0 -1
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js.map +0 -1
- package/dist/node.mjs.map +0 -1
- package/dist/readiness/index.d.ts.map +0 -1
- package/dist/readiness/readiness-registry.d.ts.map +0 -1
- package/dist/schemas/auth-records.d.ts.map +0 -1
- package/dist/storage/filesystem-storage-provider.d.ts.map +0 -1
- package/dist/stream-selection.d.ts.map +0 -1
- package/dist/types/agent-pipeline-settings.d.ts.map +0 -1
- package/dist/types/analytics.d.ts.map +0 -1
- package/dist/types/camera-detection.d.ts.map +0 -1
- package/dist/types/camera-pipeline.d.ts.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/detection.d.ts.map +0 -1
- package/dist/types/device-type.d.ts.map +0 -1
- package/dist/types/engine-output.d.ts.map +0 -1
- package/dist/types/entities.d.ts.map +0 -1
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/io.d.ts.map +0 -1
- package/dist/types/labels.d.ts.map +0 -1
- package/dist/types/live-state.d.ts.map +0 -1
- package/dist/types/models.d.ts.map +0 -1
- package/dist/types/pipeline-schema.d.ts.map +0 -1
- package/dist/types/pipeline-step.d.ts.map +0 -1
- package/dist/types/pipeline.d.ts.map +0 -1
- package/dist/types/tracked.d.ts.map +0 -1
- package/dist/util/location-match.d.ts.map +0 -1
- package/dist/utils/canonical-hash.d.ts.map +0 -1
- package/dist/utils/cosine-similarity.d.ts.map +0 -1
- package/dist/utils/element-config-store.d.ts.map +0 -1
- package/dist/utils/err-msg.d.ts.map +0 -1
- package/dist/utils/export-reconciler.d.ts.map +0 -1
- package/dist/utils/hf-url.d.ts.map +0 -1
- package/dist/utils/json-safe.d.ts.map +0 -1
- package/dist/utils/mask-url.d.ts.map +0 -1
- package/dist/utils/privacy-grid-raster.d.ts.map +0 -1
- package/dist/utils/ring-buffer.d.ts.map +0 -1
- package/dist/utils/run-inference-step.d.ts.map +0 -1
- package/dist/utils/runtime-mapping.d.ts.map +0 -1
- package/dist/utils/sleep.d.ts.map +0 -1
- package/dist/utils/zone-rule-eval.d.ts.map +0 -1
package/dist/node.mjs
CHANGED
|
@@ -1,485 +1,646 @@
|
|
|
1
|
+
import { errMsg } from "./index.mjs";
|
|
1
2
|
import * as fs from "node:fs";
|
|
2
|
-
import {
|
|
3
|
+
import { chmodSync, createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
4
|
import * as path from "node:path";
|
|
4
|
-
import {
|
|
5
|
+
import { basename, join } from "node:path";
|
|
5
6
|
import { pipeline } from "node:stream/promises";
|
|
6
7
|
import { Readable } from "node:stream";
|
|
7
8
|
import { execFileSync } from "node:child_process";
|
|
8
9
|
import { createHash } from "node:crypto";
|
|
9
|
-
|
|
10
|
-
import "zod";
|
|
10
|
+
//#region src/deps/binary-downloader.ts
|
|
11
11
|
function getPlatformInfo() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
return {
|
|
13
|
+
platform: process.platform,
|
|
14
|
+
arch: process.arch
|
|
15
|
+
};
|
|
16
16
|
}
|
|
17
17
|
function buildBinaryPath(dataDir, name, platform) {
|
|
18
|
-
|
|
19
|
-
return join(dataDir, "deps", `${name}${ext}`);
|
|
18
|
+
return join(dataDir, "deps", `${name}${(platform ?? process.platform) === "win32" ? ".exe" : ""}`);
|
|
20
19
|
}
|
|
20
|
+
/** Check if a binary exists in PATH */
|
|
21
21
|
function findInPath(name) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
try {
|
|
23
|
+
execFileSync(name, ["--version"], {
|
|
24
|
+
stdio: "pipe",
|
|
25
|
+
timeout: 5e3
|
|
26
|
+
});
|
|
27
|
+
return name;
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
28
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Download a binary to the target directory.
|
|
34
|
+
* Handles archives (zip, tar.gz, tar.xz) and raw binaries.
|
|
35
|
+
*/
|
|
29
36
|
async function downloadBinary(opts) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
37
|
+
const { name, url, targetDir, targetName, logger, isArchive, archiveFormat, archiveInnerPath } = opts;
|
|
38
|
+
const targetPath = join(targetDir, targetName);
|
|
39
|
+
if (existsSync(targetPath)) {
|
|
40
|
+
logger.debug("Binary already exists", { meta: {
|
|
41
|
+
name,
|
|
42
|
+
targetPath
|
|
43
|
+
} });
|
|
44
|
+
return targetPath;
|
|
45
|
+
}
|
|
46
|
+
mkdirSync(targetDir, { recursive: true });
|
|
47
|
+
logger.info("Downloading binary", { meta: {
|
|
48
|
+
name,
|
|
49
|
+
url
|
|
50
|
+
} });
|
|
51
|
+
const response = await fetch(url, { redirect: "follow" });
|
|
52
|
+
if (!response.ok || !response.body) throw new Error(`Failed to download ${name}: ${response.status} ${response.statusText}`);
|
|
53
|
+
if (isArchive) {
|
|
54
|
+
const ext = archiveFormat ?? "tar.gz";
|
|
55
|
+
const tmpArchive = join(targetDir, `${name}-download.${ext}`);
|
|
56
|
+
await pipeline(Readable.fromWeb(response.body), createWriteStream(tmpArchive));
|
|
57
|
+
const tmpExtractDir = join(targetDir, `${name}-extract`);
|
|
58
|
+
mkdirSync(tmpExtractDir, { recursive: true });
|
|
59
|
+
if (ext === "zip") try {
|
|
60
|
+
execFileSync("unzip", [
|
|
61
|
+
"-o",
|
|
62
|
+
"-q",
|
|
63
|
+
tmpArchive,
|
|
64
|
+
"-d",
|
|
65
|
+
tmpExtractDir
|
|
66
|
+
], { stdio: "pipe" });
|
|
67
|
+
} catch {
|
|
68
|
+
execFileSync("tar", [
|
|
69
|
+
"-xf",
|
|
70
|
+
tmpArchive,
|
|
71
|
+
"-C",
|
|
72
|
+
tmpExtractDir
|
|
73
|
+
], { stdio: "pipe" });
|
|
74
|
+
}
|
|
75
|
+
else if (ext === "tar.xz") execFileSync("tar", [
|
|
76
|
+
"-xJf",
|
|
77
|
+
tmpArchive,
|
|
78
|
+
"-C",
|
|
79
|
+
tmpExtractDir
|
|
80
|
+
], { stdio: "pipe" });
|
|
81
|
+
else execFileSync("tar", [
|
|
82
|
+
"-xzf",
|
|
83
|
+
tmpArchive,
|
|
84
|
+
"-C",
|
|
85
|
+
tmpExtractDir
|
|
86
|
+
], { stdio: "pipe" });
|
|
87
|
+
if (archiveInnerPath) {
|
|
88
|
+
const { copyFileSync } = await import("node:fs");
|
|
89
|
+
const sourcePath = join(tmpExtractDir, archiveInnerPath);
|
|
90
|
+
if (!existsSync(sourcePath)) throw new Error(`Binary not found in archive at ${archiveInnerPath}`);
|
|
91
|
+
copyFileSync(sourcePath, targetPath);
|
|
92
|
+
}
|
|
93
|
+
unlinkSync(tmpArchive);
|
|
94
|
+
const { rmSync } = await import("node:fs");
|
|
95
|
+
rmSync(tmpExtractDir, {
|
|
96
|
+
recursive: true,
|
|
97
|
+
force: true
|
|
98
|
+
});
|
|
99
|
+
} else await pipeline(Readable.fromWeb(response.body), createWriteStream(targetPath));
|
|
100
|
+
chmodSync(targetPath, 493);
|
|
101
|
+
logger.info("Binary downloaded", { meta: {
|
|
102
|
+
name,
|
|
103
|
+
targetPath
|
|
104
|
+
} });
|
|
105
|
+
return targetPath;
|
|
78
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Ensure a binary is available. Checks:
|
|
109
|
+
* 1. Target path (already downloaded)
|
|
110
|
+
* 2. System PATH
|
|
111
|
+
* 3. Download from URL
|
|
112
|
+
*/
|
|
79
113
|
async function ensureBinary(opts) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
114
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
115
|
+
const targetName = `${opts.name}${ext}`;
|
|
116
|
+
const targetPath = join(opts.targetDir, targetName);
|
|
117
|
+
if (existsSync(targetPath)) {
|
|
118
|
+
opts.logger.debug("Binary found at target path", { meta: {
|
|
119
|
+
name: opts.name,
|
|
120
|
+
targetPath
|
|
121
|
+
} });
|
|
122
|
+
return targetPath;
|
|
123
|
+
}
|
|
124
|
+
const inPath = findInPath(opts.name);
|
|
125
|
+
if (inPath) {
|
|
126
|
+
opts.logger.info("Binary found in system PATH", { meta: { name: opts.name } });
|
|
127
|
+
return inPath;
|
|
128
|
+
}
|
|
129
|
+
return downloadBinary({
|
|
130
|
+
name: opts.name,
|
|
131
|
+
url: opts.downloadUrl,
|
|
132
|
+
targetDir: opts.targetDir,
|
|
133
|
+
targetName,
|
|
134
|
+
logger: opts.logger,
|
|
135
|
+
isArchive: opts.isArchive,
|
|
136
|
+
archiveFormat: opts.archiveFormat,
|
|
137
|
+
archiveInnerPath: opts.archiveInnerPath
|
|
138
|
+
});
|
|
102
139
|
}
|
|
103
|
-
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region src/deps/ffmpeg-downloader.ts
|
|
142
|
+
/**
|
|
143
|
+
* Download ffmpeg static build for the current platform.
|
|
144
|
+
*
|
|
145
|
+
* Sources:
|
|
146
|
+
* - Linux: https://johnvansickle.com/ffmpeg/ (static builds)
|
|
147
|
+
* - macOS: https://evermeet.cx/ffmpeg/ or homebrew
|
|
148
|
+
*
|
|
149
|
+
* Using BtbN's GitHub releases as they cover both platforms:
|
|
150
|
+
* https://github.com/BtbN/FFmpeg-Builds/releases
|
|
151
|
+
*/
|
|
152
|
+
var FFMPEG_VERSION = "7.1";
|
|
104
153
|
function getFfmpegDownloadUrl(platform, arch) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
154
|
+
switch (platform) {
|
|
155
|
+
case "linux": {
|
|
156
|
+
const a = {
|
|
157
|
+
x64: "amd64",
|
|
158
|
+
arm64: "arm64"
|
|
159
|
+
}[arch];
|
|
160
|
+
if (!a) throw new Error(`Unsupported Linux architecture: ${arch}`);
|
|
161
|
+
return `https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-${a}-static.tar.xz`;
|
|
162
|
+
}
|
|
163
|
+
case "darwin":
|
|
164
|
+
if (!{
|
|
165
|
+
arm64: "arm64",
|
|
166
|
+
x64: "amd64"
|
|
167
|
+
}[arch]) throw new Error(`Unsupported macOS architecture: ${arch}`);
|
|
168
|
+
return `https://www.osxexperts.net/ffmpeg${FFMPEG_VERSION.replace(".", "")}arm.zip`;
|
|
169
|
+
default: throw new Error(`Unsupported platform: ${platform}`);
|
|
170
|
+
}
|
|
121
171
|
}
|
|
122
172
|
function getFfmpegArchiveInfo(platform) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
default:
|
|
137
|
-
throw new Error(`Unsupported platform: ${platform}`);
|
|
138
|
-
}
|
|
173
|
+
switch (platform) {
|
|
174
|
+
case "linux": return {
|
|
175
|
+
isArchive: true,
|
|
176
|
+
archiveFormat: "tar.xz",
|
|
177
|
+
archiveInnerPath: `ffmpeg-${FFMPEG_VERSION}-amd64-static/ffmpeg`
|
|
178
|
+
};
|
|
179
|
+
case "darwin": return {
|
|
180
|
+
isArchive: true,
|
|
181
|
+
archiveFormat: "zip",
|
|
182
|
+
archiveInnerPath: "ffmpeg"
|
|
183
|
+
};
|
|
184
|
+
default: throw new Error(`Unsupported platform: ${platform}`);
|
|
185
|
+
}
|
|
139
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Ensure ffmpeg binary is available.
|
|
189
|
+
* Checks: deps dir → system PATH → download.
|
|
190
|
+
*/
|
|
140
191
|
async function ensureFfmpeg(dataDir, logger) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
192
|
+
const depsDir = join(dataDir, "deps");
|
|
193
|
+
const platform = process.platform;
|
|
194
|
+
const arch = process.arch;
|
|
195
|
+
const archiveInfo = getFfmpegArchiveInfo(platform);
|
|
196
|
+
return ensureBinary({
|
|
197
|
+
name: "ffmpeg",
|
|
198
|
+
targetDir: depsDir,
|
|
199
|
+
downloadUrl: getFfmpegDownloadUrl(platform, arch),
|
|
200
|
+
logger,
|
|
201
|
+
...archiveInfo
|
|
202
|
+
});
|
|
152
203
|
}
|
|
153
|
-
|
|
154
|
-
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/deps/python-downloader.ts
|
|
206
|
+
/**
|
|
207
|
+
* Download portable Python (headless) from bjia56/portable-python.
|
|
208
|
+
*
|
|
209
|
+
* Source: https://github.com/bjia56/portable-python
|
|
210
|
+
*
|
|
211
|
+
* Advantages over python-build-standalone:
|
|
212
|
+
* - macOS universal2 binary (arm64+x86_64 in one)
|
|
213
|
+
* - Lighter (~24-28MB headless zip)
|
|
214
|
+
* - glibc 2.17 minimum (better compat)
|
|
215
|
+
* - Headless variant excludes tkinter/UI (ideal for ML inference)
|
|
216
|
+
*
|
|
217
|
+
* The zip's top-level dir is platform-specific (e.g.
|
|
218
|
+
* `python-headless-3.12.12-darwin-universal2/`); after extraction
|
|
219
|
+
* we rename it to a stable `python/` so consumers can rely on
|
|
220
|
+
* `<dataDir>/deps/python/bin/python3`.
|
|
221
|
+
*/
|
|
222
|
+
var PYTHON_VERSION = "3.12.12";
|
|
223
|
+
var PP_BASE = `https://github.com/bjia56/portable-python/releases/download/cpython-v${PYTHON_VERSION}-build.0`;
|
|
155
224
|
function getPythonDownloadUrl(platform, arch) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
225
|
+
switch (platform) {
|
|
226
|
+
case "linux": {
|
|
227
|
+
const a = {
|
|
228
|
+
x64: "x86_64",
|
|
229
|
+
arm64: "aarch64"
|
|
230
|
+
}[arch];
|
|
231
|
+
if (!a) throw new Error(`Unsupported Linux architecture for Python: ${arch}`);
|
|
232
|
+
return `${PP_BASE}/python-headless-${PYTHON_VERSION}-linux-${a}.zip`;
|
|
233
|
+
}
|
|
234
|
+
case "darwin": return `${PP_BASE}/python-headless-${PYTHON_VERSION}-darwin-universal2.zip`;
|
|
235
|
+
default: throw new Error(`Unsupported platform for portable Python: ${platform}`);
|
|
236
|
+
}
|
|
169
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Ensure the embedded portable Python is available.
|
|
240
|
+
*
|
|
241
|
+
* ALWAYS returns the path to the embedded interpreter under
|
|
242
|
+
* `<dataDir>/deps/python/bin/python3` — downloads it on first call
|
|
243
|
+
* and reuses it thereafter. The system PATH is intentionally NOT
|
|
244
|
+
* consulted: addons rely on `installPythonRequirements()` to manage
|
|
245
|
+
* deps inside the embedded site-packages, and a system interpreter
|
|
246
|
+
* (different version, missing modules) silently breaks that contract.
|
|
247
|
+
*
|
|
248
|
+
* Returns null only if the download/extract step fails.
|
|
249
|
+
*/
|
|
170
250
|
async function ensurePython(dataDir, logger) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
return pythonBin;
|
|
251
|
+
const pythonDir = join(dataDir, "deps", "python");
|
|
252
|
+
const pythonBin = join(pythonDir, "bin", "python3");
|
|
253
|
+
if (existsSync(pythonBin)) {
|
|
254
|
+
logger.debug("Portable Python found", { meta: { pythonBin } });
|
|
255
|
+
return pythonBin;
|
|
256
|
+
}
|
|
257
|
+
logger.info("Downloading portable Python (headless)", { meta: { version: PYTHON_VERSION } });
|
|
258
|
+
const depsDir = join(dataDir, "deps");
|
|
259
|
+
mkdirSync(depsDir, { recursive: true });
|
|
260
|
+
const url = getPythonDownloadUrl(process.platform, process.arch);
|
|
261
|
+
const tmpArchive = join(depsDir, "python-download.zip");
|
|
262
|
+
logger.info("Python download source", { meta: { url } });
|
|
263
|
+
const response = await fetch(url, { redirect: "follow" });
|
|
264
|
+
if (!response.ok || !response.body) {
|
|
265
|
+
logger.warn("Failed to download Python — ML detection will not be available", { meta: { status: response.status } });
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
await pipeline(Readable.fromWeb(response.body), createWriteStream(tmpArchive));
|
|
269
|
+
try {
|
|
270
|
+
execFileSync("unzip", [
|
|
271
|
+
"-o",
|
|
272
|
+
"-q",
|
|
273
|
+
tmpArchive,
|
|
274
|
+
"-d",
|
|
275
|
+
depsDir
|
|
276
|
+
], { stdio: "pipe" });
|
|
277
|
+
} catch {
|
|
278
|
+
execFileSync("python3", [
|
|
279
|
+
"-m",
|
|
280
|
+
"zipfile",
|
|
281
|
+
"-e",
|
|
282
|
+
tmpArchive,
|
|
283
|
+
depsDir
|
|
284
|
+
], { stdio: "pipe" });
|
|
285
|
+
}
|
|
286
|
+
const { unlinkSync } = await import("node:fs");
|
|
287
|
+
unlinkSync(tmpArchive);
|
|
288
|
+
if (!existsSync(pythonBin)) {
|
|
289
|
+
const candidates = readdirSync(depsDir).filter((name) => name.startsWith("python-") && existsSync(join(depsDir, name, "bin", "python3")));
|
|
290
|
+
if (candidates.length === 0) {
|
|
291
|
+
logger.warn("Python extraction succeeded but no python3 binary found in any subdir", { meta: { depsDir } });
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
const extractedRoot = join(depsDir, candidates[0]);
|
|
295
|
+
if (existsSync(pythonDir)) rmSync(pythonDir, {
|
|
296
|
+
recursive: true,
|
|
297
|
+
force: true
|
|
298
|
+
});
|
|
299
|
+
renameSync(extractedRoot, pythonDir);
|
|
300
|
+
}
|
|
301
|
+
if (!existsSync(pythonBin)) {
|
|
302
|
+
logger.warn("Python extraction succeeded but binary not found at expected path", { meta: { pythonBin } });
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
chmodSync(pythonBin, 493);
|
|
306
|
+
if (process.platform === "darwin") {
|
|
307
|
+
const realBin = join(pythonDir, "bin", "python3.real");
|
|
308
|
+
if (!existsSync(realBin)) {
|
|
309
|
+
renameSync(pythonBin, realBin);
|
|
310
|
+
const archFlag = process.arch === "arm64" ? "-arm64" : "-x86_64";
|
|
311
|
+
writeFileSync(pythonBin, `#!/bin/sh\nexec /usr/bin/arch ${archFlag} "${realBin}" "$@"\n`);
|
|
312
|
+
chmodSync(pythonBin, 493);
|
|
313
|
+
const pyAlt = join(pythonDir, "bin", "python");
|
|
314
|
+
if (existsSync(pyAlt)) {
|
|
315
|
+
try {
|
|
316
|
+
rmSync(pyAlt, { force: true });
|
|
317
|
+
} catch {}
|
|
318
|
+
writeFileSync(pyAlt, `#!/bin/sh\nexec /usr/bin/arch ${archFlag} "${realBin}" "$@"\n`);
|
|
319
|
+
chmodSync(pyAlt, 493);
|
|
320
|
+
}
|
|
321
|
+
logger.info("Locked python3 to host arch via shell stub", { meta: {
|
|
322
|
+
archFlag,
|
|
323
|
+
realBin
|
|
324
|
+
} });
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
logger.info("Portable Python installed", { meta: {
|
|
328
|
+
version: PYTHON_VERSION,
|
|
329
|
+
pythonBin
|
|
330
|
+
} });
|
|
331
|
+
return pythonBin;
|
|
253
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Install Python packages into the portable Python environment.
|
|
335
|
+
*/
|
|
254
336
|
async function installPythonPackages(pythonPath, packages, logger) {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
337
|
+
if (packages.length === 0) return;
|
|
338
|
+
logger.info("Installing Python packages", { meta: { packages } });
|
|
339
|
+
try {
|
|
340
|
+
execFileSync(pythonPath, [
|
|
341
|
+
"-m",
|
|
342
|
+
"pip",
|
|
343
|
+
"install",
|
|
344
|
+
"--quiet",
|
|
345
|
+
...packages
|
|
346
|
+
], {
|
|
347
|
+
stdio: "pipe",
|
|
348
|
+
timeout: 3e5
|
|
349
|
+
});
|
|
350
|
+
logger.info("Python packages installed successfully");
|
|
351
|
+
} catch (err) {
|
|
352
|
+
logger.error("Failed to install Python packages", { meta: { error: errMsg(err) } });
|
|
353
|
+
throw err;
|
|
354
|
+
}
|
|
268
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* Install a pip requirements file into the embedded Python.
|
|
358
|
+
*
|
|
359
|
+
* Idempotent: keyed on (requirements file basename + sha256 of its
|
|
360
|
+
* contents). The marker is written under
|
|
361
|
+
* `<python-install-dir>/.requirements-installed/` so it lives and
|
|
362
|
+
* dies with the python install — re-downloading python wipes both
|
|
363
|
+
* the site-packages and the markers, forcing a fresh re-install.
|
|
364
|
+
*
|
|
365
|
+
* The marker is updated only after `pip install` succeeds. A failed
|
|
366
|
+
* install never writes a marker, so the next call retries.
|
|
367
|
+
*/
|
|
269
368
|
async function installPythonRequirements(pythonPath, requirementsFile, logger) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
369
|
+
if (!existsSync(requirementsFile)) throw new Error(`Requirements file not found: ${requirementsFile}`);
|
|
370
|
+
const contents = readFileSync(requirementsFile);
|
|
371
|
+
const hash = createHash("sha256").update(contents).digest("hex").slice(0, 16);
|
|
372
|
+
const fileBase = basename(requirementsFile).replace(/\.txt$/i, "");
|
|
373
|
+
const markerDir = join(join(pythonPath, "..", ".."), ".requirements-installed");
|
|
374
|
+
const markerPath = join(markerDir, `${fileBase}-${hash}.marker`);
|
|
375
|
+
if (existsSync(markerPath)) {
|
|
376
|
+
logger.debug("Python requirements already installed", { meta: {
|
|
377
|
+
requirementsFile,
|
|
378
|
+
hash
|
|
379
|
+
} });
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
logger.info("Installing Python requirements", { meta: {
|
|
383
|
+
requirementsFile,
|
|
384
|
+
hash
|
|
385
|
+
} });
|
|
386
|
+
try {
|
|
387
|
+
execFileSync(pythonPath, [
|
|
388
|
+
"-m",
|
|
389
|
+
"pip",
|
|
390
|
+
"install",
|
|
391
|
+
"--quiet",
|
|
392
|
+
"--disable-pip-version-check",
|
|
393
|
+
"-r",
|
|
394
|
+
requirementsFile
|
|
395
|
+
], {
|
|
396
|
+
stdio: "pipe",
|
|
397
|
+
timeout: 6e5
|
|
398
|
+
});
|
|
399
|
+
} catch (err) {
|
|
400
|
+
logger.error("Failed to install Python requirements", { meta: {
|
|
401
|
+
requirementsFile,
|
|
402
|
+
error: errMsg(err)
|
|
403
|
+
} });
|
|
404
|
+
throw err;
|
|
405
|
+
}
|
|
406
|
+
mkdirSync(markerDir, { recursive: true });
|
|
407
|
+
writeFileSync(markerPath, `${requirementsFile}\n${(/* @__PURE__ */ new Date()).toISOString()}\n`);
|
|
408
|
+
logger.info("Python requirements installed", { meta: {
|
|
409
|
+
requirementsFile,
|
|
410
|
+
hash
|
|
411
|
+
} });
|
|
305
412
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/storage/filesystem-storage-provider.ts
|
|
415
|
+
var STORAGE_LOCATION_TYPES = [
|
|
416
|
+
"data",
|
|
417
|
+
"media",
|
|
418
|
+
"recordings",
|
|
419
|
+
"recordings-high",
|
|
420
|
+
"recordings-low",
|
|
421
|
+
"recordings-clips",
|
|
422
|
+
"event-images",
|
|
423
|
+
"models",
|
|
424
|
+
"addons-data",
|
|
425
|
+
"cache",
|
|
426
|
+
"logs",
|
|
427
|
+
"backups"
|
|
319
428
|
];
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
429
|
+
var DEFAULT_LOCATION_SUBDIRS = {
|
|
430
|
+
data: "db",
|
|
431
|
+
media: "media",
|
|
432
|
+
recordings: "recordings",
|
|
433
|
+
"recordings-high": "recordings-high",
|
|
434
|
+
"recordings-low": "recordings-low",
|
|
435
|
+
"recordings-clips": "recordings-clips",
|
|
436
|
+
"event-images": "event-images",
|
|
437
|
+
models: "models",
|
|
438
|
+
"addons-data": "addons-data",
|
|
439
|
+
cache: "/tmp/camstack-cache",
|
|
440
|
+
logs: "logs",
|
|
441
|
+
backups: "backups"
|
|
333
442
|
};
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
443
|
+
/**
|
|
444
|
+
* Filesystem storage provider — serves all location types from a local directory tree.
|
|
445
|
+
*
|
|
446
|
+
* Default layout:
|
|
447
|
+
* {rootPath}/recordings-high/
|
|
448
|
+
* {rootPath}/recordings-low/
|
|
449
|
+
* {rootPath}/recordings-clips/
|
|
450
|
+
* {rootPath}/event-images/
|
|
451
|
+
* {rootPath}/models/
|
|
452
|
+
* {rootPath}/addons-data/
|
|
453
|
+
* {rootPath}/logs/
|
|
454
|
+
* /tmp/camstack-cache/ (cache is always local)
|
|
455
|
+
*
|
|
456
|
+
* Individual location paths can be overridden.
|
|
457
|
+
*/
|
|
458
|
+
var FilesystemStorageProvider = class {
|
|
459
|
+
id = "local";
|
|
460
|
+
name = "Local Filesystem";
|
|
461
|
+
supportedLocations = [...STORAGE_LOCATION_TYPES];
|
|
462
|
+
rootPath;
|
|
463
|
+
locationPaths;
|
|
464
|
+
constructor(rootPath, overrides) {
|
|
465
|
+
this.rootPath = path.resolve(rootPath);
|
|
466
|
+
this.locationPaths = /* @__PURE__ */ new Map();
|
|
467
|
+
for (const loc of STORAGE_LOCATION_TYPES) {
|
|
468
|
+
const override = overrides?.[loc];
|
|
469
|
+
if (override) this.locationPaths.set(loc, path.resolve(override));
|
|
470
|
+
else {
|
|
471
|
+
const subdir = DEFAULT_LOCATION_SUBDIRS[loc] ?? loc;
|
|
472
|
+
this.locationPaths.set(loc, path.isAbsolute(subdir) ? subdir : path.join(this.rootPath, subdir));
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
async resolve({ location, relativePath }) {
|
|
477
|
+
const base = this.locationPaths.get(location) ?? path.join(this.rootPath, location);
|
|
478
|
+
return path.join(base, relativePath);
|
|
479
|
+
}
|
|
480
|
+
async write({ location, relativePath, data }) {
|
|
481
|
+
const filePath = await this.resolve({
|
|
482
|
+
location,
|
|
483
|
+
relativePath
|
|
484
|
+
});
|
|
485
|
+
await fs.promises.mkdir(path.dirname(filePath), { recursive: true });
|
|
486
|
+
if (Buffer.isBuffer(data)) await fs.promises.writeFile(filePath, data);
|
|
487
|
+
else {
|
|
488
|
+
const writeStream = fs.createWriteStream(filePath);
|
|
489
|
+
await new Promise((resolve, reject) => {
|
|
490
|
+
data.pipe(writeStream);
|
|
491
|
+
writeStream.on("finish", resolve);
|
|
492
|
+
writeStream.on("error", reject);
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
async read({ location, relativePath }) {
|
|
497
|
+
return fs.promises.readFile(await this.resolve({
|
|
498
|
+
location,
|
|
499
|
+
relativePath
|
|
500
|
+
}));
|
|
501
|
+
}
|
|
502
|
+
async exists({ location, relativePath }) {
|
|
503
|
+
try {
|
|
504
|
+
await fs.promises.access(await this.resolve({
|
|
505
|
+
location,
|
|
506
|
+
relativePath
|
|
507
|
+
}));
|
|
508
|
+
return true;
|
|
509
|
+
} catch {
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
async list({ location, prefix }) {
|
|
514
|
+
const base = this.locationPaths.get(location);
|
|
515
|
+
if (!base) return [];
|
|
516
|
+
const dir = prefix ? path.join(base, prefix) : base;
|
|
517
|
+
try {
|
|
518
|
+
return (await fs.promises.readdir(dir, { withFileTypes: true })).map((e) => prefix ? `${prefix}/${e.name}` : e.name);
|
|
519
|
+
} catch {
|
|
520
|
+
return [];
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
async delete({ location, relativePath }) {
|
|
524
|
+
const filePath = await this.resolve({
|
|
525
|
+
location,
|
|
526
|
+
relativePath
|
|
527
|
+
});
|
|
528
|
+
await fs.promises.rm(filePath, { force: true });
|
|
529
|
+
}
|
|
530
|
+
async getAvailableSpace({ location }) {
|
|
531
|
+
const base = this.locationPaths.get(location);
|
|
532
|
+
if (!base) return null;
|
|
533
|
+
try {
|
|
534
|
+
let target = base;
|
|
535
|
+
while (!fs.existsSync(target)) {
|
|
536
|
+
const parent = path.dirname(target);
|
|
537
|
+
if (!parent || parent === target) return null;
|
|
538
|
+
target = parent;
|
|
539
|
+
}
|
|
540
|
+
const stats = await fs.promises.statfs(target);
|
|
541
|
+
return stats.bavail * stats.bsize;
|
|
542
|
+
} catch {
|
|
543
|
+
return null;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
/** Get the resolved path for a location type (addon-declared ids fall back
|
|
547
|
+
* to `<rootPath>/<id>`). */
|
|
548
|
+
getLocationPath(location) {
|
|
549
|
+
return this.locationPaths.get(location) ?? path.join(this.rootPath, location);
|
|
550
|
+
}
|
|
551
|
+
/** Get the root path */
|
|
552
|
+
getRootPath() {
|
|
553
|
+
return this.rootPath;
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
//#endregion
|
|
557
|
+
//#region src/utils/canonical-hash.ts
|
|
558
|
+
/**
|
|
559
|
+
* Deterministic SHA-256 hash of an arbitrary serialisable value. The
|
|
560
|
+
* canonical form sorts object keys alphabetically at every depth so two
|
|
561
|
+
* structurally-equal inputs with different key insertion orders produce
|
|
562
|
+
* the same hash. Returns a 64-char lowercase hex digest.
|
|
563
|
+
*
|
|
564
|
+
* Used by export adapters (Alexa, HAP) to short-circuit re-discovery /
|
|
565
|
+
* accessory-rebuild work when the upstream shape is byte-identical to
|
|
566
|
+
* the last applied state — preventing user-visible "re-discovery"
|
|
567
|
+
* notifications on every addon-runner respawn. Each respawn re-fires
|
|
568
|
+
* `DeviceBindingsChanged` for every cap registration, which without
|
|
569
|
+
* this guard would propagate redundant pushes.
|
|
570
|
+
*
|
|
571
|
+
* Note: this is a SYMPTOMATIC fix layered on top of the binding-change
|
|
572
|
+
* subscription. The proper fix is a single "device ready" lifecycle
|
|
573
|
+
* barrier so exports react only when the full cap set has landed —
|
|
574
|
+
* tracked separately for post-HA-integration work.
|
|
575
|
+
*/
|
|
426
576
|
function canonicalHash(value) {
|
|
427
|
-
|
|
428
|
-
|
|
577
|
+
const canonical = JSON.stringify(value, replaceWithSortedKeys);
|
|
578
|
+
return createHash("sha256").update(canonical ?? "").digest("hex");
|
|
429
579
|
}
|
|
430
580
|
function replaceWithSortedKeys(_key, value) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
581
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
582
|
+
const obj = value;
|
|
583
|
+
const out = {};
|
|
584
|
+
for (const k of Object.keys(obj).toSorted()) out[k] = obj[k];
|
|
585
|
+
return out;
|
|
586
|
+
}
|
|
587
|
+
return value;
|
|
438
588
|
}
|
|
589
|
+
//#endregion
|
|
590
|
+
//#region src/utils/export-reconciler.ts
|
|
591
|
+
/**
|
|
592
|
+
* Compute the stable 64-char lowercase-hex fingerprint of a device's
|
|
593
|
+
* export-relevant shape. Two structurally-equal shapes (any feature order,
|
|
594
|
+
* any duplicates, any deviceId) hash identically.
|
|
595
|
+
*/
|
|
439
596
|
function canonicalDeviceFingerprint(shape) {
|
|
440
|
-
|
|
441
|
-
|
|
597
|
+
const features = [...new Set(shape.features)].toSorted();
|
|
598
|
+
return canonicalHash({
|
|
599
|
+
deviceType: shape.deviceType,
|
|
600
|
+
features
|
|
601
|
+
});
|
|
442
602
|
}
|
|
603
|
+
/**
|
|
604
|
+
* Pure 3-way diff of desired export state against the persisted
|
|
605
|
+
* last-advertised state, keyed by `deviceId`.
|
|
606
|
+
*
|
|
607
|
+
* - `desired` — one entry per device to advertise this cycle, each carrying
|
|
608
|
+
* the freshly-computed `fingerprint`.
|
|
609
|
+
* - `lastAdvertised` — the exporter's persisted per-target sync state.
|
|
610
|
+
*
|
|
611
|
+
* Neither input is mutated.
|
|
612
|
+
*/
|
|
443
613
|
function diffExportTargets(desired, lastAdvertised) {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
return { toAdd, toUpdate, toRemove };
|
|
614
|
+
const toAdd = [];
|
|
615
|
+
const toUpdate = [];
|
|
616
|
+
const desiredIds = /* @__PURE__ */ new Set();
|
|
617
|
+
for (const entry of desired) {
|
|
618
|
+
desiredIds.add(entry.deviceId);
|
|
619
|
+
const previous = lastAdvertised.get(entry.deviceId);
|
|
620
|
+
if (previous === void 0) toAdd.push(entry);
|
|
621
|
+
else if (previous.fingerprint !== entry.fingerprint) toUpdate.push(entry);
|
|
622
|
+
}
|
|
623
|
+
const toRemove = [];
|
|
624
|
+
for (const deviceId of lastAdvertised.keys()) if (!desiredIds.has(deviceId)) toRemove.push(deviceId);
|
|
625
|
+
return {
|
|
626
|
+
toAdd,
|
|
627
|
+
toUpdate,
|
|
628
|
+
toRemove
|
|
629
|
+
};
|
|
461
630
|
}
|
|
631
|
+
/**
|
|
632
|
+
* Resolve the fingerprint an exporter should feed into `diffExportTargets`
|
|
633
|
+
* for one device this cycle.
|
|
634
|
+
*
|
|
635
|
+
* When a device is NOT yet probe-ready, carry forward its last-advertised
|
|
636
|
+
* (persisted) fingerprint so it nets to NO CHANGE in `diffExportTargets`
|
|
637
|
+
* (neither update nor remove) — never advertise a partial mid-probe shape. A
|
|
638
|
+
* brand-new un-probed device with no persisted entry falls back to `fresh` so
|
|
639
|
+
* it can advertise once.
|
|
640
|
+
*/
|
|
462
641
|
function resolveExportFingerprint(input) {
|
|
463
|
-
|
|
464
|
-
|
|
642
|
+
if (input.ready) return input.fresh;
|
|
643
|
+
return input.persisted ?? input.fresh;
|
|
465
644
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
PYTHON_VERSION,
|
|
469
|
-
buildBinaryPath,
|
|
470
|
-
canonicalDeviceFingerprint,
|
|
471
|
-
canonicalHash,
|
|
472
|
-
diffExportTargets,
|
|
473
|
-
downloadBinary,
|
|
474
|
-
ensureBinary,
|
|
475
|
-
ensureFfmpeg,
|
|
476
|
-
ensurePython,
|
|
477
|
-
findInPath,
|
|
478
|
-
getFfmpegDownloadUrl,
|
|
479
|
-
getPlatformInfo,
|
|
480
|
-
getPythonDownloadUrl,
|
|
481
|
-
installPythonPackages,
|
|
482
|
-
installPythonRequirements,
|
|
483
|
-
resolveExportFingerprint
|
|
484
|
-
};
|
|
485
|
-
//# sourceMappingURL=node.mjs.map
|
|
645
|
+
//#endregion
|
|
646
|
+
export { FilesystemStorageProvider, PYTHON_VERSION, buildBinaryPath, canonicalDeviceFingerprint, canonicalHash, diffExportTargets, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements, resolveExportFingerprint };
|