@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.mjs CHANGED
@@ -100690,7 +100690,7 @@ function parseBaichuanWebhookObject(mess) {
100690
100690
  return parsed;
100691
100691
  }
100692
100692
  //#endregion
100693
- //#region ../types/dist/event-category-7P4A3bYA.mjs
100693
+ //#region ../types/dist/event-category-BEsBTS72.mjs
100694
100694
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
100695
100695
  EventCategory["SystemBoot"] = "system.boot";
100696
100696
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -101137,6 +101137,14 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101137
101137
  */
101138
101138
  EventCategory["StreamBrokerOnRequestStreamSourceRefresh"] = "stream-broker.onRequestStreamSourceRefresh";
101139
101139
  /**
101140
+ * A broker RE-DIALED its source (every dial after the first). A consumer that
101141
+ * reads the broker over a transport that does not announce the cut — the
101142
+ * recorder's ffmpeg writer — learns here instead of through its idle clock.
101143
+ * Telemetry: a dropped event only means the idle clock recovers it later.
101144
+ * Payload: `{ deviceId, camStreamId, brokerId, reason }`.
101145
+ */
101146
+ EventCategory["StreamBrokerOnSourceRestart"] = "stream-broker.onSourceRestart";
101147
+ /**
101140
101148
  * A camera provider changed a device's stream parameters (codec /
101141
101149
  * resolution / bitrate / a stream added or removed). A LOW-LATENCY NUDGE
101142
101150
  * for the stream-broker's catalog reconcile: it carries NO authoritative
@@ -106813,7 +106821,7 @@ var ZodIssueCode = {
106813
106821
  var ZodFirstPartyTypeKind;
106814
106822
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106815
106823
  //#endregion
106816
- //#region ../types/dist/runtime-capabilities-CK6y0W5U.mjs
106824
+ //#region ../types/dist/runtime-capabilities-CG61dYnO.mjs
106817
106825
  /**
106818
106826
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106819
106827
  * window to float samples (D455).
@@ -111679,6 +111687,15 @@ var CameraStreamSchema = object({
111679
111687
  */
111680
111688
  autoEligible: boolean().optional(),
111681
111689
  /**
111690
+ * The longest continuous session the SOURCE will keep open, in ms, declared by
111691
+ * the provider that knows it (a hub that cuts every child's session on a
111692
+ * timer). Absent = no limit. The broker re-dials a live source a little
111693
+ * BEFORE this elapses, on its own terms and announced to consumers, so the
111694
+ * source's cut never lands mid-recording. Declare slightly under what was
111695
+ * observed.
111696
+ */
111697
+ maxSessionMs: number$1().int().positive().optional(),
111698
+ /**
111682
111699
  * The profile slot the PUBLISHER says this stream is: `low` for a stream
111683
111700
  * whose only sensible role is the low-bandwidth one, `high` for a main
111684
111701
  * stream. Consulted by the broker's automatic ranking
@@ -127374,7 +127391,7 @@ function e(group, en, it, flags = {}) {
127374
127391
  };
127375
127392
  }
127376
127393
  var N = { noise: true };
127377
- 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", {
127394
+ 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", {
127378
127395
  noise: true,
127379
127396
  deprecated: true
127380
127397
  }), EventCategory.PipelineAnalyticsTrackEnded, e("detection", "Track ended", "Traccia terminata", {
@@ -127821,7 +127838,12 @@ var TargetKindTextCapsSchema = object({
127821
127838
  title: boolean(),
127822
127839
  body: boolean()
127823
127840
  });
127824
- _enum([
127841
+ /**
127842
+ * The message fields a rule can author for a target (#483). Derived from a
127843
+ * kind's caps by `deliverableFields` — the ONE reading of the declaration, used
127844
+ * by the dispatcher (drop), the admin rule editor (show) and the viewer.
127845
+ */
127846
+ var NotificationFieldSchema = _enum([
127825
127847
  "title",
127826
127848
  "body",
127827
127849
  "attachments",
@@ -153350,6 +153372,7 @@ function macroOnly(macro) {
153350
153372
  };
153351
153373
  }
153352
153374
  }
153375
+ var FaultCodesSchema = array(string().min(1)).max(64);
153353
153376
  /**
153354
153377
  * Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
153355
153378
  *
@@ -153484,6 +153507,17 @@ var DeviceBecomesLeafSchema = object({
153484
153507
  path: ["value"]
153485
153508
  });
153486
153509
  });
153510
+ /**
153511
+ * A matching fault BECOMES active on a device (`device-fault.ts`): the device's
153512
+ * whole fault list is read, not only its principal code. `codes` empty = any
153513
+ * fault. Fires once per appearance; a fault already raised at start only seeds.
153514
+ */
153515
+ var DeviceFaultRaisedLeafSchema = object({
153516
+ kind: literal("device-fault-raised"),
153517
+ ...eventLeafId,
153518
+ deviceId: number$1().int().nonnegative(),
153519
+ codes: FaultCodesSchema
153520
+ });
153487
153521
  var DeviceEventLeafSchema = object({
153488
153522
  kind: literal("device-event"),
153489
153523
  ...eventLeafId,
@@ -153561,6 +153595,12 @@ var StationaryLeafSchema = object({
153561
153595
  /** `appeared`: it became parked. `departed`: the registry retired it. */
153562
153596
  phase: _enum(["appeared", "departed"])
153563
153597
  });
153598
+ /** "has a fault": a matching fault is active on the device NOW (its whole fault list). `codes` empty = any. */
153599
+ var DeviceFaultIsLeafSchema = object({
153600
+ kind: literal("device-fault-is"),
153601
+ deviceId: number$1().int().nonnegative(),
153602
+ codes: FaultCodesSchema
153603
+ });
153564
153604
  /** "is": one device field compared to one value, NOW. */
153565
153605
  var DeviceIsLeafSchema = object({
153566
153606
  kind: literal("device-is"),
@@ -153683,12 +153723,14 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
153683
153723
  DeviceBecomesLeafSchema,
153684
153724
  DeviceEventLeafSchema,
153685
153725
  DeviceFiredLeafSchema,
153726
+ DeviceFaultRaisedLeafSchema,
153686
153727
  ScheduleLeafSchema,
153687
153728
  ManualLeafSchema,
153688
153729
  IntervalLeafSchema,
153689
153730
  DetectionLeafSchema,
153690
153731
  StationaryLeafSchema,
153691
153732
  DeviceIsLeafSchema,
153733
+ DeviceFaultIsLeafSchema,
153692
153734
  StationaryPresentLeafSchema,
153693
153735
  ExpressionLeafSchema,
153694
153736
  TimeIsLeafSchema,
@@ -153698,6 +153740,7 @@ var EVENT_KINDS = new Set([
153698
153740
  "device-becomes",
153699
153741
  "device-event",
153700
153742
  "device-fired",
153743
+ "device-fault-raised",
153701
153744
  "schedule",
153702
153745
  "manual",
153703
153746
  "interval",
@@ -153779,6 +153822,7 @@ var LEAF_WORDS = {
153779
153822
  "device-becomes": "a device value that becomes",
153780
153823
  "device-event": "a device event",
153781
153824
  "device-fired": "a device firing an event",
153825
+ "device-fault-raised": "a device fault being raised",
153782
153826
  schedule: "a schedule",
153783
153827
  manual: "a manual run",
153784
153828
  interval: "an interval",
@@ -154122,8 +154166,15 @@ function convertLegacyWhen(half) {
154122
154166
  /** The longest one `wait` step lasts. It is cut by a restart of the run and does not survive a hub restart. */
154123
154167
  var WAIT_MAX_SECONDS = 3600;
154124
154168
  var WAIT_TOO_LONG = `a wait is at most one hour (${WAIT_MAX_SECONDS} s)`;
154169
+ /**
154170
+ * Every step kind may be switched off without deleting it: `enabled: false`
154171
+ * skips the step (and, for a block step, its whole subtree), traced `disabled`.
154172
+ * Absent means enabled.
154173
+ */
154174
+ var stepEnabledShape = { enabled: boolean().optional() };
154125
154175
  var AutomationWaitStepSchema = object({
154126
154176
  kind: literal("wait"),
154177
+ ...stepEnabledShape,
154127
154178
  seconds: number$1().min(0).max(WAIT_MAX_SECONDS, WAIT_TOO_LONG)
154128
154179
  });
154129
154180
  /**
@@ -154132,6 +154183,7 @@ var AutomationWaitStepSchema = object({
154132
154183
  */
154133
154184
  var AutomationCommandStepBaseSchema = object({
154134
154185
  kind: literal("command"),
154186
+ ...stepEnabledShape,
154135
154187
  /** WHO the step acts on. */
154136
154188
  target: ActionTargetSchema,
154137
154189
  /** The vocabulary action this step performs (`cover.open`). */
@@ -154207,6 +154259,7 @@ var AutomationGuardedCommandStepSchema = AutomationCommandStepBaseSchema.extend(
154207
154259
  /** End the run here, on purpose. `reason` may carry `{{vars.x}}` slots. */
154208
154260
  var AutomationStopStepSchema = object({
154209
154261
  kind: literal("stop"),
154262
+ ...stepEnabledShape,
154210
154263
  reason: string().min(1, "a stop needs a reason: it is what the run trace shows").max(200),
154211
154264
  /** `ok`: the run ends as a success. `failed`: it ends as a failure, with the reason. */
154212
154265
  outcome: _enum(["ok", "failed"]),
@@ -154226,6 +154279,7 @@ var RESERVED_RUN_VARS = [
154226
154279
  */
154227
154280
  var AutomationSetStepSchema = object({
154228
154281
  kind: literal("set"),
154282
+ ...stepEnabledShape,
154229
154283
  vars: record(string(), union([
154230
154284
  string().max(500),
154231
154285
  number$1(),
@@ -154234,8 +154288,105 @@ var AutomationSetStepSchema = object({
154234
154288
  /** Set only when this reads true; false or unknown leaves the bag as it is. */
154235
154289
  if: AutomationWhenSchema.optional()
154236
154290
  });
154291
+ var NOTIFY_BODY_MAX = 2e3;
154292
+ /**
154293
+ * Send a notification through one notification target (the same targets the
154294
+ * notification centre addresses). Title and body may carry `{{vars.x}}` slots.
154295
+ * Not a device command: a notification target is an instance of the
154296
+ * `notification-output` cap, not a device.
154297
+ */
154298
+ var AutomationNotifyStepSchema = object({
154299
+ kind: literal("notify"),
154300
+ ...stepEnabledShape,
154301
+ /** The notification target (an instance id of `notification-output`). */
154302
+ targetId: string().min(1, "pick the notification target"),
154303
+ title: string().max(200).optional(),
154304
+ body: string().min(1, "a notification needs a message").max(NOTIFY_BODY_MAX),
154305
+ ...continueOnErrorShape
154306
+ });
154307
+ var HTTP_URL_MAX = 2e3;
154308
+ var HTTP_BODY_MAX = 16384;
154309
+ var HTTP_HEADER_VALUE_MAX = 1e3;
154310
+ 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` });
154311
+ var retryUntilSecondsSchema = number$1().int().min(1).max(600, `a retry window is at most 600 s`);
154312
+ /**
154313
+ * Whether a TCP port on a host answers. TCP only: an ICMP echo needs a raw
154314
+ * socket or a `ping` binary with extra privileges, and the hub image ships
154315
+ * neither for its non-root user, so it is not offered.
154316
+ *
154317
+ * Without `expect` the step wants the host REACHABLE. The result
154318
+ * (`{ reachable, rttMs, error }`) goes to the run variable `saveAs`.
154319
+ */
154320
+ var AutomationProbeStepSchema = object({
154321
+ kind: literal("probe"),
154322
+ ...stepEnabledShape,
154323
+ /** A host name or an address; may carry `{{vars.x}}` slots. */
154324
+ host: string().min(1, "a probe needs a host").max(253).regex(/^[^\s/]+$/, "a host has no spaces or slashes"),
154325
+ port: number$1().int().min(1, "a port is 1 to 65535").max(65535, "a port is 1 to 65535"),
154326
+ timeoutSeconds: number$1().int().min(1).max(30),
154327
+ expect: _enum(["reachable", "unreachable"]).optional(),
154328
+ /** Keep probing every {@link REACH_RETRY_INTERVAL_S} s until the expectation holds, for this long. */
154329
+ retryUntilSeconds: retryUntilSecondsSchema.optional(),
154330
+ saveAs: saveAsSchema.optional(),
154331
+ ...continueOnErrorShape
154332
+ }).strict();
154333
+ var HTTP_METHODS = [
154334
+ "GET",
154335
+ "POST",
154336
+ "PUT",
154337
+ "PATCH",
154338
+ "DELETE"
154339
+ ];
154340
+ /**
154341
+ * What an HTTP request must answer for the step to pass: its status, or a field
154342
+ * of the parsed JSON body, compared the way a device field is.
154343
+ */
154344
+ var AutomationHttpExpectSchema = object({
154345
+ on: _enum(["status", "json"]),
154346
+ /** A dotted path into the JSON body (`sysInfo.rawUartRemoteAddress`); needed for `json`. */
154347
+ fieldPath: string().min(1).max(200).optional(),
154348
+ operator: AutomationConditionOperatorSchema,
154349
+ value: union([
154350
+ string(),
154351
+ number$1(),
154352
+ boolean()
154353
+ ])
154354
+ }).strict().refine((expect) => expect.on !== "json" || expect.fieldPath !== void 0, {
154355
+ message: "a JSON expectation names the field it reads",
154356
+ path: ["fieldPath"]
154357
+ });
154358
+ function isHttpUrl(url) {
154359
+ if (url.includes("{{")) return /^https?:\/\/\S+$/i.test(url);
154360
+ try {
154361
+ const parsed = new URL(url);
154362
+ return parsed.protocol === "http:" || parsed.protocol === "https:";
154363
+ } catch {
154364
+ return false;
154365
+ }
154366
+ }
154367
+ /**
154368
+ * One HTTP request. Without `expect` the step wants a 2xx answer. The result
154369
+ * (`{ status, ok, json, text, error }`) goes to the run variable `saveAs`.
154370
+ * Header values are stored as typed, in plain text: they are in the recipe and
154371
+ * in the generated source, so anyone who can open the automation can read a
154372
+ * token put in one. Header values and bodies are never logged or traced.
154373
+ */
154374
+ var AutomationHttpRequestStepSchema = object({
154375
+ kind: literal("http-request"),
154376
+ ...stepEnabledShape,
154377
+ method: _enum(HTTP_METHODS),
154378
+ url: string().max(HTTP_URL_MAX).refine(isHttpUrl, "the address is an http:// or https:// URL"),
154379
+ 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(),
154380
+ body: string().max(HTTP_BODY_MAX).optional(),
154381
+ timeoutSeconds: number$1().int().min(1).max(60),
154382
+ expect: AutomationHttpExpectSchema.optional(),
154383
+ retryUntilSeconds: retryUntilSecondsSchema.optional(),
154384
+ saveAs: saveAsSchema.optional(),
154385
+ ...continueOnErrorShape
154386
+ }).strict();
154237
154387
  var AutomationRunActionStepSchema = object({
154238
154388
  kind: literal("action"),
154389
+ ...stepEnabledShape,
154239
154390
  /** An entry of the `actions` surface (`internal:<uuid>` or `<addonId>:<localId>`). */
154240
154391
  actionId: string().min(1),
154241
154392
  /** Values for the action's declared variables; the others take their default. */
@@ -154261,6 +154412,7 @@ var WAIT_UNTIL_TIMEOUT_MAX_S = 21600;
154261
154412
  */
154262
154413
  var AutomationWaitUntilStepSchema = object({
154263
154414
  kind: literal("wait-until"),
154415
+ ...stepEnabledShape,
154264
154416
  when: AutomationWhenSchema,
154265
154417
  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)`),
154266
154418
  onTimeout: _enum(["continue", "stop"])
@@ -154286,7 +154438,10 @@ var plainStepSchemas = [
154286
154438
  AutomationCommandStepBaseSchema.extend(continueOnErrorShape).strict().superRefine(refineKnownAction),
154287
154439
  AutomationStopStepSchema.omit({ if: true }).strict(),
154288
154440
  AutomationSetStepSchema.omit({ if: true }).strict(),
154289
- AutomationRunActionStepSchema.strict()
154441
+ AutomationRunActionStepSchema.strict(),
154442
+ AutomationNotifyStepSchema.strict(),
154443
+ AutomationProbeStepSchema,
154444
+ AutomationHttpRequestStepSchema
154290
154445
  ];
154291
154446
  /**
154292
154447
  * A plain step: a flow step with no condition of its own and no step inside
@@ -154294,7 +154449,7 @@ var plainStepSchemas = [
154294
154449
  */
154295
154450
  var AutomationBranchStepSchema = discriminatedUnion("kind", plainStepSchemas, { error: nestTooDeep });
154296
154451
  /** A step that can run beside others: it writes no variable and does not end the run. */
154297
- 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");
154452
+ 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");
154298
154453
  /**
154299
154454
  * Several steps at once (#500): all are started together and all are awaited.
154300
154455
  * A failure fails the run once the others finished, as in a sequence; a member
@@ -154302,6 +154457,7 @@ var AutomationParallelMemberSchema = AutomationBranchStepSchema.refine((step) =>
154302
154457
  */
154303
154458
  var AutomationParallelStepSchema = object({
154304
154459
  kind: literal("parallel"),
154460
+ ...stepEnabledShape,
154305
154461
  steps: array(AutomationParallelMemberSchema).min(2, "a parallel needs at least two steps").max(5, `a parallel takes at most 5 steps`)
154306
154462
  }).strict();
154307
154463
  var REPEAT_NEEDS_MAX = "a repeat on a condition needs a maximum number of iterations";
@@ -154342,6 +154498,7 @@ var AutomationRepeatLoopSchema = discriminatedUnion("by", [
154342
154498
  function repeatSchemaOf(step) {
154343
154499
  return object({
154344
154500
  kind: literal("repeat"),
154501
+ ...stepEnabledShape,
154345
154502
  loop: AutomationRepeatLoopSchema,
154346
154503
  steps: array(step).min(1, "a repeat needs at least one step").max(10, `a repeat takes at most 10 steps`)
154347
154504
  }).strict();
@@ -154357,6 +154514,7 @@ function chooseSchemaOf(step) {
154357
154514
  const steps = array(step).max(10);
154358
154515
  return object({
154359
154516
  kind: literal("choose"),
154517
+ ...stepEnabledShape,
154360
154518
  branches: array(object({
154361
154519
  if: AutomationWhenSchema,
154362
154520
  steps: steps.min(1, "a branch needs at least one step")
@@ -154382,8 +154540,12 @@ var AutomationActionSchema = discriminatedUnion("kind", [
154382
154540
  AutomationParallelStepSchema,
154383
154541
  AutomationRepeatStepSchema,
154384
154542
  AutomationRunActionStepSchema,
154543
+ AutomationNotifyStepSchema,
154544
+ AutomationProbeStepSchema,
154545
+ AutomationHttpRequestStepSchema,
154385
154546
  object({
154386
154547
  kind: literal("code"),
154548
+ ...stepEnabledShape,
154387
154549
  /** Compiled into the automation's OWN block by esbuild — not a third
154388
154550
  * runtime, not a `vm`, and not dynamically evaluated. */
154389
154551
  code: string().min(1).max(2e4)
@@ -154705,6 +154867,7 @@ var AutomationConditionTraceNodeSchema = object({
154705
154867
  "not",
154706
154868
  "condition",
154707
154869
  "device-is",
154870
+ "device-fault-is",
154708
154871
  "expression",
154709
154872
  "stationary-present",
154710
154873
  "time-is",
@@ -154712,6 +154875,7 @@ var AutomationConditionTraceNodeSchema = object({
154712
154875
  "device-becomes",
154713
154876
  "device-event",
154714
154877
  "device-fired",
154878
+ "device-fault-raised",
154715
154879
  "schedule",
154716
154880
  "interval",
154717
154881
  "manual",
@@ -154770,6 +154934,9 @@ var StepTraceBaseSchema = object({
154770
154934
  * (D1021): why a sentence says "—" where a number was expected. Bounded.
154771
154935
  */
154772
154936
  templates: array(string()).max(20).optional(),
154937
+ /** A probe or an HTTP request: how many tries it made, and what the last one saw (no header, no body). */
154938
+ attempts: number$1().int().optional(),
154939
+ lastAttempt: string().optional(),
154773
154940
  /**
154774
154941
  * What the step's own `if` read when the step was reached (#472): `true` the
154775
154942
  * step ran, `false` its `else` ran (or nothing did), `unknown` a state leaf
@@ -159383,6 +159550,8 @@ method(object({
159383
159550
  /** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
159384
159551
  profileHint: CamProfileSchema.optional(),
159385
159552
  metadata: record(string(), unknown()).optional(),
159553
+ /** The longest session the source keeps open (ms) — see `CameraStreamSchema.maxSessionMs`. */
159554
+ maxSessionMs: number$1().int().positive().optional(),
159386
159555
  /** Required when kind === 'derived' — the source camStreamId the
159387
159556
  * derived broker reads its encoded plane from.
159388
159557
  * The runtime guard (broker manager, Task 10) enforces presence for
@@ -159601,6 +159770,11 @@ method(object({
159601
159770
  deviceId: number$1().int().nonnegative(),
159602
159771
  camStreamId: string(),
159603
159772
  brokerId: string()
159773
+ })), event(object({
159774
+ deviceId: number$1().int().nonnegative(),
159775
+ camStreamId: string(),
159776
+ brokerId: string(),
159777
+ reason: string()
159604
159778
  })), NOT_A_DEVICE.PIPELINE;
159605
159779
  var StreamCodecSchema = _enum([
159606
159780
  "h264",
@@ -167481,9 +167655,10 @@ object({
167481
167655
  /** Longest silence a push integration may keep before the core re-reads it and asks it to resubscribe. */
167482
167656
  heartbeatMs: number$1().int().positive().optional(),
167483
167657
  /**
167484
- * Bumped by the provider each time its push subscription reconnected on its
167485
- * own. A change makes the core re-read every device of the integration
167486
- * (pushes lost while it was down; events may be dropped, D8).
167658
+ * Changes on every reconnect of the provider's push subscription; any change
167659
+ * makes the core read every device of the integration once (pushes lost while
167660
+ * it was down; events may be dropped, D8). It need not grow: a provider whose
167661
+ * counter restarts with its process is still understood.
167487
167662
  */
167488
167663
  connectionEpoch: number$1().int().nonnegative().optional()
167489
167664
  });
@@ -169143,6 +169318,15 @@ var DeviceFaultSchema = object({
169143
169318
  label: string(),
169144
169319
  severity: DeviceErrorSeveritySchema
169145
169320
  });
169321
+ /** One kind of fault a device CAN raise: the integration's own declared catalog entry. */
169322
+ var DeviceFaultTypeSchema = DeviceFaultSchema;
169323
+ /**
169324
+ * The fault catalog of a device, declared by its integration at runtime (never a
169325
+ * code enum). A fault outside the catalog is still published and still matches
169326
+ * a rule that names no code.
169327
+ */
169328
+ var ListFaultTypesInputSchema = object({ deviceId: number$1().int().nonnegative() });
169329
+ var FaultTypesSchema = object({ types: array(DeviceFaultTypeSchema) });
169146
169330
  /**
169147
169331
  * The fault a device reports right now. One slice per device.
169148
169332
  *
@@ -169180,7 +169364,12 @@ var errorCapability = {
169180
169364
  scope: "device",
169181
169365
  deviceNative: true,
169182
169366
  mode: "singleton",
169183
- methods: {},
169367
+ methods: {
169368
+ /** The fault codes this device's integration can raise; `[]` when it declares none. */
169369
+ listFaultTypes: method(ListFaultTypesInputSchema, FaultTypesSchema, {
169370
+ kind: "query",
169371
+ auth: "protected"
169372
+ }) },
169184
169373
  status: {
169185
169374
  schema: ErrorStatusSchema,
169186
169375
  kind: "push",
@@ -184149,6 +184338,13 @@ var NcSystemEventConditionSchema = object({
184149
184338
  * pick from. The hub refuses an id the action index does not know.
184150
184339
  */
184151
184340
  commandActions: array(string().min(1)).min(1).optional(),
184341
+ /**
184342
+ * `device-attention-*` only: the fault CODES this rule speaks about (the
184343
+ * integration declares them through `error.listFaultTypes`; free text is
184344
+ * accepted too). Absent or empty = any fault. The rule matches when any
184345
+ * fault of the episode is in the list.
184346
+ */
184347
+ faultCodes: array(string().min(1)).optional(),
184152
184348
  /** `device-command` only: how the command settled. A device's own change is not a command. */
184153
184349
  commandOutcomes: array(_enum([
184154
184350
  "confirmed",
@@ -185166,6 +185362,15 @@ var NcRuleInputSchema = object({
185166
185362
  */
185167
185363
  askVerdict: boolean().optional(),
185168
185364
  /**
185365
+ * An ALERT notification (`alert-critical`, `alert-error`, device attention)
185366
+ * carries the alert's own action — an open-URL button and, for an `invoke`
185367
+ * action, a token-authed button that runs it. Absent and `true` mean ON;
185368
+ * `false` switches it off for this rule. `.optional()`, never `.default()`
185369
+ * (a Zod default does not run on the addon cap path), so a rule authored
185370
+ * before this field keeps the action.
185371
+ */
185372
+ offerAlertAction: boolean().optional(),
185373
+ /**
185169
185374
  * Operator tags (D1054), kept on the rule like a core block's. Absent = no
185170
185375
  * tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
185171
185376
  * does not name `tags` keeps the stored ones (the store merges), and an
@@ -196074,7 +196279,16 @@ var CamStreamDescriptorSchema = object({
196074
196279
  /** The slot the publisher says this stream IS — see `CameraStreamSchema.profileHint`. */
196075
196280
  profileHint: CamProfileSchema.optional(),
196076
196281
  /** Transport-specific opaque metadata (e.g. rfc4571 SDP). */
196077
- metadata: record(string(), unknown()).optional()
196282
+ metadata: record(string(), unknown()).optional(),
196283
+ /**
196284
+ * The longest continuous session the SOURCE will keep open, in ms, declared by
196285
+ * the provider that knows it (a hub that cuts every child's session on a
196286
+ * timer). Absent = no limit. The broker re-dials a live source a little
196287
+ * BEFORE this elapses, on its own terms and announced to consumers, so the
196288
+ * source's cut never lands mid-recording. Declare slightly under what was
196289
+ * observed.
196290
+ */
196291
+ maxSessionMs: number$1().int().positive().optional()
196078
196292
  });
196079
196293
  /**
196080
196294
  * `stream-catalog` — device-scoped, provider-implemented. The pull counterpart
@@ -202982,6 +203196,20 @@ function deviceErrorEdge(previous, next) {
202982
203196
  function deviceErrorAlertId(deviceId) {
202983
203197
  return `device-error:${String(deviceId)}`;
202984
203198
  }
203199
+ /** Every active fault, the principal first; a status that lists none still names its principal. */
203200
+ function activeFaults(status) {
203201
+ if (status.faults !== void 0 && status.faults.length > 0) return status.faults.map(({ code, label, severity }) => ({
203202
+ code,
203203
+ label,
203204
+ severity
203205
+ }));
203206
+ if (status.code === null) return [];
203207
+ return [{
203208
+ code: status.code,
203209
+ label: status.label ?? status.code,
203210
+ severity: status.severity
203211
+ }];
203212
+ }
202985
203213
  /** The alert that opens an episode. `since` is the fault's own start, else `now`. */
202986
203214
  function buildDeviceErrorAlert(deviceId, deviceName, status, now) {
202987
203215
  const label = status.label ?? status.code ?? "Fault";
@@ -203009,7 +203237,9 @@ function buildDeviceErrorAlert(deviceId, deviceName, status, now) {
203009
203237
  metadata: {
203010
203238
  episodeId: `${alertId}@${String(startedAt)}`,
203011
203239
  code: status.code,
203012
- deviceSeverity: status.severity
203240
+ deviceSeverity: status.severity,
203241
+ label: status.label,
203242
+ faults: activeFaults(status)
203013
203243
  }
203014
203244
  };
203015
203245
  }
@@ -203019,6 +203249,8 @@ var BaseDevice = class {
203019
203249
  type;
203020
203250
  /** True when another process owns the base slices (`options.deviceStatus: 'external'`). */
203021
203251
  statusIsExternal;
203252
+ /** The fault catalog the integration declared; `[]` until it does. */
203253
+ faultTypes = [];
203022
203254
  name;
203023
203255
  parentDeviceId;
203024
203256
  role;
@@ -203356,10 +203588,19 @@ var BaseDevice = class {
203356
203588
  * a restart is compared, not announced again.
203357
203589
  */
203358
203590
  registerErrorCap() {
203359
- this.ctx.registerNativeCap?.(errorCapability, {});
203591
+ this.ctx.registerNativeCap?.(errorCapability, { listFaultTypes: async () => ({ types: [...this.faultTypes] }) });
203360
203592
  if (this.runtimeState.getCapState(errorCapability.name) === void 0) this.setCapSlice(errorCapability, ERROR_STATUS_COLD);
203361
203593
  }
203362
203594
  /**
203595
+ * Declare the fault kinds this device's integration can raise (code, label,
203596
+ * severity), served by `error.listFaultTypes` so a rule's code picker is
203597
+ * offered the integration's own words. The default is `[]`; a fault outside
203598
+ * the catalog is still published. Call it before or after `registerErrorCap`.
203599
+ */
203600
+ declareFaultTypes(types) {
203601
+ this.faultTypes = types.map((type) => ({ ...type }));
203602
+ }
203603
+ /**
203363
203604
  * Publish the device's fault. The slice is written; on an EDGE (a fault
203364
203605
  * starts, or one resolves) an attention episode opens or closes through the
203365
203606
  * alerts cap, which the notification center announces as
@@ -210336,6 +210577,13 @@ Object.freeze({
210336
210577
  access: "view",
210337
210578
  role: "viewer"
210338
210579
  },
210580
+ "error.listFaultTypes": {
210581
+ capName: "error",
210582
+ capScope: "device",
210583
+ addonId: null,
210584
+ access: "view",
210585
+ role: "viewer"
210586
+ },
210339
210587
  "eventEmitter.getStatus": {
210340
210588
  capName: "event-emitter",
210341
210589
  capScope: "device",
@@ -218959,6 +219207,11 @@ Object.freeze({
218959
219207
  form: "single",
218960
219208
  optional: false
218961
219209
  }],
219210
+ "error.listFaultTypes": [{
219211
+ name: "deviceId",
219212
+ form: "single",
219213
+ optional: false
219214
+ }],
218962
219215
  "eventEmitter.getStatus": [{
218963
219216
  name: "deviceId",
218964
219217
  form: "single",
@@ -221291,7 +221544,8 @@ var NC_SYSTEM_EVENT_FILTER_KEYS = [
221291
221544
  "consumableLowPercent",
221292
221545
  "commandActions",
221293
221546
  "commandOutcomes",
221294
- "commandActorKinds"
221547
+ "commandActorKinds",
221548
+ "faultCodes"
221295
221549
  ];
221296
221550
  new Map(Object.entries({
221297
221551
  "device-online": "device-events",
@@ -221662,6 +221916,16 @@ object({
221662
221916
  nodeId: string().optional(),
221663
221917
  /** The alert's own action link (where the operator acts on it), when it has one. */
221664
221918
  actionUrl: string().optional(),
221919
+ /**
221920
+ * The alert's WHOLE action — label, link, navigation and `invoke` — on a
221921
+ * raised episode, so a notification can offer it (an absolute open-URL
221922
+ * button, a token-authed invoke button). `actionUrl` stays for the
221923
+ * `{{actionUrl}}` template variable. Additive: an episode published before
221924
+ * this field has none.
221925
+ */
221926
+ action: AlertActionSchema.optional(),
221927
+ /** A device fault episode: every active fault (`metadata.faults`), principal first. */
221928
+ faults: array(DeviceFaultSchema).optional(),
221665
221929
  at: number$1()
221666
221930
  });
221667
221931
  var RULE_BODY_ONLY = ["body"];
@@ -221946,6 +222210,9 @@ var STATE_SUMMARY_VARS = [
221946
222210
  ([...RULE_TEXT], [...DEVICE_ATTENTION, ...ALERT_EPISODE]),
221947
222211
  ([...RULE_TEXT], [...ALERT_EPISODE]),
221948
222212
  ([...RULE_TEXT], [...DEVICE_ATTENTION, ...ALERT_EPISODE]),
222213
+ ([...RULE_TEXT], [...DEVICE_ATTENTION]),
222214
+ ([...RULE_TEXT], [...DEVICE_ATTENTION]),
222215
+ ([...RULE_TEXT], [...DEVICE_ATTENTION]),
221949
222216
  [...RULE_TEXT],
221950
222217
  [...RULE_TEXT],
221951
222218
  [...RULE_TEXT],
@@ -222723,6 +222990,34 @@ function linkFieldDescriptor(key, target, labels) {
222723
222990
  ...target.kind !== void 0 ? { kind: target.kind } : {}
222724
222991
  };
222725
222992
  }
222993
+ /** When a member receives: always, inside a schedule, or while an alarm panel is in a state. */
222994
+ var GroupMemberWhenSchema = discriminatedUnion("kind", [
222995
+ object({ kind: literal("always") }),
222996
+ object({
222997
+ kind: literal("schedule"),
222998
+ schedule: NcScheduleSchema
222999
+ }),
223000
+ object({
223001
+ kind: literal("alarm"),
223002
+ deviceId: number$1().int().nonnegative(),
223003
+ states: array(AlarmStateSchema).min(1)
223004
+ })
223005
+ ]);
223006
+ object({
223007
+ targetId: string().min(1),
223008
+ enabled: boolean().optional(),
223009
+ when: GroupMemberWhenSchema.optional(),
223010
+ /** Which message fields this member receives. Absent = all of them. */
223011
+ fields: array(NotificationFieldSchema).optional(),
223012
+ /** `{{title}}`, `{{body}}`, `{{priority}}` and any `{{key}}` of the notification's metadata. */
223013
+ templates: object({
223014
+ title: string().optional(),
223015
+ body: string().optional()
223016
+ }).optional(),
223017
+ minPriority: number$1().int().min(1).max(5).optional(),
223018
+ /** At most one delivery per window; a burst becomes one. 0 or absent = no throttle. */
223019
+ throttleSec: number$1().int().nonnegative().optional()
223020
+ });
222726
223021
  //#endregion
222727
223022
  //#region src/clips/clip-prefetch.ts
222728
223023
  /** The longest a device may stay quiet after refusals, whatever its interval. */
@@ -223636,6 +223931,16 @@ var reolinkCameraSchema = object({
223636
223931
  */
223637
223932
  webhookUrlGeneration: number$1().int().optional(),
223638
223933
  /**
223934
+ * "Auto-configure event push on add": right after the camera is added, arm its local event push
223935
+ * (HaCfg webhook for a standalone battery camera, else the camera mailbox). Default on.
223936
+ */
223937
+ autoConfigureEventPush: boolean().optional(),
223938
+ /**
223939
+ * What the one-time add-time run did (`configured:<mechanism>` | `skipped` | `failed`). Present
223940
+ * means the run happened: a restart never writes the camera again.
223941
+ */
223942
+ eventPushAutoConfigured: string().optional(),
223943
+ /**
223639
223944
  * On-camera motion detection master switch + sensitivity.
223640
223945
  * Pushed via `setMotionAlarm` (cmdId=47). The Reolink mobile
223641
223946
  * app + camera web UI use 1..50 (1 = least sensitive,
@@ -229449,6 +229754,8 @@ var BATTERY_REFRESH_MINUTES_KEY = "batteryRefreshMinutes";
229449
229754
  var BATTERY_REFRESH_TICK_MS = 6e4;
229450
229755
  /** The least time between two attempts in one window. */
229451
229756
  var RETRY_BACKOFF_MS = 10 * 6e4;
229757
+ /** The one refresh step whose failure does not hold the window open. */
229758
+ var SOFT_FAILURE_STEP = "snapshot";
229452
229759
  var MAX_WAKE_LEAD_MS = 5 * 6e4;
229453
229760
  var STAGGER_SLOTS = 60;
229454
229761
  /** The operator's window in ms, or `0` for off. Out-of-range values clamp. */
@@ -229579,7 +229886,15 @@ var BatteryHourlyRefresh = class {
229579
229886
  }
229580
229887
  });
229581
229888
  const outcome = await this.deps.refreshAll();
229582
- if (outcome.failed.length > 0) {
229889
+ const hardFailures = outcome.failed.filter((step) => step !== SOFT_FAILURE_STEP);
229890
+ if (hardFailures.length === 0 && outcome.failed.length > 0) logger.warn("battery hourly refresh: snapshot did not move — window stamped, not retried", {
229891
+ tags: { deviceId },
229892
+ meta: {
229893
+ failed: outcome.failed,
229894
+ attempt: this.attempts
229895
+ }
229896
+ });
229897
+ if (hardFailures.length > 0) {
229583
229898
  logger.warn("battery hourly refresh incomplete — not stamped, retried at the next chance", {
229584
229899
  tags: { deviceId },
229585
229900
  meta: {
@@ -231781,6 +232096,22 @@ var SLEEP_HYSTERESIS_MS = 5e3;
231781
232096
  * exactly its recovery role.
231782
232097
  */
231783
232098
  var HUB_SUMMARY_SLEEP_GRACE_MS = 18e4;
232099
+ /**
232100
+ * How recent the last video packet must be for the stream to count as
232101
+ * flowing. A camera that is delivering video is awake, whatever a second-hand
232102
+ * claim says: a Home Hub child on DC power was marked sleeping every 28 min
232103
+ * (and by the lagging hub summary) while its RTP was running, which froze the
232104
+ * snapshot tile on "sleeping".
232105
+ */
232106
+ var VIDEO_FLOW_FRESH_MS = 5e3;
232107
+ /**
232108
+ * A source that is not the camera's own reading of itself: the parent's
232109
+ * summaries, and a pushed `simple-event` (the Home Hub's session cut arrives
232110
+ * as one).
232111
+ */
232112
+ function isSecondHand(source) {
232113
+ return source === "hub-summary" || source === "hub-reconcile" || source === "simple-event";
232114
+ }
231784
232115
  /** A source whose verdict comes from the parent NVR's channel summary. */
231785
232116
  function isSummarySourced(source) {
231786
232117
  return source === "hub-summary" || source === "hub-reconcile";
@@ -231801,8 +232132,23 @@ function isSummarySourced(source) {
231801
232132
  * observation inside the grace says otherwise.
231802
232133
  */
231803
232134
  function decideSleepCommit(input) {
231804
- const { current, next, source, lastFirstHandCommitAt, nowMs } = input;
232135
+ const { current, next, source, lastFirstHandCommitAt, nowMs, videoFlowing, wired } = input;
231805
232136
  if (current === next) return { kind: "unchanged" };
232137
+ if (next === true && isSecondHand(source)) {
232138
+ const sinceMs = nowMs - lastFirstHandCommitAt;
232139
+ if (wired) return {
232140
+ kind: "refused",
232141
+ reason: "wired",
232142
+ windowMs: 0,
232143
+ sinceLastChangeMs: sinceMs
232144
+ };
232145
+ if (videoFlowing) return {
232146
+ kind: "refused",
232147
+ reason: "video-flowing",
232148
+ windowMs: VIDEO_FLOW_FRESH_MS,
232149
+ sinceLastChangeMs: sinceMs
232150
+ };
232151
+ }
231806
232152
  const summarySourced = isSummarySourced(source);
231807
232153
  const firstHandWake = source === "confirmed-wake" && next === false;
231808
232154
  const sinceLastChangeMs = nowMs - lastFirstHandCommitAt;
@@ -231827,6 +232173,58 @@ function decideSleepCommit(input) {
231827
232173
  };
231828
232174
  }
231829
232175
  //#endregion
232176
+ //#region src/session-limit.ts
232177
+ /**
232178
+ * How long the broker lets a Home Hub child's session run before it re-dials on
232179
+ * its own terms.
232180
+ *
232181
+ * Observed 2026-11-20 on two DC-powered children of one Home Hub: the hub cut
232182
+ * BOTH sessions at the same second, every 28 min 07 s (16:16:36, then 16:44:43),
232183
+ * which is a hub session limit, not the camera. Declared a minute under that so
232184
+ * the planned re-dial always wins the race against the hub's cut and the
232185
+ * recording rolls over at a time of our choosing.
232186
+ */
232187
+ var HOME_HUB_SESSION_LIMIT_MS = 27 * 6e4;
232188
+ /**
232189
+ * Stamp the descriptors with the session limit the broker acts on. Only a
232190
+ * battery child of a hub gets one: a standalone camera has no such cut, and
232191
+ * declaring one there would re-dial a healthy stream for nothing.
232192
+ */
232193
+ function withSessionLimit(descriptors, input) {
232194
+ if (!input.isHubChild || !input.isBattery) return [...descriptors];
232195
+ return descriptors.map((d) => ({
232196
+ ...d,
232197
+ maxSessionMs: HOME_HUB_SESSION_LIMIT_MS
232198
+ }));
232199
+ }
232200
+ //#endregion
232201
+ //#region src/video-flow.ts
232202
+ /**
232203
+ * Report every video packet a stream server produces. The three stream kinds
232204
+ * the server can sit on name the same event differently (`videoFrame` for the
232205
+ * native and composite streams, `videoAccessUnit` for the always-on one), so
232206
+ * the kind is narrowed by class, not asserted.
232207
+ *
232208
+ * Returns the unsubscribe. A stream kind this does not know is reported
232209
+ * through `onUnknown` and never watched — silence would read as "no video".
232210
+ */
232211
+ function watchVideoFlow(stream, onFlow, onUnknown) {
232212
+ if (stream instanceof BaichuanVideoStream || stream instanceof CompositeStream) {
232213
+ stream.on("videoFrame", onFlow);
232214
+ return () => {
232215
+ stream.off("videoFrame", onFlow);
232216
+ };
232217
+ }
232218
+ if (stream instanceof ContinuousVideoStream) {
232219
+ stream.on("videoAccessUnit", onFlow);
232220
+ return () => {
232221
+ stream.off("videoAccessUnit", onFlow);
232222
+ };
232223
+ }
232224
+ onUnknown();
232225
+ return () => {};
232226
+ }
232227
+ //#endregion
231830
232228
  //#region src/snapshot-wake-gate.ts
231831
232229
  /**
231832
232230
  * Decide whether a snapshot read may reach the camera's socket.
@@ -231850,6 +232248,74 @@ function decideSnapshotCameraAccess(input) {
231850
232248
  };
231851
232249
  }
231852
232250
  //#endregion
232251
+ //#region src/event-push-on-add.ts
232252
+ function reasonOf(err) {
232253
+ return err instanceof Error ? err.message : String(err);
232254
+ }
232255
+ async function decide(ports) {
232256
+ if (!ports.enabled()) return {
232257
+ status: "skipped",
232258
+ reason: "auto-configure event push on add is switched off"
232259
+ };
232260
+ if (!ports.isEligible()) return {
232261
+ status: "skipped",
232262
+ reason: "hub-attached camera: the hub owns its event push, no email or webhook is written"
232263
+ };
232264
+ const method = ports.method();
232265
+ const webhookPossible = ports.isBattery() && method !== "email";
232266
+ const failures = [];
232267
+ if (webhookPossible) try {
232268
+ await ports.configureWebhook();
232269
+ return {
232270
+ status: "configured",
232271
+ mechanism: "webhook"
232272
+ };
232273
+ } catch (err) {
232274
+ failures.push(`webhook: ${reasonOf(err)}`);
232275
+ if (method === "webhook") return {
232276
+ status: "failed",
232277
+ reason: failures.join("; ")
232278
+ };
232279
+ }
232280
+ else if (method === "webhook") return {
232281
+ status: "skipped",
232282
+ reason: "the webhook needs a standalone battery camera and this one is not"
232283
+ };
232284
+ try {
232285
+ await ports.configureEmail();
232286
+ return {
232287
+ status: "configured",
232288
+ mechanism: "email"
232289
+ };
232290
+ } catch (err) {
232291
+ failures.push(`email: ${reasonOf(err)}`);
232292
+ return {
232293
+ status: "failed",
232294
+ reason: failures.join("; ")
232295
+ };
232296
+ }
232297
+ }
232298
+ /**
232299
+ * Arm a camera's local event push ONCE, right after it is added. A failure is an outcome, never
232300
+ * a throw: it must not block the add. The outcome is logged and recorded, and a recorded camera
232301
+ * is never written again. Battery cameras prefer the webhook (it works while asleep) and fall back
232302
+ * to the camera mailbox; only one path is armed, so events are not delivered twice.
232303
+ */
232304
+ async function autoConfigureEventPushOnce(ports) {
232305
+ if (ports.recordedOutcome() !== void 0) return "already-ran";
232306
+ const outcome = await decide(ports);
232307
+ ports.log(outcome);
232308
+ try {
232309
+ await ports.record(outcome);
232310
+ } catch (err) {
232311
+ ports.log({
232312
+ status: "failed",
232313
+ reason: `could not record the run: ${reasonOf(err)}`
232314
+ });
232315
+ }
232316
+ return outcome;
232317
+ }
232318
+ //#endregion
231853
232319
  //#region src/webhook-generation.ts
231854
232320
  /**
231855
232321
  * Point a battery camera's webhook at the data-plane URL ONCE per URL generation.
@@ -234562,6 +235028,7 @@ function buildPowerSourceSettingsSection(input) {
234562
235028
  label: "Power source",
234563
235029
  labelKey: "provider-reolink:schema.s_power-source.powerSource.label",
234564
235030
  default: source,
235031
+ required: true,
234565
235032
  options: [{
234566
235033
  value: "adapter",
234567
235034
  label: "Wired power",
@@ -234587,6 +235054,58 @@ async function applyPowerSourceSetting(target, value) {
234587
235054
  if (!outcome.applied) throw new Error(`The camera did not take the power source switch (it reports ${outcome.after})`);
234588
235055
  }
234589
235056
  //#endregion
235057
+ //#region src/keep-awake-loop.ts
235058
+ /**
235059
+ * Stream-scoped keep-awake for a battery camera. While at least one stream
235060
+ * consumer is attached, a periodic wake keeps the firmware from entering
235061
+ * standby (which would stop the video). One timer per camera; started when the
235062
+ * first consumer attaches, stopped when the last one leaves.
235063
+ *
235064
+ * Pure: the timer and the wake call are injected so the loop is testable.
235065
+ */
235066
+ var KEEP_AWAKE_INTERVAL_MS = 2e4;
235067
+ function createKeepAwakeLoop(deps) {
235068
+ let handle = null;
235069
+ let failing = false;
235070
+ const tick = () => {
235071
+ deps.wake().then(() => {
235072
+ failing = false;
235073
+ }).catch((err) => {
235074
+ const first = !failing;
235075
+ failing = true;
235076
+ try {
235077
+ deps.onFailure(err, first);
235078
+ } catch {}
235079
+ });
235080
+ };
235081
+ const arm = () => {
235082
+ handle = deps.setTimer(() => {
235083
+ if (handle === null) return;
235084
+ tick();
235085
+ arm();
235086
+ }, deps.intervalMs);
235087
+ };
235088
+ const halt = (activeStreams) => {
235089
+ if (handle === null) return;
235090
+ deps.clearTimer(handle);
235091
+ handle = null;
235092
+ failing = false;
235093
+ deps.onStop(activeStreams);
235094
+ };
235095
+ return {
235096
+ sync: (activeStreams) => {
235097
+ if (!deps.isBattery()) return;
235098
+ if (activeStreams > 0) {
235099
+ if (handle !== null) return;
235100
+ arm();
235101
+ deps.onStart(activeStreams);
235102
+ } else halt(activeStreams);
235103
+ },
235104
+ stop: () => halt(0),
235105
+ running: () => handle !== null
235106
+ };
235107
+ }
235108
+ //#endregion
234590
235109
  //#region src/ptz-zoom.ts
234591
235110
  /**
234592
235111
  * Fraction of total zoom travel moved by ONE press. ~8 presses to cross
@@ -235698,8 +236217,44 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
235698
236217
  nextEventHealthCheckAt = 0;
235699
236218
  /** Active video streams keyed by camStreamId. */
235700
236219
  active = /* @__PURE__ */ new Map();
236220
+ /**
236221
+ * Stream-scoped keep-awake (battery only): while a consumer holds a stream,
236222
+ * a periodic wake stops the firmware from entering standby. Reconciled with
236223
+ * `this.active` through `syncKeepAwake()` after every mutation of the map.
236224
+ */
236225
+ keepAwake = createKeepAwakeLoop({
236226
+ intervalMs: KEEP_AWAKE_INTERVAL_MS,
236227
+ isBattery: () => this.isBattery,
236228
+ wake: async () => {
236229
+ await (await this.ensureApi()).wakeUp(this.getChannel(), {
236230
+ attempts: 1,
236231
+ waitAfterWakeMs: 0
236232
+ });
236233
+ },
236234
+ setTimer: (fn, ms) => setTimeout(fn, ms),
236235
+ clearTimer: (h) => clearTimeout(h),
236236
+ onStart: (activeStreams) => this.ctx.logger.info("keep-awake: started", {
236237
+ tags: { deviceId: this.id },
236238
+ meta: { activeStreams }
236239
+ }),
236240
+ onStop: (activeStreams) => this.ctx.logger.info("keep-awake: stopped", {
236241
+ tags: { deviceId: this.id },
236242
+ meta: { activeStreams }
236243
+ }),
236244
+ onFailure: (err, first) => {
236245
+ (first ? this.ctx.logger.info.bind(this.ctx.logger) : this.ctx.logger.debug.bind(this.ctx.logger))("keep-awake: wake failed", {
236246
+ tags: { deviceId: this.id },
236247
+ meta: { error: err instanceof Error ? err.message : String(err) }
236248
+ });
236249
+ }
236250
+ });
236251
+ syncKeepAwake() {
236252
+ this.keepAwake.sync(this.active.size);
236253
+ }
235701
236254
  /** Login lock — concurrent demand events must not race the login flow. */
235702
236255
  loginPromise = null;
236256
+ /** Wall-clock ms of the last video packet the stream server produced; 0 = none yet. */
236257
+ lastVideoFlowAt = 0;
235703
236258
  /** True once we've discovered (via getBatteryInfo) that this is a battery cam. */
235704
236259
  isBattery = false;
235705
236260
  /**
@@ -236783,6 +237338,39 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
236783
237338
  });
236784
237339
  }
236785
237340
  /**
237341
+ * Arm this camera's local event push ONCE, right after it is added (the provider's
237342
+ * `onAfterCreate`). Reuses `autoConfigureBaichuanWebhook` / `autoConfigureEmailPush` as they
237343
+ * are; the outcome is logged and recorded, and never throws: it must not block the add.
237344
+ */
237345
+ async autoConfigureEventPushOnAdd() {
237346
+ return await autoConfigureEventPushOnce({
237347
+ enabled: () => this.config.get("autoConfigureEventPush") !== false,
237348
+ recordedOutcome: () => this.config.get("eventPushAutoConfigured"),
237349
+ isEligible: () => this.isEmailPushEligible,
237350
+ isBattery: () => this.isBattery,
237351
+ method: () => this.config.get("batterySleepPushMethod") ?? "auto",
237352
+ configureWebhook: async () => await this.autoConfigureBaichuanWebhook(),
237353
+ configureEmail: async () => await this.autoConfigureEmailPush(),
237354
+ record: async (outcome) => {
237355
+ await this.config.setAll({ eventPushAutoConfigured: outcome.status === "configured" ? `configured:${outcome.mechanism}` : outcome.status });
237356
+ },
237357
+ log: (outcome) => {
237358
+ if (outcome.status === "configured") this.ctx.logger.info("event-push: auto-configured on add", {
237359
+ tags: { deviceId: this.id },
237360
+ meta: { mechanism: outcome.mechanism }
237361
+ });
237362
+ else if (outcome.status === "skipped") this.ctx.logger.info("event-push: auto-configure on add skipped", {
237363
+ tags: { deviceId: this.id },
237364
+ meta: { reason: outcome.reason }
237365
+ });
237366
+ else this.ctx.logger.warn("event-push: auto-configure on add failed", {
237367
+ tags: { deviceId: this.id },
237368
+ meta: { reason: outcome.reason }
237369
+ });
237370
+ }
237371
+ });
237372
+ }
237373
+ /**
236786
237374
  * Move this battery camera's HaCfg webhook to the addon's data-plane URL, once, on the first
236787
237375
  * Baichuan contact after the upgrade (the camera is awake: this costs no wake). Only a camera
236788
237376
  * that is armed is touched; a failure is logged and retried at the next contact.
@@ -237268,17 +237856,20 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
237268
237856
  next,
237269
237857
  source,
237270
237858
  lastFirstHandCommitAt: this.sleepStateChangedAt,
237271
- nowMs: Date.now()
237859
+ nowMs: Date.now(),
237860
+ videoFlowing: Date.now() - this.lastVideoFlowAt < VIDEO_FLOW_FRESH_MS,
237861
+ wired: this.config.get("deviceCache")?.powerSourceSnapshot?.source === "adapter"
237272
237862
  });
237273
237863
  if (decision.kind === "unchanged") return false;
237274
237864
  if (decision.kind === "refused") {
237275
- 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", {
237865
+ (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", {
237276
237866
  tags: { deviceId: this.id },
237277
237867
  meta: {
237278
237868
  next,
237279
237869
  source,
237280
237870
  windowMs: decision.windowMs,
237281
- sinceLastChangeMs: decision.sinceLastChangeMs
237871
+ sinceLastChangeMs: decision.sinceLastChangeMs,
237872
+ reason: decision.reason
237282
237873
  }
237283
237874
  });
237284
237875
  return false;
@@ -240266,7 +240857,10 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240266
240857
  * See `native-sdp-overlay.ts`.
240267
240858
  */
240268
240859
  withLiveNativeSdp(descriptors) {
240269
- return overlayLiveNativeRfc4571Sdp(descriptors, (camStreamId) => {
240860
+ return overlayLiveNativeRfc4571Sdp(withSessionLimit(descriptors, {
240861
+ isHubChild: this.isHubChild(),
240862
+ isBattery: this.isBattery
240863
+ }), (camStreamId) => {
240270
240864
  const server = this.active.get(camStreamId)?.server;
240271
240865
  if (!server?.server?.listening) return null;
240272
240866
  return {
@@ -240568,6 +241162,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240568
241162
  ...entry.fps !== void 0 ? { fps: entry.fps } : {},
240569
241163
  ...entry.codec !== void 0 ? { codec: entry.codec } : {},
240570
241164
  ...entry.metadata ? { metadata: entry.metadata } : {},
241165
+ ...entry.maxSessionMs !== void 0 ? { maxSessionMs: entry.maxSessionMs } : {},
240571
241166
  deviceFeatures: entry.deviceFeatures ?? [...this.features],
240572
241167
  autoEligible: entry.autoEligible ?? true
240573
241168
  });
@@ -240647,6 +241242,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240647
241242
  this.stopBatteryUpdatePolling();
240648
241243
  this.stopAlignAuxPolling();
240649
241244
  this.stopWatchdogs();
241245
+ this.keepAwake.stop();
240650
241246
  this.detachFromHubSession();
240651
241247
  if (this.reconnectTimer) {
240652
241248
  clearTimeout(this.reconnectTimer);
@@ -240692,6 +241288,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240692
241288
  await existing.server.close("recreate");
240693
241289
  } catch {}
240694
241290
  this.active.delete(camStreamId);
241291
+ this.syncKeepAwake();
240695
241292
  }
240696
241293
  let api;
240697
241294
  try {
@@ -240739,9 +241336,18 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240739
241336
  server
240740
241337
  };
240741
241338
  this.active.set(camStreamId, entry);
241339
+ this.syncKeepAwake();
241340
+ const stopVideoWatch = watchVideoFlow(server.videoStream, () => {
241341
+ this.lastVideoFlowAt = Date.now();
241342
+ }, () => this.ctx.logger.warn("rfc4571: unknown video stream kind — video flow not observed", { tags: {
241343
+ deviceId: this.id,
241344
+ camStreamId
241345
+ } }));
240742
241346
  server.server.once("close", () => {
241347
+ stopVideoWatch();
240743
241348
  if (this.active.get(camStreamId)?.server === server) {
240744
241349
  this.active.delete(camStreamId);
241350
+ this.syncKeepAwake();
240745
241351
  this.ctx.logger.debug("rfc4571: server closed — evicting cache entry", { tags: {
240746
241352
  deviceId: this.id,
240747
241353
  camStreamId
@@ -240796,6 +241402,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
240796
241402
  async closeActiveStreams(reason) {
240797
241403
  const entries = [...this.active.values()];
240798
241404
  this.active.clear();
241405
+ this.keepAwake.stop();
240799
241406
  if (entries.length === 0) return;
240800
241407
  this.ctx.logger.debug("Closing active RFC 4571 servers", {
240801
241408
  tags: { deviceId: this.id },
@@ -241479,6 +242086,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
241479
242086
  this.stopWatchdogs();
241480
242087
  const entries = [...this.active.values()];
241481
242088
  this.active.clear();
242089
+ this.keepAwake.stop();
241482
242090
  for (const entry of entries) try {
241483
242091
  await entry.server.close("disconnect-all");
241484
242092
  } catch {}
@@ -243913,6 +244521,21 @@ function buildCreationFormSchema() {
243913
244521
  }
243914
244522
  }
243915
244523
  ]
244524
+ },
244525
+ {
244526
+ id: "events",
244527
+ title: "Events",
244528
+ titleKey: "provider-reolink:creation.s_events.title",
244529
+ columns: 1,
244530
+ fields: [{
244531
+ type: "boolean",
244532
+ key: "autoConfigureEventPush",
244533
+ label: "Auto-configure event push on add",
244534
+ labelKey: "provider-reolink:creation.s_events.autoConfigureEventPush.label",
244535
+ description: "Once, right after the camera is added, set up its local push (webhook or camera mailbox) so motion and AI events reach CamStack.",
244536
+ descriptionKey: "provider-reolink:creation.s_events.autoConfigureEventPush.description",
244537
+ default: true
244538
+ }]
243916
244539
  }
243917
244540
  ] };
243918
244541
  }
@@ -246718,6 +247341,12 @@ var ReolinkProviderAddon = class extends BaseDeviceProvider {
246718
247341
  const emailBridge = this.ensureEmailBridge();
246719
247342
  device.setEmailPushParamsResolver(() => emailBridge.buildCameraSetupParams(device));
246720
247343
  device.setBaichuanWebhookParamsResolver(() => this.buildWebhookParams(device));
247344
+ device.autoConfigureEventPushOnAdd().catch((err) => {
247345
+ ctx.logger.warn("event-push: auto-configure on add threw", {
247346
+ tags: { deviceId: device.id },
247347
+ meta: { error: err instanceof Error ? err.message : String(err) }
247348
+ });
247349
+ });
246721
247350
  }
246722
247351
  ctx.api?.pipelineOrchestrator?.applyDeviceSettingsPatch?.mutate({
246723
247352
  deviceId: device.id,