@camstack/addon-provider-reolink 1.2.254 → 1.2.256

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.js CHANGED
@@ -100698,7 +100698,7 @@ function parseBaichuanWebhookObject(mess) {
100698
100698
  return parsed;
100699
100699
  }
100700
100700
  //#endregion
100701
- //#region ../types/dist/event-category-7P4A3bYA.mjs
100701
+ //#region ../types/dist/event-category-BEsBTS72.mjs
100702
100702
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
100703
100703
  EventCategory["SystemBoot"] = "system.boot";
100704
100704
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -101145,6 +101145,14 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101145
101145
  */
101146
101146
  EventCategory["StreamBrokerOnRequestStreamSourceRefresh"] = "stream-broker.onRequestStreamSourceRefresh";
101147
101147
  /**
101148
+ * A broker RE-DIALED its source (every dial after the first). A consumer that
101149
+ * reads the broker over a transport that does not announce the cut — the
101150
+ * recorder's ffmpeg writer — learns here instead of through its idle clock.
101151
+ * Telemetry: a dropped event only means the idle clock recovers it later.
101152
+ * Payload: `{ deviceId, camStreamId, brokerId, reason }`.
101153
+ */
101154
+ EventCategory["StreamBrokerOnSourceRestart"] = "stream-broker.onSourceRestart";
101155
+ /**
101148
101156
  * A camera provider changed a device's stream parameters (codec /
101149
101157
  * resolution / bitrate / a stream added or removed). A LOW-LATENCY NUDGE
101150
101158
  * for the stream-broker's catalog reconcile: it carries NO authoritative
@@ -106821,7 +106829,7 @@ var ZodIssueCode = {
106821
106829
  var ZodFirstPartyTypeKind;
106822
106830
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106823
106831
  //#endregion
106824
- //#region ../types/dist/runtime-capabilities-CK6y0W5U.mjs
106832
+ //#region ../types/dist/runtime-capabilities-CG61dYnO.mjs
106825
106833
  /**
106826
106834
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106827
106835
  * window to float samples (D455).
@@ -111687,6 +111695,15 @@ var CameraStreamSchema = object({
111687
111695
  */
111688
111696
  autoEligible: boolean().optional(),
111689
111697
  /**
111698
+ * The longest continuous session the SOURCE will keep open, in ms, declared by
111699
+ * the provider that knows it (a hub that cuts every child's session on a
111700
+ * timer). Absent = no limit. The broker re-dials a live source a little
111701
+ * BEFORE this elapses, on its own terms and announced to consumers, so the
111702
+ * source's cut never lands mid-recording. Declare slightly under what was
111703
+ * observed.
111704
+ */
111705
+ maxSessionMs: number$1().int().positive().optional(),
111706
+ /**
111690
111707
  * The profile slot the PUBLISHER says this stream is: `low` for a stream
111691
111708
  * whose only sensible role is the low-bandwidth one, `high` for a main
111692
111709
  * stream. Consulted by the broker's automatic ranking
@@ -127382,7 +127399,7 @@ function e(group, en, it, flags = {}) {
127382
127399
  };
127383
127400
  }
127384
127401
  var N = { noise: true };
127385
- EventCategory.SystemBoot, e("system", "System booted", "Sistema avviato"), EventCategory.SystemAddonsReady, e("system", "Addons ready", "Addon pronti"), EventCategory.SystemRestarting, e("system", "System restarting", "Sistema in riavvio"), EventCategory.SystemRestartCompleted, e("system", "Restart completed", "Riavvio completato"), EventCategory.SystemTlsCertChanged, e("system", "TLS certificate changed", "Certificato TLS cambiato"), EventCategory.UpdateAvailable, e("system", "Update available", "Aggiornamento disponibile"), EventCategory.SystemReadyState, e("system", "Readiness changed", "Stato di prontezza cambiato"), EventCategory.AddonStarted, e("addons", "Addon started", "Addon avviato"), EventCategory.AddonStopped, e("addons", "Addon stopped", "Addon fermato"), EventCategory.AddonRestarted, e("addons", "Addon restarted", "Addon riavviato"), EventCategory.AddonUpdated, e("addons", "Addon updated", "Addon aggiornato"), EventCategory.AddonInstalled, e("addons", "Addon installed", "Addon installato"), EventCategory.AddonUninstalled, e("addons", "Addon uninstalled", "Addon disinstallato"), EventCategory.AddonCrashed, e("addons", "Addon crashed", "Addon in errore fatale"), EventCategory.AddonRunnerFailed, e("addons", "Runner failed for good", "Runner fallito definitivamente"), EventCategory.AddonRunnerRefused, e("addons", "Runner refused", "Runner rifiutato"), EventCategory.ProcessStateChanged, e("addons", "Process state changed", "Stato del processo cambiato"), EventCategory.SystemRunnerCheck, e("system", "Runner check", "Verifica dei runner"), EventCategory.AlertEpisode, e("system", "Alert episode", "Episodio di allarme"), EventCategory.AddonError, e("addons", "Addon error", "Errore di un addon"), EventCategory.AddonPageReady, e("addons", "Addon page ready", "Pagina addon pronta"), EventCategory.AddonWidgetReady, e("addons", "Addon widget ready", "Widget addon pronto"), EventCategory.AddonLoadFailed, e("addons", "Addon failed to load", "Caricamento addon fallito"), EventCategory.KeychainChanged, e("system", "Keychain changed", "Portachiavi modificato"), EventCategory.AddonLoadRecovered, e("addons", "Addon load recovered", "Caricamento addon ripristinato"), EventCategory.AddonUnsupportedVersion, e("addons", "Addon version unsupported", "Versione addon non supportata"), EventCategory.AddonUnsupportedResolved, e("addons", "Unsupported addon resolved", "Addon non supportato risolto"), EventCategory.AddonRetryScheduled, e("addons", "Addon retry scheduled", "Nuovo tentativo addon pianificato"), EventCategory.SystemLivenessFailed, e("system", "Liveness check failed", "Controllo di attività fallito"), EventCategory.SystemLivenessRecovered, e("system", "Liveness recovered", "Controllo di attività ripristinato"), EventCategory.AddonRetryAttempting, e("addons", "Addon retry running", "Nuovo tentativo addon in corso"), EventCategory.DeviceRegistered, e("devices", "Device registered", "Dispositivo registrato"), EventCategory.DeviceUnregistered, e("devices", "Device removed", "Dispositivo rimosso"), EventCategory.DeviceEnabled, e("devices", "Device enabled", "Dispositivo abilitato"), EventCategory.DeviceDisabled, e("devices", "Device disabled", "Dispositivo disabilitato"), EventCategory.DeviceSettingsUpdated, e("devices", "Device settings updated", "Impostazioni dispositivo aggiornate"), EventCategory.DeviceBindingsChanged, e("devices", "Device bindings changed", "Collegamenti dispositivo cambiati"), EventCategory.DeviceMetaChanged, e("devices", "Device details changed", "Dettagli dispositivo cambiati"), EventCategory.DeviceSourceInfoChanged, e("devices", "Device source info changed", "Info sorgente dispositivo cambiate"), EventCategory.DeviceStreamsRegistered, e("streams", "Device streams registered", "Stream del dispositivo registrati"), EventCategory.DeviceProvisioned, e("devices", "Device provisioned", "Dispositivo configurato"), EventCategory.DeviceReady, e("devices", "Device ready", "Dispositivo pronto"), EventCategory.IdentityLinkCreated, e("integrations", "Identity linked", "Identità collegata"), EventCategory.IdentityLinkLost, e("integrations", "Identity link lost", "Collegamento identità perso"), EventCategory.IntegrationEnabled, e("integrations", "Integration enabled", "Integrazione abilitata"), EventCategory.IntegrationDisabled, e("integrations", "Integration disabled", "Integrazione disabilitata"), EventCategory.IntegrationDeleted, e("integrations", "Integration deleted", "Integrazione eliminata"), EventCategory.BrokerStatusChanged, e("integrations", "Broker status changed", "Stato del broker cambiato"), EventCategory.BrokerMessage, e("integrations", "Broker message", "Messaggio del broker", N), EventCategory.ProviderStarted, e("integrations", "Provider started", "Provider avviato"), EventCategory.ProviderStopped, e("integrations", "Provider stopped", "Provider fermato"), EventCategory.ProcessCrashed, e("addons", "Process crashed", "Processo andato in crash"), EventCategory.ProcessRestartScheduled, e("addons", "Process restart scheduled", "Riavvio del processo pianificato"), EventCategory.ProcessRestarted, e("addons", "Process restarted", "Processo riavviato"), EventCategory.StorageLocationsChanged, e("storage", "Storage locations changed", "Posizioni di archiviazione cambiate"), EventCategory.RecordingStarted, e("recording", "Recording started", "Registrazione avviata"), EventCategory.RecordingStopped, e("recording", "Recording stopped", "Registrazione fermata"), EventCategory.RecordingError, e("recording", "Recording error", "Errore di registrazione"), EventCategory.RecordingHealthDegraded, e("recording", "Recording degraded", "Registrazione degradata"), EventCategory.RecordingHealthStalled, e("recording", "Recording stalled", "Registrazione bloccata"), EventCategory.RecordingHealthOk, e("recording", "Recording healthy", "Registrazione regolare"), EventCategory.RecordingStorageCritical, e("recording", "Recording storage critical", "Spazio di registrazione critico"), EventCategory.StorageLocationLow, e("storage", "Storage location low", "Spazio in esaurimento"), EventCategory.StorageLocationCritical, e("storage", "Storage location critical", "Spazio critico"), EventCategory.StorageLocationOk, e("storage", "Storage location recovered", "Spazio tornato regolare"), EventCategory.StorageDrainProgress, e("storage", "Drain progress", "Avanzamento dello svuotamento"), EventCategory.StorageDrainComplete, e("storage", "Drain complete", "Svuotamento completato"), EventCategory.RecordingSegmentWritten, e("recording", "Segment written", "Segmento scritto"), EventCategory.RecordingPolicyFallback, e("recording", "Recording policy fallback", "Politica di registrazione di ripiego"), EventCategory.RecordingRetentionCompleted, e("recording", "Retention completed", "Pulizia completata"), EventCategory.RecordingExportProgress, e("recording", "Export progress", "Avanzamento esportazione"), EventCategory.RecordingExportCompleted, e("recording", "Export completed", "Esportazione completata"), EventCategory.RecordingExportFailed, e("recording", "Export failed", "Esportazione fallita"), EventCategory.DetectionEvent, e("detection", "Detection", "Rilevamento"), EventCategory.SessionTrackNew, e("detection", "Session track started", "Nuova traccia di sessione"), EventCategory.SessionTrackExpired, e("detection", "Session track expired", "Traccia di sessione scaduta"), EventCategory.BenchmarkProgress, e("metrics", "Benchmark progress", "Avanzamento benchmark", N), EventCategory.PlatformProbePhase, e("metrics", "Platform probe phase", "Fase di analisi piattaforma", N), EventCategory.PipelineProgress, e("pipeline", "Pipeline progress", "Avanzamento pipeline", N), EventCategory.PipelineTrace, e("pipeline", "Pipeline trace", "Traccia pipeline", N), EventCategory.PipelineInferenceResult, e("pipeline", "Inference result", "Risultato di inferenza", N), EventCategory.PipelineCameraAssigned, e("pipeline", "Camera assigned to pipeline", "Camera assegnata alla pipeline"), EventCategory.PipelineCameraUnassigned, e("pipeline", "Camera unassigned from pipeline", "Camera rimossa dalla pipeline"), EventCategory.PipelineNodeInferenceUnavailable, e("pipeline", "Node inference unavailable", "Inferenza del nodo non disponibile"), EventCategory.PipelineDetectionBlind, e("pipeline", "Detection blind", "Rilevamento cieco"), EventCategory.PipelineMotionNoisy, e("pipeline", "Motion too noisy", "Movimento troppo disturbato"), EventCategory.PipelineMotionCalm, e("pipeline", "Motion calm again", "Movimento di nuovo calmo"), EventCategory.PipelinePackageLlmSilent, e("pipeline", "Package check silent", "Verifica pacchi senza risposta"), EventCategory.PipelinePackageLlmAnswered, e("pipeline", "Package check answered", "Verifica pacchi con risposta"), EventCategory.PipelineCameraUpdated, e("pipeline", "Pipeline camera updated", "Camera della pipeline aggiornata"), EventCategory.PipelineIngestOwnerChanged, e("pipeline", "Ingest owner changed", "Responsabile dell’acquisizione cambiato"), EventCategory.PipelineRunnerLoadSnapshot, e("metrics", "Runner load snapshot", "Carico dei runner", N), EventCategory.PipelineCameraMetricsSnapshot, e("metrics", "Camera metrics snapshot", "Metriche delle camere", N), EventCategory.StreamBrokerMetricsSnapshot, e("metrics", "Stream broker metrics", "Metriche dello stream broker", N), EventCategory.StreamBrokerOnCamStreamDemand, e("streams", "Stream requested", "Stream richiesto"), EventCategory.StreamBrokerOnCamStreamIdle, e("streams", "Stream idle", "Stream inattivo"), EventCategory.StreamBrokerOnRequestStreamSourceRefresh, e("streams", "Stream source refresh requested", "Aggiornamento sorgente stream richiesto"), EventCategory.StreamParamsChanged, e("streams", "Stream parameters changed", "Parametri dello stream cambiati"), EventCategory.DeviceStateChanged, e("devices", "Device state changed", "Stato dispositivo cambiato"), EventCategory.DeviceCommandSettled, e("devices", "Device command settled", "Comando al dispositivo concluso"), EventCategory.DeviceNativeShadowChanged, e("devices", "Device native state changed", "Stato nativo del dispositivo cambiato"), EventCategory.ZoneAnalyticsOccupancyChanged, e("detection", "Zone occupancy changed", "Occupazione zona cambiata"), EventCategory.BatteryOnStatusChanged, e("devices", "Battery status changed", "Stato batteria cambiato"), EventCategory.NetworkLinkOnStatusChanged, e("devices", "Network link status changed", "Stato del collegamento di rete cambiato"), EventCategory.BatteryOnWakeStarted, e("devices", "Battery device woke up", "Dispositivo a batteria attivato"), EventCategory.DoorbellOnPressed, e("devices", "Doorbell pressed", "Campanello premuto"), EventCategory.RunningStarted, e("devices", "Run started", "Esecuzione avviata"), EventCategory.RunningFinished, e("devices", "Run finished", "Esecuzione terminata"), EventCategory.WorkloadStarted, e("devices", "Workload started", "Carico di lavoro avviato"), EventCategory.WorkloadStopped, e("devices", "Workload stopped", "Carico di lavoro fermato"), EventCategory.WorkloadCrashed, e("devices", "Workload crashed", "Carico di lavoro in crash"), EventCategory.WorkloadRecovered, e("devices", "Workload recovered", "Carico di lavoro ripristinato"), EventCategory.DeviceRunOpened, e("devices", "Device run opened", "Ciclo del dispositivo aperto"), EventCategory.DeviceRunClosed, e("devices", "Device run closed", "Ciclo del dispositivo chiuso"), EventCategory.EventEmitted, e("devices", "Device event", "Evento del dispositivo"), EventCategory.PipelineEngineMetricsSnapshot, e("metrics", "Engine metrics snapshot", "Metriche dei motori", N), EventCategory.PipelineEngineProvisioning, e("pipeline", "Engine provisioning", "Preparazione del motore"), EventCategory.ClusterTopologySnapshot, e("metrics", "Cluster topology snapshot", "Topologia del cluster", N), EventCategory.MetricsNodeResourcesSnapshot, e("metrics", "Node resources snapshot", "Risorse dei nodi", N), EventCategory.MetricsNodeProcessesSnapshot, e("metrics", "Node processes snapshot", "Processi dei nodi", N), EventCategory.CapabilityBindingChanged, e("system", "Capability binding changed", "Collegamento di capability cambiato", N), EventCategory.ModelDownloadProgress, e("pipeline", "Model download progress", "Avanzamento download modello", N), EventCategory.AgentRegistered, e("agents", "Agent registered", "Agent registrato"), EventCategory.AgentUnregistered, e("agents", "Agent removed", "Agent rimosso"), EventCategory.AgentOnline, e("agents", "Agent online", "Agent online"), EventCategory.AgentOffline, e("agents", "Agent offline", "Agent offline"), EventCategory.WorkerOnline, e("agents", "Worker online", "Worker online"), EventCategory.WorkerOffline, e("agents", "Worker offline", "Worker offline"), EventCategory.AgentTaskDispatched, e("agents", "Agent task dispatched", "Attività inviata a un agent"), EventCategory.AgentTaskAssigned, e("agents", "Agent task assigned", "Attività assegnata a un agent"), EventCategory.AgentTrpcConnected, e("agents", "Agent API connected", "API dell’agent connessa"), EventCategory.AgentWsConnected, e("agents", "Agent socket connected", "Socket dell’agent connesso"), EventCategory.AgentWsDisconnected, e("agents", "Agent socket disconnected", "Socket dell’agent disconnesso"), EventCategory.AgentBackupActivated, e("agents", "Agent backup activated", "Backup dell’agent attivato"), EventCategory.OrchestrationSettingsUpdated, e("pipeline", "Orchestration settings updated", "Impostazioni di orchestrazione aggiornate"), EventCategory.MotionAnalysis, e("detection", "Motion analysis", "Analisi del movimento", N), EventCategory.MotionZonesRaw, e("detection", "Raw motion zones", "Zone di movimento grezze", N), EventCategory.MotionOnMotionChanged, e("detection", "Motion changed", "Movimento cambiato", N), EventCategory.DetectionResult, e("detection", "Detection result", "Risultato del rilevamento", N), EventCategory.DetectionRaw, e("detection", "Raw detection", "Rilevamento grezzo"), EventCategory.DetectionCameraNative, e("detection", "Camera native detection", "Rilevamento nativo della camera"), EventCategory.PipelineAudioInferenceResult, e("pipeline", "Audio inference result", "Risultato di inferenza audio", N), EventCategory.DetectionPhaseTransition, e("detection", "Detection phase changed", "Fase di rilevamento cambiata"), EventCategory.ProviderMotion, e("detection", "Camera raw motion", "Movimento grezzo della camera", N), EventCategory.ProviderDetection, e("detection", "Camera onboard detection", "Rilevamento a bordo camera"), EventCategory.EnrichmentEmbeddingStored, e("enrichment", "Embedding stored", "Embedding salvato"), EventCategory.EnrichmentSceneStateChanged, e("enrichment", "Scene state changed", "Stato della scena cambiato"), EventCategory.EnrichmentActivitySummary, e("enrichment", "Activity summary", "Riepilogo dell’attività"), EventCategory.PipelineAnalyticsTrackLifecycle, e("detection", "Track lifecycle", "Ciclo di vita della traccia"), EventCategory.PipelineAnalyticsTrackStarted, e("detection", "Track started", "Traccia iniziata", {
127402
+ EventCategory.SystemBoot, e("system", "System booted", "Sistema avviato"), EventCategory.SystemAddonsReady, e("system", "Addons ready", "Addon pronti"), EventCategory.SystemRestarting, e("system", "System restarting", "Sistema in riavvio"), EventCategory.SystemRestartCompleted, e("system", "Restart completed", "Riavvio completato"), EventCategory.SystemTlsCertChanged, e("system", "TLS certificate changed", "Certificato TLS cambiato"), EventCategory.UpdateAvailable, e("system", "Update available", "Aggiornamento disponibile"), EventCategory.SystemReadyState, e("system", "Readiness changed", "Stato di prontezza cambiato"), EventCategory.AddonStarted, e("addons", "Addon started", "Addon avviato"), EventCategory.AddonStopped, e("addons", "Addon stopped", "Addon fermato"), EventCategory.AddonRestarted, e("addons", "Addon restarted", "Addon riavviato"), EventCategory.AddonUpdated, e("addons", "Addon updated", "Addon aggiornato"), EventCategory.AddonInstalled, e("addons", "Addon installed", "Addon installato"), EventCategory.AddonUninstalled, e("addons", "Addon uninstalled", "Addon disinstallato"), EventCategory.AddonCrashed, e("addons", "Addon crashed", "Addon in errore fatale"), EventCategory.AddonRunnerFailed, e("addons", "Runner failed for good", "Runner fallito definitivamente"), EventCategory.AddonRunnerRefused, e("addons", "Runner refused", "Runner rifiutato"), EventCategory.ProcessStateChanged, e("addons", "Process state changed", "Stato del processo cambiato"), EventCategory.SystemRunnerCheck, e("system", "Runner check", "Verifica dei runner"), EventCategory.AlertEpisode, e("system", "Alert episode", "Episodio di allarme"), EventCategory.AddonError, e("addons", "Addon error", "Errore di un addon"), EventCategory.AddonPageReady, e("addons", "Addon page ready", "Pagina addon pronta"), EventCategory.AddonWidgetReady, e("addons", "Addon widget ready", "Widget addon pronto"), EventCategory.AddonLoadFailed, e("addons", "Addon failed to load", "Caricamento addon fallito"), EventCategory.KeychainChanged, e("system", "Keychain changed", "Portachiavi modificato"), EventCategory.AddonLoadRecovered, e("addons", "Addon load recovered", "Caricamento addon ripristinato"), EventCategory.AddonUnsupportedVersion, e("addons", "Addon version unsupported", "Versione addon non supportata"), EventCategory.AddonUnsupportedResolved, e("addons", "Unsupported addon resolved", "Addon non supportato risolto"), EventCategory.AddonRetryScheduled, e("addons", "Addon retry scheduled", "Nuovo tentativo addon pianificato"), EventCategory.SystemLivenessFailed, e("system", "Liveness check failed", "Controllo di attività fallito"), EventCategory.SystemLivenessRecovered, e("system", "Liveness recovered", "Controllo di attività ripristinato"), EventCategory.AddonRetryAttempting, e("addons", "Addon retry running", "Nuovo tentativo addon in corso"), EventCategory.DeviceRegistered, e("devices", "Device registered", "Dispositivo registrato"), EventCategory.DeviceUnregistered, e("devices", "Device removed", "Dispositivo rimosso"), EventCategory.DeviceEnabled, e("devices", "Device enabled", "Dispositivo abilitato"), EventCategory.DeviceDisabled, e("devices", "Device disabled", "Dispositivo disabilitato"), EventCategory.DeviceSettingsUpdated, e("devices", "Device settings updated", "Impostazioni dispositivo aggiornate"), EventCategory.DeviceBindingsChanged, e("devices", "Device bindings changed", "Collegamenti dispositivo cambiati"), EventCategory.DeviceMetaChanged, e("devices", "Device details changed", "Dettagli dispositivo cambiati"), EventCategory.DeviceSourceInfoChanged, e("devices", "Device source info changed", "Info sorgente dispositivo cambiate"), EventCategory.DeviceStreamsRegistered, e("streams", "Device streams registered", "Stream del dispositivo registrati"), EventCategory.DeviceProvisioned, e("devices", "Device provisioned", "Dispositivo configurato"), EventCategory.DeviceReady, e("devices", "Device ready", "Dispositivo pronto"), EventCategory.IdentityLinkCreated, e("integrations", "Identity linked", "Identità collegata"), EventCategory.IdentityLinkLost, e("integrations", "Identity link lost", "Collegamento identità perso"), EventCategory.IntegrationEnabled, e("integrations", "Integration enabled", "Integrazione abilitata"), EventCategory.IntegrationDisabled, e("integrations", "Integration disabled", "Integrazione disabilitata"), EventCategory.IntegrationDeleted, e("integrations", "Integration deleted", "Integrazione eliminata"), EventCategory.BrokerStatusChanged, e("integrations", "Broker status changed", "Stato del broker cambiato"), EventCategory.BrokerMessage, e("integrations", "Broker message", "Messaggio del broker", N), EventCategory.ProviderStarted, e("integrations", "Provider started", "Provider avviato"), EventCategory.ProviderStopped, e("integrations", "Provider stopped", "Provider fermato"), EventCategory.ProcessCrashed, e("addons", "Process crashed", "Processo andato in crash"), EventCategory.ProcessRestartScheduled, e("addons", "Process restart scheduled", "Riavvio del processo pianificato"), EventCategory.ProcessRestarted, e("addons", "Process restarted", "Processo riavviato"), EventCategory.StorageLocationsChanged, e("storage", "Storage locations changed", "Posizioni di archiviazione cambiate"), EventCategory.RecordingStarted, e("recording", "Recording started", "Registrazione avviata"), EventCategory.RecordingStopped, e("recording", "Recording stopped", "Registrazione fermata"), EventCategory.RecordingError, e("recording", "Recording error", "Errore di registrazione"), EventCategory.RecordingHealthDegraded, e("recording", "Recording degraded", "Registrazione degradata"), EventCategory.RecordingHealthStalled, e("recording", "Recording stalled", "Registrazione bloccata"), EventCategory.RecordingHealthOk, e("recording", "Recording healthy", "Registrazione regolare"), EventCategory.RecordingStorageCritical, e("recording", "Recording storage critical", "Spazio di registrazione critico"), EventCategory.StorageLocationLow, e("storage", "Storage location low", "Spazio in esaurimento"), EventCategory.StorageLocationCritical, e("storage", "Storage location critical", "Spazio critico"), EventCategory.StorageLocationOk, e("storage", "Storage location recovered", "Spazio tornato regolare"), EventCategory.StorageDrainProgress, e("storage", "Drain progress", "Avanzamento dello svuotamento"), EventCategory.StorageDrainComplete, e("storage", "Drain complete", "Svuotamento completato"), EventCategory.RecordingSegmentWritten, e("recording", "Segment written", "Segmento scritto"), EventCategory.RecordingPolicyFallback, e("recording", "Recording policy fallback", "Politica di registrazione di ripiego"), EventCategory.RecordingRetentionCompleted, e("recording", "Retention completed", "Pulizia completata"), EventCategory.RecordingExportProgress, e("recording", "Export progress", "Avanzamento esportazione"), EventCategory.RecordingExportCompleted, e("recording", "Export completed", "Esportazione completata"), EventCategory.RecordingExportFailed, e("recording", "Export failed", "Esportazione fallita"), EventCategory.DetectionEvent, e("detection", "Detection", "Rilevamento"), EventCategory.SessionTrackNew, e("detection", "Session track started", "Nuova traccia di sessione"), EventCategory.SessionTrackExpired, e("detection", "Session track expired", "Traccia di sessione scaduta"), EventCategory.BenchmarkProgress, e("metrics", "Benchmark progress", "Avanzamento benchmark", N), EventCategory.PlatformProbePhase, e("metrics", "Platform probe phase", "Fase di analisi piattaforma", N), EventCategory.PipelineProgress, e("pipeline", "Pipeline progress", "Avanzamento pipeline", N), EventCategory.PipelineTrace, e("pipeline", "Pipeline trace", "Traccia pipeline", N), EventCategory.PipelineInferenceResult, e("pipeline", "Inference result", "Risultato di inferenza", N), EventCategory.PipelineCameraAssigned, e("pipeline", "Camera assigned to pipeline", "Camera assegnata alla pipeline"), EventCategory.PipelineCameraUnassigned, e("pipeline", "Camera unassigned from pipeline", "Camera rimossa dalla pipeline"), EventCategory.PipelineNodeInferenceUnavailable, e("pipeline", "Node inference unavailable", "Inferenza del nodo non disponibile"), EventCategory.PipelineDetectionBlind, e("pipeline", "Detection blind", "Rilevamento cieco"), EventCategory.PipelineMotionNoisy, e("pipeline", "Motion too noisy", "Movimento troppo disturbato"), EventCategory.PipelineMotionCalm, e("pipeline", "Motion calm again", "Movimento di nuovo calmo"), EventCategory.PipelinePackageLlmSilent, e("pipeline", "Package check silent", "Verifica pacchi senza risposta"), EventCategory.PipelinePackageLlmAnswered, e("pipeline", "Package check answered", "Verifica pacchi con risposta"), EventCategory.PipelineCameraUpdated, e("pipeline", "Pipeline camera updated", "Camera della pipeline aggiornata"), EventCategory.PipelineIngestOwnerChanged, e("pipeline", "Ingest owner changed", "Responsabile dell’acquisizione cambiato"), EventCategory.PipelineRunnerLoadSnapshot, e("metrics", "Runner load snapshot", "Carico dei runner", N), EventCategory.PipelineCameraMetricsSnapshot, e("metrics", "Camera metrics snapshot", "Metriche delle camere", N), EventCategory.StreamBrokerMetricsSnapshot, e("metrics", "Stream broker metrics", "Metriche dello stream broker", N), EventCategory.StreamBrokerOnCamStreamDemand, e("streams", "Stream requested", "Stream richiesto"), EventCategory.StreamBrokerOnCamStreamIdle, e("streams", "Stream idle", "Stream inattivo"), EventCategory.StreamBrokerOnRequestStreamSourceRefresh, e("streams", "Stream source refresh requested", "Aggiornamento sorgente stream richiesto"), EventCategory.StreamBrokerOnSourceRestart, e("streams", "Stream source restarted", "Sorgente stream riavviata"), EventCategory.StreamParamsChanged, e("streams", "Stream parameters changed", "Parametri dello stream cambiati"), EventCategory.DeviceStateChanged, e("devices", "Device state changed", "Stato dispositivo cambiato"), EventCategory.DeviceCommandSettled, e("devices", "Device command settled", "Comando al dispositivo concluso"), EventCategory.DeviceNativeShadowChanged, e("devices", "Device native state changed", "Stato nativo del dispositivo cambiato"), EventCategory.ZoneAnalyticsOccupancyChanged, e("detection", "Zone occupancy changed", "Occupazione zona cambiata"), EventCategory.BatteryOnStatusChanged, e("devices", "Battery status changed", "Stato batteria cambiato"), EventCategory.NetworkLinkOnStatusChanged, e("devices", "Network link status changed", "Stato del collegamento di rete cambiato"), EventCategory.BatteryOnWakeStarted, e("devices", "Battery device woke up", "Dispositivo a batteria attivato"), EventCategory.DoorbellOnPressed, e("devices", "Doorbell pressed", "Campanello premuto"), EventCategory.RunningStarted, e("devices", "Run started", "Esecuzione avviata"), EventCategory.RunningFinished, e("devices", "Run finished", "Esecuzione terminata"), EventCategory.WorkloadStarted, e("devices", "Workload started", "Carico di lavoro avviato"), EventCategory.WorkloadStopped, e("devices", "Workload stopped", "Carico di lavoro fermato"), EventCategory.WorkloadCrashed, e("devices", "Workload crashed", "Carico di lavoro in crash"), EventCategory.WorkloadRecovered, e("devices", "Workload recovered", "Carico di lavoro ripristinato"), EventCategory.DeviceRunOpened, e("devices", "Device run opened", "Ciclo del dispositivo aperto"), EventCategory.DeviceRunClosed, e("devices", "Device run closed", "Ciclo del dispositivo chiuso"), EventCategory.EventEmitted, e("devices", "Device event", "Evento del dispositivo"), EventCategory.PipelineEngineMetricsSnapshot, e("metrics", "Engine metrics snapshot", "Metriche dei motori", N), EventCategory.PipelineEngineProvisioning, e("pipeline", "Engine provisioning", "Preparazione del motore"), EventCategory.ClusterTopologySnapshot, e("metrics", "Cluster topology snapshot", "Topologia del cluster", N), EventCategory.MetricsNodeResourcesSnapshot, e("metrics", "Node resources snapshot", "Risorse dei nodi", N), EventCategory.MetricsNodeProcessesSnapshot, e("metrics", "Node processes snapshot", "Processi dei nodi", N), EventCategory.CapabilityBindingChanged, e("system", "Capability binding changed", "Collegamento di capability cambiato", N), EventCategory.ModelDownloadProgress, e("pipeline", "Model download progress", "Avanzamento download modello", N), EventCategory.AgentRegistered, e("agents", "Agent registered", "Agent registrato"), EventCategory.AgentUnregistered, e("agents", "Agent removed", "Agent rimosso"), EventCategory.AgentOnline, e("agents", "Agent online", "Agent online"), EventCategory.AgentOffline, e("agents", "Agent offline", "Agent offline"), EventCategory.WorkerOnline, e("agents", "Worker online", "Worker online"), EventCategory.WorkerOffline, e("agents", "Worker offline", "Worker offline"), EventCategory.AgentTaskDispatched, e("agents", "Agent task dispatched", "Attività inviata a un agent"), EventCategory.AgentTaskAssigned, e("agents", "Agent task assigned", "Attività assegnata a un agent"), EventCategory.AgentTrpcConnected, e("agents", "Agent API connected", "API dell’agent connessa"), EventCategory.AgentWsConnected, e("agents", "Agent socket connected", "Socket dell’agent connesso"), EventCategory.AgentWsDisconnected, e("agents", "Agent socket disconnected", "Socket dell’agent disconnesso"), EventCategory.AgentBackupActivated, e("agents", "Agent backup activated", "Backup dell’agent attivato"), EventCategory.OrchestrationSettingsUpdated, e("pipeline", "Orchestration settings updated", "Impostazioni di orchestrazione aggiornate"), EventCategory.MotionAnalysis, e("detection", "Motion analysis", "Analisi del movimento", N), EventCategory.MotionZonesRaw, e("detection", "Raw motion zones", "Zone di movimento grezze", N), EventCategory.MotionOnMotionChanged, e("detection", "Motion changed", "Movimento cambiato", N), EventCategory.DetectionResult, e("detection", "Detection result", "Risultato del rilevamento", N), EventCategory.DetectionRaw, e("detection", "Raw detection", "Rilevamento grezzo"), EventCategory.DetectionCameraNative, e("detection", "Camera native detection", "Rilevamento nativo della camera"), EventCategory.PipelineAudioInferenceResult, e("pipeline", "Audio inference result", "Risultato di inferenza audio", N), EventCategory.DetectionPhaseTransition, e("detection", "Detection phase changed", "Fase di rilevamento cambiata"), EventCategory.ProviderMotion, e("detection", "Camera raw motion", "Movimento grezzo della camera", N), EventCategory.ProviderDetection, e("detection", "Camera onboard detection", "Rilevamento a bordo camera"), EventCategory.EnrichmentEmbeddingStored, e("enrichment", "Embedding stored", "Embedding salvato"), EventCategory.EnrichmentSceneStateChanged, e("enrichment", "Scene state changed", "Stato della scena cambiato"), EventCategory.EnrichmentActivitySummary, e("enrichment", "Activity summary", "Riepilogo dell’attività"), EventCategory.PipelineAnalyticsTrackLifecycle, e("detection", "Track lifecycle", "Ciclo di vita della traccia"), EventCategory.PipelineAnalyticsTrackStarted, e("detection", "Track started", "Traccia iniziata", {
127386
127403
  noise: true,
127387
127404
  deprecated: true
127388
127405
  }), EventCategory.PipelineAnalyticsTrackEnded, e("detection", "Track ended", "Traccia terminata", {
@@ -127829,7 +127846,12 @@ var TargetKindTextCapsSchema = object({
127829
127846
  title: boolean(),
127830
127847
  body: boolean()
127831
127848
  });
127832
- _enum([
127849
+ /**
127850
+ * The message fields a rule can author for a target (#483). Derived from a
127851
+ * kind's caps by `deliverableFields` — the ONE reading of the declaration, used
127852
+ * by the dispatcher (drop), the admin rule editor (show) and the viewer.
127853
+ */
127854
+ var NotificationFieldSchema = _enum([
127833
127855
  "title",
127834
127856
  "body",
127835
127857
  "attachments",
@@ -153358,6 +153380,7 @@ function macroOnly(macro) {
153358
153380
  };
153359
153381
  }
153360
153382
  }
153383
+ var FaultCodesSchema = array(string().min(1)).max(64);
153361
153384
  /**
153362
153385
  * Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
153363
153386
  *
@@ -153492,6 +153515,17 @@ var DeviceBecomesLeafSchema = object({
153492
153515
  path: ["value"]
153493
153516
  });
153494
153517
  });
153518
+ /**
153519
+ * A matching fault BECOMES active on a device (`device-fault.ts`): the device's
153520
+ * whole fault list is read, not only its principal code. `codes` empty = any
153521
+ * fault. Fires once per appearance; a fault already raised at start only seeds.
153522
+ */
153523
+ var DeviceFaultRaisedLeafSchema = object({
153524
+ kind: literal("device-fault-raised"),
153525
+ ...eventLeafId,
153526
+ deviceId: number$1().int().nonnegative(),
153527
+ codes: FaultCodesSchema
153528
+ });
153495
153529
  var DeviceEventLeafSchema = object({
153496
153530
  kind: literal("device-event"),
153497
153531
  ...eventLeafId,
@@ -153569,6 +153603,12 @@ var StationaryLeafSchema = object({
153569
153603
  /** `appeared`: it became parked. `departed`: the registry retired it. */
153570
153604
  phase: _enum(["appeared", "departed"])
153571
153605
  });
153606
+ /** "has a fault": a matching fault is active on the device NOW (its whole fault list). `codes` empty = any. */
153607
+ var DeviceFaultIsLeafSchema = object({
153608
+ kind: literal("device-fault-is"),
153609
+ deviceId: number$1().int().nonnegative(),
153610
+ codes: FaultCodesSchema
153611
+ });
153572
153612
  /** "is": one device field compared to one value, NOW. */
153573
153613
  var DeviceIsLeafSchema = object({
153574
153614
  kind: literal("device-is"),
@@ -153691,12 +153731,14 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
153691
153731
  DeviceBecomesLeafSchema,
153692
153732
  DeviceEventLeafSchema,
153693
153733
  DeviceFiredLeafSchema,
153734
+ DeviceFaultRaisedLeafSchema,
153694
153735
  ScheduleLeafSchema,
153695
153736
  ManualLeafSchema,
153696
153737
  IntervalLeafSchema,
153697
153738
  DetectionLeafSchema,
153698
153739
  StationaryLeafSchema,
153699
153740
  DeviceIsLeafSchema,
153741
+ DeviceFaultIsLeafSchema,
153700
153742
  StationaryPresentLeafSchema,
153701
153743
  ExpressionLeafSchema,
153702
153744
  TimeIsLeafSchema,
@@ -153706,6 +153748,7 @@ var EVENT_KINDS = new Set([
153706
153748
  "device-becomes",
153707
153749
  "device-event",
153708
153750
  "device-fired",
153751
+ "device-fault-raised",
153709
153752
  "schedule",
153710
153753
  "manual",
153711
153754
  "interval",
@@ -153787,6 +153830,7 @@ var LEAF_WORDS = {
153787
153830
  "device-becomes": "a device value that becomes",
153788
153831
  "device-event": "a device event",
153789
153832
  "device-fired": "a device firing an event",
153833
+ "device-fault-raised": "a device fault being raised",
153790
153834
  schedule: "a schedule",
153791
153835
  manual: "a manual run",
153792
153836
  interval: "an interval",
@@ -154130,8 +154174,15 @@ function convertLegacyWhen(half) {
154130
154174
  /** The longest one `wait` step lasts. It is cut by a restart of the run and does not survive a hub restart. */
154131
154175
  var WAIT_MAX_SECONDS = 3600;
154132
154176
  var WAIT_TOO_LONG = `a wait is at most one hour (${WAIT_MAX_SECONDS} s)`;
154177
+ /**
154178
+ * Every step kind may be switched off without deleting it: `enabled: false`
154179
+ * skips the step (and, for a block step, its whole subtree), traced `disabled`.
154180
+ * Absent means enabled.
154181
+ */
154182
+ var stepEnabledShape = { enabled: boolean().optional() };
154133
154183
  var AutomationWaitStepSchema = object({
154134
154184
  kind: literal("wait"),
154185
+ ...stepEnabledShape,
154135
154186
  seconds: number$1().min(0).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG)
154136
154187
  });
154137
154188
  /**
@@ -154140,6 +154191,7 @@ var AutomationWaitStepSchema = object({
154140
154191
  */
154141
154192
  var AutomationCommandStepBaseSchema = object({
154142
154193
  kind: literal("command"),
154194
+ ...stepEnabledShape,
154143
154195
  /** WHO the step acts on. */
154144
154196
  target: ActionTargetSchema,
154145
154197
  /** The vocabulary action this step performs (`cover.open`). */
@@ -154215,6 +154267,7 @@ var AutomationGuardedCommandStepSchema = AutomationCommandStepBaseSchema.extend(
154215
154267
  /** End the run here, on purpose. `reason` may carry `{{vars.x}}` slots. */
154216
154268
  var AutomationStopStepSchema = object({
154217
154269
  kind: literal("stop"),
154270
+ ...stepEnabledShape,
154218
154271
  reason: string().min(1, "a stop needs a reason: it is what the run trace shows").max(200),
154219
154272
  /** `ok`: the run ends as a success. `failed`: it ends as a failure, with the reason. */
154220
154273
  outcome: _enum(["ok", "failed"]),
@@ -154234,6 +154287,7 @@ var RESERVED_RUN_VARS = [
154234
154287
  */
154235
154288
  var AutomationSetStepSchema = object({
154236
154289
  kind: literal("set"),
154290
+ ...stepEnabledShape,
154237
154291
  vars: record(string(), union([
154238
154292
  string().max(500),
154239
154293
  number$1(),
@@ -154242,8 +154296,105 @@ var AutomationSetStepSchema = object({
154242
154296
  /** Set only when this reads true; false or unknown leaves the bag as it is. */
154243
154297
  if: AutomationWhenSchema.optional()
154244
154298
  });
154299
+ var NOTIFY_BODY_MAX = 2e3;
154300
+ /**
154301
+ * Send a notification through one notification target (the same targets the
154302
+ * notification centre addresses). Title and body may carry `{{vars.x}}` slots.
154303
+ * Not a device command: a notification target is an instance of the
154304
+ * `notification-output` cap, not a device.
154305
+ */
154306
+ var AutomationNotifyStepSchema = object({
154307
+ kind: literal("notify"),
154308
+ ...stepEnabledShape,
154309
+ /** The notification target (an instance id of `notification-output`). */
154310
+ targetId: string().min(1, "pick the notification target"),
154311
+ title: string().max(200).optional(),
154312
+ body: string().min(1, "a notification needs a message").max(NOTIFY_BODY_MAX),
154313
+ ...continueOnErrorShape
154314
+ });
154315
+ var HTTP_URL_MAX = 2e3;
154316
+ var HTTP_BODY_MAX = 16384;
154317
+ var HTTP_HEADER_VALUE_MAX = 1e3;
154318
+ var saveAsSchema = string().regex(SET_VAR_NAME_RE, "a variable name is letters, digits and _, not starting with a digit (max 40)").refine((name) => !RESERVED_RUN_VARS.includes(name), { message: `the names ${RESERVED_RUN_VARS.join(", ")} belong to the run and cannot be used` });
154319
+ var retryUntilSecondsSchema = number$1().int().min(1).max(600, `a retry window is at most 600 s`);
154320
+ /**
154321
+ * Whether a TCP port on a host answers. TCP only: an ICMP echo needs a raw
154322
+ * socket or a `ping` binary with extra privileges, and the hub image ships
154323
+ * neither for its non-root user, so it is not offered.
154324
+ *
154325
+ * Without `expect` the step wants the host REACHABLE. The result
154326
+ * (`{ reachable, rttMs, error }`) goes to the run variable `saveAs`.
154327
+ */
154328
+ var AutomationProbeStepSchema = object({
154329
+ kind: literal("probe"),
154330
+ ...stepEnabledShape,
154331
+ /** A host name or an address; may carry `{{vars.x}}` slots. */
154332
+ host: string().min(1, "a probe needs a host").max(253).regex(/^[^\s/]+$/, "a host has no spaces or slashes"),
154333
+ port: number$1().int().min(1, "a port is 1 to 65535").max(65535, "a port is 1 to 65535"),
154334
+ timeoutSeconds: number$1().int().min(1).max(30),
154335
+ expect: _enum(["reachable", "unreachable"]).optional(),
154336
+ /** Keep probing every {@link REACH_RETRY_INTERVAL_S} s until the expectation holds, for this long. */
154337
+ retryUntilSeconds: retryUntilSecondsSchema.optional(),
154338
+ saveAs: saveAsSchema.optional(),
154339
+ ...continueOnErrorShape
154340
+ }).strict();
154341
+ var HTTP_METHODS = [
154342
+ "GET",
154343
+ "POST",
154344
+ "PUT",
154345
+ "PATCH",
154346
+ "DELETE"
154347
+ ];
154348
+ /**
154349
+ * What an HTTP request must answer for the step to pass: its status, or a field
154350
+ * of the parsed JSON body, compared the way a device field is.
154351
+ */
154352
+ var AutomationHttpExpectSchema = object({
154353
+ on: _enum(["status", "json"]),
154354
+ /** A dotted path into the JSON body (`sysInfo.rawUartRemoteAddress`); needed for `json`. */
154355
+ fieldPath: string().min(1).max(200).optional(),
154356
+ operator: AutomationConditionOperatorSchema,
154357
+ value: union([
154358
+ string(),
154359
+ number$1(),
154360
+ boolean()
154361
+ ])
154362
+ }).strict().refine((expect) => expect.on !== "json" || expect.fieldPath !== void 0, {
154363
+ message: "a JSON expectation names the field it reads",
154364
+ path: ["fieldPath"]
154365
+ });
154366
+ function isHttpUrl(url) {
154367
+ if (url.includes("{{")) return /^https?:\/\/\S+$/i.test(url);
154368
+ try {
154369
+ const parsed = new URL(url);
154370
+ return parsed.protocol === "http:" || parsed.protocol === "https:";
154371
+ } catch {
154372
+ return false;
154373
+ }
154374
+ }
154375
+ /**
154376
+ * One HTTP request. Without `expect` the step wants a 2xx answer. The result
154377
+ * (`{ status, ok, json, text, error }`) goes to the run variable `saveAs`.
154378
+ * Header values are stored as typed, in plain text: they are in the recipe and
154379
+ * in the generated source, so anyone who can open the automation can read a
154380
+ * token put in one. Header values and bodies are never logged or traced.
154381
+ */
154382
+ var AutomationHttpRequestStepSchema = object({
154383
+ kind: literal("http-request"),
154384
+ ...stepEnabledShape,
154385
+ method: _enum(HTTP_METHODS),
154386
+ url: string().max(HTTP_URL_MAX).refine(isHttpUrl, "the address is an http:// or https:// URL"),
154387
+ headers: record(string().regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/, "not a valid header name"), string().max(HTTP_HEADER_VALUE_MAX)).refine((headers) => Object.keys(headers).length <= 20, { message: `at most 20 headers` }).optional(),
154388
+ body: string().max(HTTP_BODY_MAX).optional(),
154389
+ timeoutSeconds: number$1().int().min(1).max(60),
154390
+ expect: AutomationHttpExpectSchema.optional(),
154391
+ retryUntilSeconds: retryUntilSecondsSchema.optional(),
154392
+ saveAs: saveAsSchema.optional(),
154393
+ ...continueOnErrorShape
154394
+ }).strict();
154245
154395
  var AutomationRunActionStepSchema = object({
154246
154396
  kind: literal("action"),
154397
+ ...stepEnabledShape,
154247
154398
  /** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
154248
154399
  actionId: string().min(1),
154249
154400
  /** Values for the action's declared variables; the others take their default. */
@@ -154269,6 +154420,7 @@ var WAIT_UNTIL_TIMEOUT_MAX_S = 21600;
154269
154420
  */
154270
154421
  var AutomationWaitUntilStepSchema = object({
154271
154422
  kind: literal("wait-until"),
154423
+ ...stepEnabledShape,
154272
154424
  when: AutomationWhenSchema,
154273
154425
  timeoutS: number$1().int().min(1, "a wait needs a timeout of at least one second").max(WAIT_UNTIL_TIMEOUT_MAX_S, `a wait for a condition is at most six hours (${WAIT_UNTIL_TIMEOUT_MAX_S} s)`),
154274
154426
  onTimeout: _enum(["continue", "stop"])
@@ -154294,7 +154446,10 @@ var plainStepSchemas = [
154294
154446
  AutomationCommandStepBaseSchema.extend(continueOnErrorShape).strict().superRefine(refineKnownAction),
154295
154447
  AutomationStopStepSchema.omit({ if: true }).strict(),
154296
154448
  AutomationSetStepSchema.omit({ if: true }).strict(),
154297
- AutomationRunActionStepSchema.strict()
154449
+ AutomationRunActionStepSchema.strict(),
154450
+ AutomationNotifyStepSchema.strict(),
154451
+ AutomationProbeStepSchema,
154452
+ AutomationHttpRequestStepSchema
154298
154453
  ];
154299
154454
  /**
154300
154455
  * A plain step: a flow step with no condition of its own and no step inside
@@ -154302,7 +154457,7 @@ var plainStepSchemas = [
154302
154457
  */
154303
154458
  var AutomationBranchStepSchema = discriminatedUnion("kind", plainStepSchemas, { error: nestTooDeep });
154304
154459
  /** A step that can run beside others: it writes no variable and does not end the run. */
154305
- var AutomationParallelMemberSchema = AutomationBranchStepSchema.refine((step) => step.kind === "command" || step.kind === "action" || step.kind === "wait", "a parallel holds device commands, actions and waits only: a set or a stop beside other steps has no order");
154460
+ var AutomationParallelMemberSchema = AutomationBranchStepSchema.refine((step) => step.kind === "command" || step.kind === "action" || step.kind === "notify" || step.kind === "wait", "a parallel holds device commands, actions and waits only: a set or a stop beside other steps has no order");
154306
154461
  /**
154307
154462
  * Several steps at once (#500): all are started together and all are awaited.
154308
154463
  * A failure fails the run once the others finished, as in a sequence; a member
@@ -154310,6 +154465,7 @@ var AutomationParallelMemberSchema = AutomationBranchStepSchema.refine((step) =>
154310
154465
  */
154311
154466
  var AutomationParallelStepSchema = object({
154312
154467
  kind: literal("parallel"),
154468
+ ...stepEnabledShape,
154313
154469
  steps: array(AutomationParallelMemberSchema).min(2, "a parallel needs at least two steps").max(5, `a parallel takes at most 5 steps`)
154314
154470
  }).strict();
154315
154471
  var REPEAT_NEEDS_MAX = "a repeat on a condition needs a maximum number of iterations";
@@ -154350,6 +154506,7 @@ var AutomationRepeatLoopSchema = discriminatedUnion("by", [
154350
154506
  function repeatSchemaOf(step) {
154351
154507
  return object({
154352
154508
  kind: literal("repeat"),
154509
+ ...stepEnabledShape,
154353
154510
  loop: AutomationRepeatLoopSchema,
154354
154511
  steps: array(step).min(1, "a repeat needs at least one step").max(10, `a repeat takes at most 10 steps`)
154355
154512
  }).strict();
@@ -154365,6 +154522,7 @@ function chooseSchemaOf(step) {
154365
154522
  const steps = array(step).max(10);
154366
154523
  return object({
154367
154524
  kind: literal("choose"),
154525
+ ...stepEnabledShape,
154368
154526
  branches: array(object({
154369
154527
  if: AutomationWhenSchema,
154370
154528
  steps: steps.min(1, "a branch needs at least one step")
@@ -154390,8 +154548,12 @@ var AutomationActionSchema = discriminatedUnion("kind", [
154390
154548
  AutomationParallelStepSchema,
154391
154549
  AutomationRepeatStepSchema,
154392
154550
  AutomationRunActionStepSchema,
154551
+ AutomationNotifyStepSchema,
154552
+ AutomationProbeStepSchema,
154553
+ AutomationHttpRequestStepSchema,
154393
154554
  object({
154394
154555
  kind: literal("code"),
154556
+ ...stepEnabledShape,
154395
154557
  /** Compiled into the automation's OWN block by esbuild — not a third
154396
154558
  * runtime, not a `vm`, and not dynamically evaluated. */
154397
154559
  code: string().min(1).max(2e4)
@@ -154713,6 +154875,7 @@ var AutomationConditionTraceNodeSchema = object({
154713
154875
  "not",
154714
154876
  "condition",
154715
154877
  "device-is",
154878
+ "device-fault-is",
154716
154879
  "expression",
154717
154880
  "stationary-present",
154718
154881
  "time-is",
@@ -154720,6 +154883,7 @@ var AutomationConditionTraceNodeSchema = object({
154720
154883
  "device-becomes",
154721
154884
  "device-event",
154722
154885
  "device-fired",
154886
+ "device-fault-raised",
154723
154887
  "schedule",
154724
154888
  "interval",
154725
154889
  "manual",
@@ -154778,6 +154942,9 @@ var StepTraceBaseSchema = object({
154778
154942
  * (D1021): why a sentence says "—" where a number was expected. Bounded.
154779
154943
  */
154780
154944
  templates: array(string()).max(20).optional(),
154945
+ /** A probe or an HTTP request: how many tries it made, and what the last one saw (no header, no body). */
154946
+ attempts: number$1().int().optional(),
154947
+ lastAttempt: string().optional(),
154781
154948
  /**
154782
154949
  * What the step's own `if` read when the step was reached (#472): `true` the
154783
154950
  * step ran, `false` its `else` ran (or nothing did), `unknown` a state leaf
@@ -159391,6 +159558,8 @@ method(object({
159391
159558
  /** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
159392
159559
  profileHint: CamProfileSchema.optional(),
159393
159560
  metadata: record(string(), unknown()).optional(),
159561
+ /** The longest session the source keeps open (ms) — see `CameraStreamSchema.maxSessionMs`. */
159562
+ maxSessionMs: number$1().int().positive().optional(),
159394
159563
  /** Required when kind === 'derived' — the source camStreamId the
159395
159564
  * derived broker reads its encoded plane from.
159396
159565
  * The runtime guard (broker manager, Task 10) enforces presence for
@@ -159609,6 +159778,11 @@ method(object({
159609
159778
  deviceId: number$1().int().nonnegative(),
159610
159779
  camStreamId: string(),
159611
159780
  brokerId: string()
159781
+ })), event(object({
159782
+ deviceId: number$1().int().nonnegative(),
159783
+ camStreamId: string(),
159784
+ brokerId: string(),
159785
+ reason: string()
159612
159786
  })), NOT_A_DEVICE.PIPELINE;
159613
159787
  var StreamCodecSchema = _enum([
159614
159788
  "h264",
@@ -167489,9 +167663,10 @@ object({
167489
167663
  /** Longest silence a push integration may keep before the core re-reads it and asks it to resubscribe. */
167490
167664
  heartbeatMs: number$1().int().positive().optional(),
167491
167665
  /**
167492
- * Bumped by the provider each time its push subscription reconnected on its
167493
- * own. A change makes the core re-read every device of the integration
167494
- * (pushes lost while it was down; events may be dropped, D8).
167666
+ * Changes on every reconnect of the provider's push subscription; any change
167667
+ * makes the core read every device of the integration once (pushes lost while
167668
+ * it was down; events may be dropped, D8). It need not grow: a provider whose
167669
+ * counter restarts with its process is still understood.
167495
167670
  */
167496
167671
  connectionEpoch: number$1().int().nonnegative().optional()
167497
167672
  });
@@ -169151,6 +169326,15 @@ var DeviceFaultSchema = object({
169151
169326
  label: string(),
169152
169327
  severity: DeviceErrorSeveritySchema
169153
169328
  });
169329
+ /** One kind of fault a device CAN raise: the integration's own declared catalog entry. */
169330
+ var DeviceFaultTypeSchema = DeviceFaultSchema;
169331
+ /**
169332
+ * The fault catalog of a device, declared by its integration at runtime (never a
169333
+ * code enum). A fault outside the catalog is still published and still matches
169334
+ * a rule that names no code.
169335
+ */
169336
+ var ListFaultTypesInputSchema = object({ deviceId: number$1().int().nonnegative() });
169337
+ var FaultTypesSchema = object({ types: array(DeviceFaultTypeSchema) });
169154
169338
  /**
169155
169339
  * The fault a device reports right now. One slice per device.
169156
169340
  *
@@ -169188,7 +169372,12 @@ var errorCapability = {
169188
169372
  scope: "device",
169189
169373
  deviceNative: true,
169190
169374
  mode: "singleton",
169191
- methods: {},
169375
+ methods: {
169376
+ /** The fault codes this device's integration can raise; `[]` when it declares none. */
169377
+ listFaultTypes: method(ListFaultTypesInputSchema, FaultTypesSchema, {
169378
+ kind: "query",
169379
+ auth: "protected"
169380
+ }) },
169192
169381
  status: {
169193
169382
  schema: ErrorStatusSchema,
169194
169383
  kind: "push",
@@ -184157,6 +184346,13 @@ var NcSystemEventConditionSchema = object({
184157
184346
  * pick from. The hub refuses an id the action index does not know.
184158
184347
  */
184159
184348
  commandActions: array(string().min(1)).min(1).optional(),
184349
+ /**
184350
+ * `device-attention-*` only: the fault CODES this rule speaks about (the
184351
+ * integration declares them through `error.listFaultTypes`; free text is
184352
+ * accepted too). Absent or empty = any fault. The rule matches when any
184353
+ * fault of the episode is in the list.
184354
+ */
184355
+ faultCodes: array(string().min(1)).optional(),
184160
184356
  /** `device-command` only: how the command settled. A device's own change is not a command. */
184161
184357
  commandOutcomes: array(_enum([
184162
184358
  "confirmed",
@@ -185174,6 +185370,15 @@ var NcRuleInputSchema = object({
185174
185370
  */
185175
185371
  askVerdict: boolean().optional(),
185176
185372
  /**
185373
+ * An ALERT notification (`alert-critical`, `alert-error`, device attention)
185374
+ * carries the alert's own action — an open-URL button and, for an `invoke`
185375
+ * action, a token-authed button that runs it. Absent and `true` mean ON;
185376
+ * `false` switches it off for this rule. `.optional()`, never `.default()`
185377
+ * (a Zod default does not run on the addon cap path), so a rule authored
185378
+ * before this field keeps the action.
185379
+ */
185380
+ offerAlertAction: boolean().optional(),
185381
+ /**
185177
185382
  * Operator tags (D1054), kept on the rule like a core block's. Absent = no
185178
185383
  * tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
185179
185384
  * does not name `tags` keeps the stored ones (the store merges), and an
@@ -196082,7 +196287,16 @@ var CamStreamDescriptorSchema = object({
196082
196287
  /** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
196083
196288
  profileHint: CamProfileSchema.optional(),
196084
196289
  /** Transport-specific opaque metadata (e.g. rfc4571 SDP). */
196085
- metadata: record(string(), unknown()).optional()
196290
+ metadata: record(string(), unknown()).optional(),
196291
+ /**
196292
+ * The longest continuous session the SOURCE will keep open, in ms, declared by
196293
+ * the provider that knows it (a hub that cuts every child's session on a
196294
+ * timer). Absent = no limit. The broker re-dials a live source a little
196295
+ * BEFORE this elapses, on its own terms and announced to consumers, so the
196296
+ * source's cut never lands mid-recording. Declare slightly under what was
196297
+ * observed.
196298
+ */
196299
+ maxSessionMs: number$1().int().positive().optional()
196086
196300
  });
196087
196301
  /**
196088
196302
  * `stream-catalog` — device-scoped, provider-implemented. The pull counterpart
@@ -202990,6 +203204,20 @@ function deviceErrorEdge(previous, next) {
202990
203204
  function deviceErrorAlertId(deviceId) {
202991
203205
  return `device-error:${String(deviceId)}`;
202992
203206
  }
203207
+ /** Every active fault, the principal first; a status that lists none still names its principal. */
203208
+ function activeFaults(status) {
203209
+ if (status.faults !== void 0 && status.faults.length > 0) return status.faults.map(({ code, label, severity }) => ({
203210
+ code,
203211
+ label,
203212
+ severity
203213
+ }));
203214
+ if (status.code === null) return [];
203215
+ return [{
203216
+ code: status.code,
203217
+ label: status.label ?? status.code,
203218
+ severity: status.severity
203219
+ }];
203220
+ }
202993
203221
  /** The alert that opens an episode. `since` is the fault's own start, else `now`. */
202994
203222
  function buildDeviceErrorAlert(deviceId, deviceName, status, now) {
202995
203223
  const label = status.label ?? status.code ?? "Fault";
@@ -203017,7 +203245,9 @@ function buildDeviceErrorAlert(deviceId, deviceName, status, now) {
203017
203245
  metadata: {
203018
203246
  episodeId: `${alertId}@${String(startedAt)}`,
203019
203247
  code: status.code,
203020
- deviceSeverity: status.severity
203248
+ deviceSeverity: status.severity,
203249
+ label: status.label,
203250
+ faults: activeFaults(status)
203021
203251
  }
203022
203252
  };
203023
203253
  }
@@ -203027,6 +203257,8 @@ var BaseDevice = class {
203027
203257
  type;
203028
203258
  /** True when another process owns the base slices (`options.deviceStatus: 'external'`). */
203029
203259
  statusIsExternal;
203260
+ /** The fault catalog the integration declared; `[]` until it does. */
203261
+ faultTypes = [];
203030
203262
  name;
203031
203263
  parentDeviceId;
203032
203264
  role;
@@ -203364,10 +203596,19 @@ var BaseDevice = class {
203364
203596
  * a restart is compared, not announced again.
203365
203597
  */
203366
203598
  registerErrorCap() {
203367
- this.ctx.registerNativeCap?.(errorCapability, {});
203599
+ this.ctx.registerNativeCap?.(errorCapability, { listFaultTypes: async () => ({ types: [...this.faultTypes] }) });
203368
203600
  if (this.runtimeState.getCapState(errorCapability.name) === void 0) this.setCapSlice(errorCapability, ERROR_STATUS_COLD);
203369
203601
  }
203370
203602
  /**
203603
+ * Declare the fault kinds this device's integration can raise (code, label,
203604
+ * severity), served by `error.listFaultTypes` so a rule's code picker is
203605
+ * offered the integration's own words. The default is `[]`; a fault outside
203606
+ * the catalog is still published. Call it before or after `registerErrorCap`.
203607
+ */
203608
+ declareFaultTypes(types) {
203609
+ this.faultTypes = types.map((type) => ({ ...type }));
203610
+ }
203611
+ /**
203371
203612
  * Publish the device's fault. The slice is written; on an EDGE (a fault
203372
203613
  * starts, or one resolves) an attention episode opens or closes through the
203373
203614
  * alerts cap, which the notification center announces as
@@ -210344,6 +210585,13 @@ Object.freeze({
210344
210585
  access: "view",
210345
210586
  role: "viewer"
210346
210587
  },
210588
+ "error.listFaultTypes": {
210589
+ capName: "error",
210590
+ capScope: "device",
210591
+ addonId: null,
210592
+ access: "view",
210593
+ role: "viewer"
210594
+ },
210347
210595
  "eventEmitter.getStatus": {
210348
210596
  capName: "event-emitter",
210349
210597
  capScope: "device",
@@ -218967,6 +219215,11 @@ Object.freeze({
218967
219215
  form: "single",
218968
219216
  optional: false
218969
219217
  }],
219218
+ "error.listFaultTypes": [{
219219
+ name: "deviceId",
219220
+ form: "single",
219221
+ optional: false
219222
+ }],
218970
219223
  "eventEmitter.getStatus": [{
218971
219224
  name: "deviceId",
218972
219225
  form: "single",
@@ -221299,7 +221552,8 @@ var NC_SYSTEM_EVENT_FILTER_KEYS = [
221299
221552
  "consumableLowPercent",
221300
221553
  "commandActions",
221301
221554
  "commandOutcomes",
221302
- "commandActorKinds"
221555
+ "commandActorKinds",
221556
+ "faultCodes"
221303
221557
  ];
221304
221558
  new Map(Object.entries({
221305
221559
  "device-online": "device-events",
@@ -221670,6 +221924,16 @@ object({
221670
221924
  nodeId: string().optional(),
221671
221925
  /** The alert's own action link (where the operator acts on it), when it has one. */
221672
221926
  actionUrl: string().optional(),
221927
+ /**
221928
+ * The alert's WHOLE action — label, link, navigation and `invoke` — on a
221929
+ * raised episode, so a notification can offer it (an absolute open-URL
221930
+ * button, a token-authed invoke button). `actionUrl` stays for the
221931
+ * `{{actionUrl}}` template variable. Additive: an episode published before
221932
+ * this field has none.
221933
+ */
221934
+ action: AlertActionSchema.optional(),
221935
+ /** A device fault episode: every active fault (`metadata.faults`), principal first. */
221936
+ faults: array(DeviceFaultSchema).optional(),
221673
221937
  at: number$1()
221674
221938
  });
221675
221939
  var RULE_BODY_ONLY = ["body"];
@@ -221954,6 +222218,9 @@ var STATE_SUMMARY_VARS = [
221954
222218
  ([...RULE_TEXT], [...DEVICE_ATTENTION, ...ALERT_EPISODE]),
221955
222219
  ([...RULE_TEXT], [...ALERT_EPISODE]),
221956
222220
  ([...RULE_TEXT], [...DEVICE_ATTENTION, ...ALERT_EPISODE]),
222221
+ ([...RULE_TEXT], [...DEVICE_ATTENTION]),
222222
+ ([...RULE_TEXT], [...DEVICE_ATTENTION]),
222223
+ ([...RULE_TEXT], [...DEVICE_ATTENTION]),
221957
222224
  [...RULE_TEXT],
221958
222225
  [...RULE_TEXT],
221959
222226
  [...RULE_TEXT],
@@ -222731,6 +222998,34 @@ function linkFieldDescriptor(key, target, labels) {
222731
222998
  ...target.kind !== void 0 ? { kind: target.kind } : {}
222732
222999
  };
222733
223000
  }
223001
+ /** When a member receives: always, inside a schedule, or while an alarm panel is in a state. */
223002
+ var GroupMemberWhenSchema = discriminatedUnion("kind", [
223003
+ object({ kind: literal("always") }),
223004
+ object({
223005
+ kind: literal("schedule"),
223006
+ schedule: NcScheduleSchema
223007
+ }),
223008
+ object({
223009
+ kind: literal("alarm"),
223010
+ deviceId: number$1().int().nonnegative(),
223011
+ states: array(AlarmStateSchema).min(1)
223012
+ })
223013
+ ]);
223014
+ object({
223015
+ targetId: string().min(1),
223016
+ enabled: boolean().optional(),
223017
+ when: GroupMemberWhenSchema.optional(),
223018
+ /** Which message fields this member receives. Absent = all of them. */
223019
+ fields: array(NotificationFieldSchema).optional(),
223020
+ /** `{{title}}`, `{{body}}`, `{{priority}}` and any `{{key}}` of the notification's metadata. */
223021
+ templates: object({
223022
+ title: string().optional(),
223023
+ body: string().optional()
223024
+ }).optional(),
223025
+ minPriority: number$1().int().min(1).max(5).optional(),
223026
+ /** At most one delivery per window; a burst becomes one. 0 or absent = no throttle. */
223027
+ throttleSec: number$1().int().nonnegative().optional()
223028
+ });
222734
223029
  //#endregion
222735
223030
  //#region src/clips/clip-prefetch.ts
222736
223031
  /** The longest a device may stay quiet after refusals, whatever its interval. */
@@ -223644,6 +223939,16 @@ var reolinkCameraSchema = object({
223644
223939
  */
223645
223940
  webhookUrlGeneration: number$1().int().optional(),
223646
223941
  /**
223942
+ * "Auto-configure event push on add": right after the camera is added, arm its local event push
223943
+ * (HaCfg webhook for a standalone battery camera, else the camera mailbox). Default on.
223944
+ */
223945
+ autoConfigureEventPush: boolean().optional(),
223946
+ /**
223947
+ * What the one-time add-time run did (`configured:<mechanism>` | `skipped` | `failed`). Present
223948
+ * means the run happened: a restart never writes the camera again.
223949
+ */
223950
+ eventPushAutoConfigured: string().optional(),
223951
+ /**
223647
223952
  * On-camera motion detection master switch + sensitivity.
223648
223953
  * Pushed via `setMotionAlarm` (cmdId=47). The Reolink mobile
223649
223954
  * app + camera web UI use 1..50 (1 = least sensitive,
@@ -229457,6 +229762,8 @@ var BATTERY_REFRESH_MINUTES_KEY = "batteryRefreshMinutes";
229457
229762
  var BATTERY_REFRESH_TICK_MS = 6e4;
229458
229763
  /** The least time between two attempts in one window. */
229459
229764
  var RETRY_BACKOFF_MS = 10 * 6e4;
229765
+ /** The one refresh step whose failure does not hold the window open. */
229766
+ var SOFT_FAILURE_STEP = "snapshot";
229460
229767
  var MAX_WAKE_LEAD_MS = 5 * 6e4;
229461
229768
  var STAGGER_SLOTS = 60;
229462
229769
  /** The operator's window in ms, or `0` for off. Out-of-range values clamp. */
@@ -229587,7 +229894,15 @@ var BatteryHourlyRefresh = class {
229587
229894
  }
229588
229895
  });
229589
229896
  const outcome = await this.deps.refreshAll();
229590
- if (outcome.failed.length > 0) {
229897
+ const hardFailures = outcome.failed.filter((step) => step !== SOFT_FAILURE_STEP);
229898
+ if (hardFailures.length === 0 && outcome.failed.length > 0) logger.warn("battery hourly refresh: snapshot did not move — window stamped, not retried", {
229899
+ tags: { deviceId },
229900
+ meta: {
229901
+ failed: outcome.failed,
229902
+ attempt: this.attempts
229903
+ }
229904
+ });
229905
+ if (hardFailures.length > 0) {
229591
229906
  logger.warn("battery hourly refresh incomplete — not stamped, retried at the next chance", {
229592
229907
  tags: { deviceId },
229593
229908
  meta: {
@@ -231789,6 +232104,22 @@ var SLEEP_HYSTERESIS_MS = 5e3;
231789
232104
  * exactly its recovery role.
231790
232105
  */
231791
232106
  var HUB_SUMMARY_SLEEP_GRACE_MS = 18e4;
232107
+ /**
232108
+ * How recent the last video packet must be for the stream to count as
232109
+ * flowing. A camera that is delivering video is awake, whatever a second-hand
232110
+ * claim says: a Home Hub child on DC power was marked sleeping every 28 min
232111
+ * (and by the lagging hub summary) while its RTP was running, which froze the
232112
+ * snapshot tile on "sleeping".
232113
+ */
232114
+ var VIDEO_FLOW_FRESH_MS = 5e3;
232115
+ /**
232116
+ * A source that is not the camera's own reading of itself: the parent's
232117
+ * summaries, and a pushed `simple-event` (the Home Hub's session cut arrives
232118
+ * as one).
232119
+ */
232120
+ function isSecondHand(source) {
232121
+ return source === "hub-summary" || source === "hub-reconcile" || source === "simple-event";
232122
+ }
231792
232123
  /** A source whose verdict comes from the parent NVR's channel summary. */
231793
232124
  function isSummarySourced(source) {
231794
232125
  return source === "hub-summary" || source === "hub-reconcile";
@@ -231809,8 +232140,23 @@ function isSummarySourced(source) {
231809
232140
  * observation inside the grace says otherwise.
231810
232141
  */
231811
232142
  function decideSleepCommit(input) {
231812
- const { current, next, source, lastFirstHandCommitAt, nowMs } = input;
232143
+ const { current, next, source, lastFirstHandCommitAt, nowMs, videoFlowing, wired } = input;
231813
232144
  if (current === next) return { kind: "unchanged" };
232145
+ if (next === true && isSecondHand(source)) {
232146
+ const sinceMs = nowMs - lastFirstHandCommitAt;
232147
+ if (wired) return {
232148
+ kind: "refused",
232149
+ reason: "wired",
232150
+ windowMs: 0,
232151
+ sinceLastChangeMs: sinceMs
232152
+ };
232153
+ if (videoFlowing) return {
232154
+ kind: "refused",
232155
+ reason: "video-flowing",
232156
+ windowMs: VIDEO_FLOW_FRESH_MS,
232157
+ sinceLastChangeMs: sinceMs
232158
+ };
232159
+ }
231814
232160
  const summarySourced = isSummarySourced(source);
231815
232161
  const firstHandWake = source === "confirmed-wake" && next === false;
231816
232162
  const sinceLastChangeMs = nowMs - lastFirstHandCommitAt;
@@ -231835,6 +232181,58 @@ function decideSleepCommit(input) {
231835
232181
  };
231836
232182
  }
231837
232183
  //#endregion
232184
+ //#region src/session-limit.ts
232185
+ /**
232186
+ * How long the broker lets a Home Hub child's session run before it re-dials on
232187
+ * its own terms.
232188
+ *
232189
+ * Observed 2026-11-20 on two DC-powered children of one Home Hub: the hub cut
232190
+ * BOTH sessions at the same second, every 28 min 07 s (16:16:36, then 16:44:43),
232191
+ * which is a hub session limit, not the camera. Declared a minute under that so
232192
+ * the planned re-dial always wins the race against the hub's cut and the
232193
+ * recording rolls over at a time of our choosing.
232194
+ */
232195
+ var HOME_HUB_SESSION_LIMIT_MS = 27 * 6e4;
232196
+ /**
232197
+ * Stamp the descriptors with the session limit the broker acts on. Only a
232198
+ * battery child of a hub gets one: a standalone camera has no such cut, and
232199
+ * declaring one there would re-dial a healthy stream for nothing.
232200
+ */
232201
+ function withSessionLimit(descriptors, input) {
232202
+ if (!input.isHubChild || !input.isBattery) return [...descriptors];
232203
+ return descriptors.map((d) => ({
232204
+ ...d,
232205
+ maxSessionMs: HOME_HUB_SESSION_LIMIT_MS
232206
+ }));
232207
+ }
232208
+ //#endregion
232209
+ //#region src/video-flow.ts
232210
+ /**
232211
+ * Report every video packet a stream server produces. The three stream kinds
232212
+ * the server can sit on name the same event differently (`videoFrame` for the
232213
+ * native and composite streams, `videoAccessUnit` for the always-on one), so
232214
+ * the kind is narrowed by class, not asserted.
232215
+ *
232216
+ * Returns the unsubscribe. A stream kind this does not know is reported
232217
+ * through `onUnknown` and never watched — silence would read as "no video".
232218
+ */
232219
+ function watchVideoFlow(stream, onFlow, onUnknown) {
232220
+ if (stream instanceof require_chunk_LXENEW4N.BaichuanVideoStream || stream instanceof CompositeStream) {
232221
+ stream.on("videoFrame", onFlow);
232222
+ return () => {
232223
+ stream.off("videoFrame", onFlow);
232224
+ };
232225
+ }
232226
+ if (stream instanceof ContinuousVideoStream) {
232227
+ stream.on("videoAccessUnit", onFlow);
232228
+ return () => {
232229
+ stream.off("videoAccessUnit", onFlow);
232230
+ };
232231
+ }
232232
+ onUnknown();
232233
+ return () => {};
232234
+ }
232235
+ //#endregion
231838
232236
  //#region src/snapshot-wake-gate.ts
231839
232237
  /**
231840
232238
  * Decide whether a snapshot read may reach the camera's socket.
@@ -231858,6 +232256,74 @@ function decideSnapshotCameraAccess(input) {
231858
232256
  };
231859
232257
  }
231860
232258
  //#endregion
232259
+ //#region src/event-push-on-add.ts
232260
+ function reasonOf(err) {
232261
+ return err instanceof Error ? err.message : String(err);
232262
+ }
232263
+ async function decide(ports) {
232264
+ if (!ports.enabled()) return {
232265
+ status: "skipped",
232266
+ reason: "auto-configure event push on add is switched off"
232267
+ };
232268
+ if (!ports.isEligible()) return {
232269
+ status: "skipped",
232270
+ reason: "hub-attached camera: the hub owns its event push, no email or webhook is written"
232271
+ };
232272
+ const method = ports.method();
232273
+ const webhookPossible = ports.isBattery() && method !== "email";
232274
+ const failures = [];
232275
+ if (webhookPossible) try {
232276
+ await ports.configureWebhook();
232277
+ return {
232278
+ status: "configured",
232279
+ mechanism: "webhook"
232280
+ };
232281
+ } catch (err) {
232282
+ failures.push(`webhook: ${reasonOf(err)}`);
232283
+ if (method === "webhook") return {
232284
+ status: "failed",
232285
+ reason: failures.join("; ")
232286
+ };
232287
+ }
232288
+ else if (method === "webhook") return {
232289
+ status: "skipped",
232290
+ reason: "the webhook needs a standalone battery camera and this one is not"
232291
+ };
232292
+ try {
232293
+ await ports.configureEmail();
232294
+ return {
232295
+ status: "configured",
232296
+ mechanism: "email"
232297
+ };
232298
+ } catch (err) {
232299
+ failures.push(`email: ${reasonOf(err)}`);
232300
+ return {
232301
+ status: "failed",
232302
+ reason: failures.join("; ")
232303
+ };
232304
+ }
232305
+ }
232306
+ /**
232307
+ * Arm a camera's local event push ONCE, right after it is added. A failure is an outcome, never
232308
+ * a throw: it must not block the add. The outcome is logged and recorded, and a recorded camera
232309
+ * is never written again. Battery cameras prefer the webhook (it works while asleep) and fall back
232310
+ * to the camera mailbox; only one path is armed, so events are not delivered twice.
232311
+ */
232312
+ async function autoConfigureEventPushOnce(ports) {
232313
+ if (ports.recordedOutcome() !== void 0) return "already-ran";
232314
+ const outcome = await decide(ports);
232315
+ ports.log(outcome);
232316
+ try {
232317
+ await ports.record(outcome);
232318
+ } catch (err) {
232319
+ ports.log({
232320
+ status: "failed",
232321
+ reason: `could not record the run: ${reasonOf(err)}`
232322
+ });
232323
+ }
232324
+ return outcome;
232325
+ }
232326
+ //#endregion
231861
232327
  //#region src/webhook-generation.ts
231862
232328
  /**
231863
232329
  * Point a battery camera's webhook at the data-plane URL ONCE per URL generation.
@@ -234570,6 +235036,7 @@ function buildPowerSourceSettingsSection(input) {
234570
235036
  label: "Power source",
234571
235037
  labelKey: "provider-reolink:schema.s_power-source.powerSource.label",
234572
235038
  default: source,
235039
+ required: true,
234573
235040
  options: [{
234574
235041
  value: "adapter",
234575
235042
  label: "Wired power",
@@ -234595,6 +235062,58 @@ async function applyPowerSourceSetting(target, value) {
234595
235062
  if (!outcome.applied) throw new Error(`The camera did not take the power source switch (it reports ${outcome.after})`);
234596
235063
  }
234597
235064
  //#endregion
235065
+ //#region src/keep-awake-loop.ts
235066
+ /**
235067
+ * Stream-scoped keep-awake for a battery camera. While at least one stream
235068
+ * consumer is attached, a periodic wake keeps the firmware from entering
235069
+ * standby (which would stop the video). One timer per camera; started when the
235070
+ * first consumer attaches, stopped when the last one leaves.
235071
+ *
235072
+ * Pure: the timer and the wake call are injected so the loop is testable.
235073
+ */
235074
+ var KEEP_AWAKE_INTERVAL_MS = 2e4;
235075
+ function createKeepAwakeLoop(deps) {
235076
+ let handle = null;
235077
+ let failing = false;
235078
+ const tick = () => {
235079
+ deps.wake().then(() => {
235080
+ failing = false;
235081
+ }).catch((err) => {
235082
+ const first = !failing;
235083
+ failing = true;
235084
+ try {
235085
+ deps.onFailure(err, first);
235086
+ } catch {}
235087
+ });
235088
+ };
235089
+ const arm = () => {
235090
+ handle = deps.setTimer(() => {
235091
+ if (handle === null) return;
235092
+ tick();
235093
+ arm();
235094
+ }, deps.intervalMs);
235095
+ };
235096
+ const halt = (activeStreams) => {
235097
+ if (handle === null) return;
235098
+ deps.clearTimer(handle);
235099
+ handle = null;
235100
+ failing = false;
235101
+ deps.onStop(activeStreams);
235102
+ };
235103
+ return {
235104
+ sync: (activeStreams) => {
235105
+ if (!deps.isBattery()) return;
235106
+ if (activeStreams > 0) {
235107
+ if (handle !== null) return;
235108
+ arm();
235109
+ deps.onStart(activeStreams);
235110
+ } else halt(activeStreams);
235111
+ },
235112
+ stop: () => halt(0),
235113
+ running: () => handle !== null
235114
+ };
235115
+ }
235116
+ //#endregion
234598
235117
  //#region src/ptz-zoom.ts
234599
235118
  /**
234600
235119
  * Fraction of total zoom travel moved by ONE press. ~8 presses to cross
@@ -235706,8 +236225,44 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
235706
236225
  nextEventHealthCheckAt = 0;
235707
236226
  /** Active video streams keyed by camStreamId. */
235708
236227
  active = /* @__PURE__ */ new Map();
236228
+ /**
236229
+ * Stream-scoped keep-awake (battery only): while a consumer holds a stream,
236230
+ * a periodic wake stops the firmware from entering standby. Reconciled with
236231
+ * `this.active` through `syncKeepAwake()` after every mutation of the map.
236232
+ */
236233
+ keepAwake = createKeepAwakeLoop({
236234
+ intervalMs: KEEP_AWAKE_INTERVAL_MS,
236235
+ isBattery: () => this.isBattery,
236236
+ wake: async () => {
236237
+ await (await this.ensureApi()).wakeUp(this.getChannel(), {
236238
+ attempts: 1,
236239
+ waitAfterWakeMs: 0
236240
+ });
236241
+ },
236242
+ setTimer: (fn, ms) => setTimeout(fn, ms),
236243
+ clearTimer: (h) => clearTimeout(h),
236244
+ onStart: (activeStreams) => this.ctx.logger.info("keep-awake: started", {
236245
+ tags: { deviceId: this.id },
236246
+ meta: { activeStreams }
236247
+ }),
236248
+ onStop: (activeStreams) => this.ctx.logger.info("keep-awake: stopped", {
236249
+ tags: { deviceId: this.id },
236250
+ meta: { activeStreams }
236251
+ }),
236252
+ onFailure: (err, first) => {
236253
+ (first ? this.ctx.logger.info.bind(this.ctx.logger) : this.ctx.logger.debug.bind(this.ctx.logger))("keep-awake: wake failed", {
236254
+ tags: { deviceId: this.id },
236255
+ meta: { error: err instanceof Error ? err.message : String(err) }
236256
+ });
236257
+ }
236258
+ });
236259
+ syncKeepAwake() {
236260
+ this.keepAwake.sync(this.active.size);
236261
+ }
235709
236262
  /** Login lock — concurrent demand events must not race the login flow. */
235710
236263
  loginPromise = null;
236264
+ /** Wall-clock ms of the last video packet the stream server produced; 0 = none yet. */
236265
+ lastVideoFlowAt = 0;
235711
236266
  /** True once we've discovered (via getBatteryInfo) that this is a battery cam. */
235712
236267
  isBattery = false;
235713
236268
  /**
@@ -236791,6 +237346,39 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
236791
237346
  });
236792
237347
  }
236793
237348
  /**
237349
+ * Arm this camera's local event push ONCE, right after it is added (the provider's
237350
+ * `onAfterCreate`). Reuses `autoConfigureBaichuanWebhook` / `autoConfigureEmailPush` as they
237351
+ * are; the outcome is logged and recorded, and never throws: it must not block the add.
237352
+ */
237353
+ async autoConfigureEventPushOnAdd() {
237354
+ return await autoConfigureEventPushOnce({
237355
+ enabled: () => this.config.get("autoConfigureEventPush") !== false,
237356
+ recordedOutcome: () => this.config.get("eventPushAutoConfigured"),
237357
+ isEligible: () => this.isEmailPushEligible,
237358
+ isBattery: () => this.isBattery,
237359
+ method: () => this.config.get("batterySleepPushMethod") ?? "auto",
237360
+ configureWebhook: async () => await this.autoConfigureBaichuanWebhook(),
237361
+ configureEmail: async () => await this.autoConfigureEmailPush(),
237362
+ record: async (outcome) => {
237363
+ await this.config.setAll({ eventPushAutoConfigured: outcome.status === "configured" ? `configured:${outcome.mechanism}` : outcome.status });
237364
+ },
237365
+ log: (outcome) => {
237366
+ if (outcome.status === "configured") this.ctx.logger.info("event-push: auto-configured on add", {
237367
+ tags: { deviceId: this.id },
237368
+ meta: { mechanism: outcome.mechanism }
237369
+ });
237370
+ else if (outcome.status === "skipped") this.ctx.logger.info("event-push: auto-configure on add skipped", {
237371
+ tags: { deviceId: this.id },
237372
+ meta: { reason: outcome.reason }
237373
+ });
237374
+ else this.ctx.logger.warn("event-push: auto-configure on add failed", {
237375
+ tags: { deviceId: this.id },
237376
+ meta: { reason: outcome.reason }
237377
+ });
237378
+ }
237379
+ });
237380
+ }
237381
+ /**
236794
237382
  * Move this battery camera's HaCfg webhook to the addon's data-plane URL, once, on the first
236795
237383
  * Baichuan contact after the upgrade (the camera is awake: this costs no wake). Only a camera
236796
237384
  * that is armed is touched; a failure is logged and retried at the next contact.
@@ -237276,17 +237864,20 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
237276
237864
  next,
237277
237865
  source,
237278
237866
  lastFirstHandCommitAt: this.sleepStateChangedAt,
237279
- nowMs: Date.now()
237867
+ nowMs: Date.now(),
237868
+ videoFlowing: Date.now() - this.lastVideoFlowAt < VIDEO_FLOW_FRESH_MS,
237869
+ wired: this.config.get("deviceCache")?.powerSourceSnapshot?.source === "adapter"
237280
237870
  });
237281
237871
  if (decision.kind === "unchanged") return false;
237282
237872
  if (decision.kind === "refused") {
237283
- this.ctx.logger.debug(decision.reason === "hysteresis" ? "ignoring sleep inference flap within hysteresis window" : "hub-summary sleep flip refused — fresher first-hand state inside grace", {
237873
+ (decision.reason === "video-flowing" || decision.reason === "wired" ? this.ctx.logger.info.bind(this.ctx.logger) : this.ctx.logger.debug.bind(this.ctx.logger))(decision.reason === "hysteresis" ? "ignoring sleep inference flap within hysteresis window" : decision.reason === "video-flowing" ? "sleep claim refused — video is flowing" : decision.reason === "wired" ? "sleep claim refused — camera is on a wired power source" : "hub-summary sleep flip refused — fresher first-hand state inside grace", {
237284
237874
  tags: { deviceId: this.id },
237285
237875
  meta: {
237286
237876
  next,
237287
237877
  source,
237288
237878
  windowMs: decision.windowMs,
237289
- sinceLastChangeMs: decision.sinceLastChangeMs
237879
+ sinceLastChangeMs: decision.sinceLastChangeMs,
237880
+ reason: decision.reason
237290
237881
  }
237291
237882
  });
237292
237883
  return false;
@@ -240274,7 +240865,10 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240274
240865
  * See `native-sdp-overlay.ts`.
240275
240866
  */
240276
240867
  withLiveNativeSdp(descriptors) {
240277
- return overlayLiveNativeRfc4571Sdp(descriptors, (camStreamId) => {
240868
+ return overlayLiveNativeRfc4571Sdp(withSessionLimit(descriptors, {
240869
+ isHubChild: this.isHubChild(),
240870
+ isBattery: this.isBattery
240871
+ }), (camStreamId) => {
240278
240872
  const server = this.active.get(camStreamId)?.server;
240279
240873
  if (!server?.server?.listening) return null;
240280
240874
  return {
@@ -240576,6 +241170,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240576
241170
  ...entry.fps !== void 0 ? { fps: entry.fps } : {},
240577
241171
  ...entry.codec !== void 0 ? { codec: entry.codec } : {},
240578
241172
  ...entry.metadata ? { metadata: entry.metadata } : {},
241173
+ ...entry.maxSessionMs !== void 0 ? { maxSessionMs: entry.maxSessionMs } : {},
240579
241174
  deviceFeatures: entry.deviceFeatures ?? [...this.features],
240580
241175
  autoEligible: entry.autoEligible ?? true
240581
241176
  });
@@ -240655,6 +241250,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240655
241250
  this.stopBatteryUpdatePolling();
240656
241251
  this.stopAlignAuxPolling();
240657
241252
  this.stopWatchdogs();
241253
+ this.keepAwake.stop();
240658
241254
  this.detachFromHubSession();
240659
241255
  if (this.reconnectTimer) {
240660
241256
  clearTimeout(this.reconnectTimer);
@@ -240700,6 +241296,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240700
241296
  await existing.server.close("recreate");
240701
241297
  } catch {}
240702
241298
  this.active.delete(camStreamId);
241299
+ this.syncKeepAwake();
240703
241300
  }
240704
241301
  let api;
240705
241302
  try {
@@ -240747,9 +241344,18 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240747
241344
  server
240748
241345
  };
240749
241346
  this.active.set(camStreamId, entry);
241347
+ this.syncKeepAwake();
241348
+ const stopVideoWatch = watchVideoFlow(server.videoStream, () => {
241349
+ this.lastVideoFlowAt = Date.now();
241350
+ }, () => this.ctx.logger.warn("rfc4571: unknown video stream kind — video flow not observed", { tags: {
241351
+ deviceId: this.id,
241352
+ camStreamId
241353
+ } }));
240750
241354
  server.server.once("close", () => {
241355
+ stopVideoWatch();
240751
241356
  if (this.active.get(camStreamId)?.server === server) {
240752
241357
  this.active.delete(camStreamId);
241358
+ this.syncKeepAwake();
240753
241359
  this.ctx.logger.debug("rfc4571: server closed — evicting cache entry", { tags: {
240754
241360
  deviceId: this.id,
240755
241361
  camStreamId
@@ -240804,6 +241410,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240804
241410
  async closeActiveStreams(reason) {
240805
241411
  const entries = [...this.active.values()];
240806
241412
  this.active.clear();
241413
+ this.keepAwake.stop();
240807
241414
  if (entries.length === 0) return;
240808
241415
  this.ctx.logger.debug("Closing active RFC 4571 servers", {
240809
241416
  tags: { deviceId: this.id },
@@ -241487,6 +242094,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
241487
242094
  this.stopWatchdogs();
241488
242095
  const entries = [...this.active.values()];
241489
242096
  this.active.clear();
242097
+ this.keepAwake.stop();
241490
242098
  for (const entry of entries) try {
241491
242099
  await entry.server.close("disconnect-all");
241492
242100
  } catch {}
@@ -243921,6 +244529,21 @@ function buildCreationFormSchema() {
243921
244529
  }
243922
244530
  }
243923
244531
  ]
244532
+ },
244533
+ {
244534
+ id: "events",
244535
+ title: "Events",
244536
+ titleKey: "provider-reolink:creation.s_events.title",
244537
+ columns: 1,
244538
+ fields: [{
244539
+ type: "boolean",
244540
+ key: "autoConfigureEventPush",
244541
+ label: "Auto-configure event push on add",
244542
+ labelKey: "provider-reolink:creation.s_events.autoConfigureEventPush.label",
244543
+ description: "Once, right after the camera is added, set up its local push (webhook or camera mailbox) so motion and AI events reach CamStack.",
244544
+ descriptionKey: "provider-reolink:creation.s_events.autoConfigureEventPush.description",
244545
+ default: true
244546
+ }]
243924
244547
  }
243925
244548
  ] };
243926
244549
  }
@@ -246726,6 +247349,12 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
246726
247349
  const emailBridge = this.ensureEmailBridge();
246727
247350
  device.setEmailPushParamsResolver(() => emailBridge.buildCameraSetupParams(device));
246728
247351
  device.setBaichuanWebhookParamsResolver(() => this.buildWebhookParams(device));
247352
+ device.autoConfigureEventPushOnAdd().catch((err) => {
247353
+ ctx.logger.warn("event-push: auto-configure on add threw", {
247354
+ tags: { deviceId: device.id },
247355
+ meta: { error: err instanceof Error ? err.message : String(err) }
247356
+ });
247357
+ });
246729
247358
  }
246730
247359
  ctx.api?.pipelineOrchestrator?.applyDeviceSettingsPatch?.mutate({
246731
247360
  deviceId: device.id,