@camstack/types 0.1.42 → 0.2.1

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