@camstack/types 1.2.537 → 1.2.539

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/client.js CHANGED
@@ -79,809 +79,6 @@ function buildAlawTable() {
79
79
  }
80
80
  buildUlawTable();
81
81
  buildAlawTable();
82
- //#endregion
83
- //#region src/enums/event-category.ts
84
- var EventCategory = /* @__PURE__ */ function(EventCategory) {
85
- EventCategory["SystemBoot"] = "system.boot";
86
- EventCategory["SystemAddonsReady"] = "system.addons-ready";
87
- EventCategory["SystemRestarting"] = "system.restarting";
88
- /**
89
- * Fired exactly once after the hub finishes booting following a
90
- * restart that was triggered by `RestartCoordinator` (today: framework
91
- * live-update). Payload is the marker that was on disk at boot
92
- * (`PendingRestartMarkerPayload`); admin UI listens for it to display a
93
- * success toast describing what changed.
94
- *
95
- * Spec: docs/superpowers/specs/2026-05-14-framework-live-update-design.md
96
- */
97
- EventCategory["SystemRestartCompleted"] = "system.restart-completed";
98
- /**
99
- * The hub reissued its own TLS certificate at boot (`ensureTlsCert`).
100
- * Emitted only when the material on disk actually changed, so an
101
- * operator who trusted the old certificate by hand is told rather than
102
- * discovering it as a browser error. Payload `TlsCertChangedPayload`.
103
- *
104
- * Rule: docs/decisions/adr-0227-*.md
105
- */
106
- EventCategory["SystemTlsCertChanged"] = "system.tls-cert-changed";
107
- /**
108
- * A newer addon or server-root package version was found by the
109
- * authoritative registry check. Emitted once when any observed
110
- * `latestVersion` changes (or a package/node first appears behind);
111
- * the payload carries the full currently-available list. Repeated
112
- * polling of the same latests is silent.
113
- */
114
- EventCategory["UpdateAvailable"] = "update.available";
115
- /**
116
- * Readiness transition for a capability provider. Every producer emits
117
- * this event on `onInitialize` completion, `onDestroy`, and
118
- * `$node.reconnect`; every consumer that needs to gate on a cross-process
119
- * cap subscribes via the kernel's readiness module (`awaitReady` /
120
- * `onReadyState`) instead of polling. Payload is
121
- * `SystemReadyStatePayload` — see event-bus.ts.
122
- */
123
- EventCategory["SystemReadyState"] = "system.ready-state";
124
- EventCategory["AddonStarted"] = "addon.started";
125
- EventCategory["AddonStopped"] = "addon.stopped";
126
- EventCategory["AddonRestarted"] = "addon.restarted";
127
- EventCategory["AddonUpdated"] = "addon.updated";
128
- EventCategory["AddonInstalled"] = "addon.installed";
129
- EventCategory["AddonUninstalled"] = "addon.uninstalled";
130
- EventCategory["AddonCrashed"] = "addon.crashed";
131
- /**
132
- * A RUNNER the D6 crash circuit-breaker gave up on — terminal.
133
- *
134
- * `AddonCrashed` is the routine, self-healing fact ("it crashed; it is being
135
- * respawned"); this is the one that never resolves itself. Emitted exactly
136
- * once per trip, by `process-service.ts`, carrying the node, the runner, the
137
- * addons it hosted and the crash count that tripped the breaker.
138
- *
139
- * It exists because a runner marked terminally `failed` used to be SILENT:
140
- * on 2026-08-18 the `recorder` runner died of three unhandled ffmpeg spawn
141
- * errors, the breaker stopped respawning it (correctly), `/health` kept
142
- * returning 200, and fleet-wide recording was gone for 3h15 before the
143
- * operator's phone told him. The Notification Center's system-event intake
144
- * consumes this category and maps it to the `addon-crash-loop` kind.
145
- */
146
- EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
147
- /**
148
- * A runner whose addon refused to start with a typed reason (D877) - parked
149
- * in `refused`, never counted by the crash breaker, retried on operator
150
- * action. One event per refusal.
151
- */
152
- EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
153
- /**
154
- * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
155
- * `refused`. In-process telemetry for the boot check (re-evaluate while any
156
- * runner is still pending) and the alert centre (close a recovered runner).
157
- */
158
- EventCategory["ProcessStateChanged"] = "process.state-changed";
159
- /**
160
- * The node's one-shot runner boot check (D877): planned runners against the
161
- * process service, `degraded` when any is failed, refused or missing. The
162
- * alert centre turns it into one critical alert.
163
- */
164
- EventCategory["SystemRunnerCheck"] = "system.runner-check";
165
- /**
166
- * An alert EPISODE opened or closed, emitted by the alert centre for alerts
167
- * of severity `critical` or `error` (`AlertEpisodePayload`). The alert
168
- * centre sends no notification of its own: Notification Center turns this
169
- * into the `alert-critical` / `alert-error` / `alert-critical-resolved`
170
- * system-event kinds, and reconciles from the alerts store because a bus
171
- * event may be dropped (D8, D11).
172
- */
173
- EventCategory["AlertEpisode"] = "alert.episode";
174
- EventCategory["AddonError"] = "addon.error";
175
- EventCategory["AddonPageReady"] = "addon.page-ready";
176
- EventCategory["AddonWidgetReady"] = "addon.widget-ready";
177
- /**
178
- * Addon failed to load (import or initialize). Emitted by the kernel's
179
- * AddonHealthMonitor only AFTER the boot grace period ends — failures
180
- * during the first 5 minutes are silently retried without alerting
181
- * (slow-starting addons must have time to come up). Post-grace, this
182
- * event is emitted exactly once per failure-streak; AlertCenter
183
- * consumes it to create a persistent operator-visible alert.
184
- *
185
- * Payload: `{ packageName, addonId?, error: { message, stack }, retryCount, nextRetryAt }`.
186
- */
187
- EventCategory["AddonLoadFailed"] = "addon.load-failed";
188
- /**
189
- * A keychain value was stored or removed (D787). Carries the ref, its
190
- * owner and the new version — NEVER the value. A process holding the ref
191
- * drops its cached copy and the owning `BaseAddon` re-resolves its config.
192
- * Telemetry (D8): a process that misses it still revalidates by version.
193
- */
194
- EventCategory["KeychainChanged"] = "keychain.changed";
195
- /**
196
- * Addon recovered from a previous failure. Emitted when an addon
197
- * transitions from `failed` back to `healthy` (typically via the
198
- * monitor's auto-retry loop, or after manual `addons.retryLoad`).
199
- * AlertCenter dismisses the corresponding `AddonLoadFailed` alert
200
- * on this event.
201
- */
202
- EventCategory["AddonLoadRecovered"] = "addon.load-recovered";
203
- /**
204
- * An addon is RUNNING although its installed package is below what the
205
- * running server requires (`camstack.requires.addons` of the server, or the
206
- * addon's own `requires.server`). Raised once per streak by the unsupported-
207
- * addon tracker, on the hub and on agents; AlertCenter turns it into one
208
- * operator alert per node and package. The addon is never held back for it.
209
- *
210
- * Payload: `{ packageName, addonId, nodeId, installedVersion, requiredMinimum, serverVersion, unmet }`.
211
- */
212
- EventCategory["AddonUnsupportedVersion"] = "addon.unsupported-version";
213
- /**
214
- * The package of an {@link AddonUnsupportedVersion} alert reached a supported
215
- * version, or is no longer installed on the node. AlertCenter dismisses the matching alert.
216
- *
217
- * Payload: `{ packageName, addonId, nodeId }`.
218
- */
219
- EventCategory["AddonUnsupportedResolved"] = "addon.unsupported-resolved";
220
- /**
221
- * Monitor scheduled the next retry for a failed addon. Transient —
222
- * surfaced to the UI for live-updating the "next retry in Ns"
223
- * countdown on the Addons page row, NOT persisted as an alert.
224
- */
225
- EventCategory["AddonRetryScheduled"] = "addon.retry-scheduled";
226
- /**
227
- * A liveness invariant of this node is false — it has no devices, every
228
- * camera is offline, or a camera that was recording has stopped producing
229
- * segments. Emitted by the `liveness-monitor` builtin, once per fault (the
230
- * `findingId` is stable across ticks), only after its boot grace period.
231
- * AlertCenter raises a persistent operator-visible alert.
232
- *
233
- * It exists because on 2026-08-03 the hub ran four hours with zero devices
234
- * and zero recordings while every surface stayed quiet.
235
- *
236
- * Payload: `{ findingId, severity, title, message, deviceId? }`.
237
- */
238
- EventCategory["SystemLivenessFailed"] = "system.liveness-failed";
239
- /**
240
- * A previously reported liveness fault is true again. AlertCenter dismisses
241
- * the matching `SystemLivenessFailed` alert.
242
- *
243
- * Payload: `{ findingId }`.
244
- */
245
- EventCategory["SystemLivenessRecovered"] = "system.liveness-recovered";
246
- /**
247
- * Monitor is attempting to reload a failed addon NOW. UI uses this
248
- * to show a spinner during the retry attempt. Same transient nature
249
- * as AddonRetryScheduled.
250
- */
251
- EventCategory["AddonRetryAttempting"] = "addon.retry-attempting";
252
- EventCategory["DeviceRegistered"] = "device.registered";
253
- EventCategory["DeviceUnregistered"] = "device.unregistered";
254
- EventCategory["DeviceEnabled"] = "device.enabled";
255
- EventCategory["DeviceDisabled"] = "device.disabled";
256
- EventCategory["DeviceSettingsUpdated"] = "device.settings-updated";
257
- /**
258
- * Emitted when the set of native capability providers bound to a device
259
- * changes — e.g. an addon registers a new native cap via
260
- * `DeviceContext.registerNativeCap`, or all native bindings for a device
261
- * are cleared on removal. Hub consumers re-resolve device-proxy routes
262
- * when this fires.
263
- */
264
- EventCategory["DeviceBindingsChanged"] = "device.bindings-changed";
265
- /**
266
- * Emitted when the operator-organisational meta surface changes
267
- * (`name` / `location` / `disabled`). Payload: `{deviceId, field,
268
- * value}`. Live consumers (UI device list, alert center) react
269
- * without polling. Distinct from `DeviceSettingsUpdated` which
270
- * fires on hardware-config changes (host/port/credentials/etc).
271
- */
272
- EventCategory["DeviceMetaChanged"] = "device.meta-changed";
273
- /**
274
- * Emitted by `BaseDevice.updateSourceInfo()` after a successful patch
275
- * to the device's upstream-system identity / rendering envelope. The
276
- * full new SourceInfo travels in the payload so cross-process listeners
277
- * (UI, export adapters) don't need to re-read the meta blob.
278
- *
279
- * Payload: `{deviceId, sourceInfo}`.
280
- *
281
- * Distinct from `DeviceMetaChanged` which covers the operator-edited
282
- * surface (`name` / `location` / `disabled`). The two share the
283
- * persistence layer (both ride on `device-manager.setMetadata` for
284
- * SourceInfo, or `setName`/`setLocation`/`setDisabled` for the meta
285
- * fields) but consumers care about different subsets.
286
- */
287
- EventCategory["DeviceSourceInfoChanged"] = "device.source-info-changed";
288
- /**
289
- * Emitted by DeviceStreamWiringService after a successful
290
- * `stream-broker.registerDeviceStreams` call. Payload includes
291
- * deviceId — consumers look up the full registered device info via
292
- * `brokerManager.getRegisteredDevice(deviceId)`.
293
- *
294
- * Replaces the legacy `StreamRouterService.onDeviceRegistered` callback.
295
- */
296
- EventCategory["DeviceStreamsRegistered"] = "device.streams-registered";
297
- /**
298
- * Device-level "fully provisioned" signal — the EXPORT trigger. Emitted once
299
- * a device's persisted export-relevant shape (its `DeviceFeature` set) is
300
- * established or changes, carrying `{deviceId, fingerprint, generation}`.
301
- * Export adapters (Alexa / HAP) react to THIS instead of the chatty per-cap
302
- * `DeviceBindingsChanged`, turning a boot's incomplete→complete trickle into
303
- * one clean delta. `fingerprint` is `canonicalDeviceFingerprint(shape)`.
304
- *
305
- * Spec: docs/superpowers/specs/2026-06-01-alexa-hap-export-reconciler-design.md
306
- */
307
- EventCategory["DeviceProvisioned"] = "device.provisioned";
308
- /**
309
- * Fires once when a device's initial feature-probe completes successfully
310
- * (lastProbedAt 0→>0); exported shape is now stable. Telemetry (may be
311
- * dropped) — consumers MUST also gate on the device record's `probed` flag.
312
- */
313
- EventCategory["DeviceReady"] = "device.ready";
314
- EventCategory["IntegrationEnabled"] = "integration.enabled";
315
- EventCategory["IntegrationDisabled"] = "integration.disabled";
316
- EventCategory["IntegrationDeleted"] = "integration.deleted";
317
- /** Emitted when a broker connection's status flips (connected /
318
- * disconnected / error). Carries `{ brokerId, status, error? }`. */
319
- EventCategory["BrokerStatusChanged"] = "broker.status-changed";
320
- /** Emitted for every subscription-matched message routed by a
321
- * broker provider. Carries `{ brokerId, subscriptionId, key, payload }`.
322
- * Consumers filter by `brokerId` + `subscriptionId` in the handler. */
323
- EventCategory["BrokerMessage"] = "broker.message";
324
- EventCategory["ProviderStarted"] = "provider.started";
325
- EventCategory["ProviderStopped"] = "provider.stopped";
326
- EventCategory["ProcessCrashed"] = "process.crashed";
327
- EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
328
- EventCategory["ProcessRestarted"] = "process.restarted";
329
- /**
330
- * The SET of storage locations changed — one was created, edited, enabled,
331
- * disabled or deleted through the location instances or the forced-delete action.
332
- *
333
- * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
334
- * it must also converge on its own periodic path, because a dropped event
335
- * must not leave a node writing to yesterday's disk set forever. It exists
336
- * because there was NO signal at all — an operator who added a second
337
- * recordings disk in the admin UI got nothing, and the recorder kept its
338
- * resolved locations until something else happened to re-resolve them
339
- * (D387). Payload `StorageLocationsChangedPayload`.
340
- */
341
- EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
342
- EventCategory["RecordingStarted"] = "recording.started";
343
- EventCategory["RecordingStopped"] = "recording.stopped";
344
- EventCategory["RecordingError"] = "recording.error";
345
- EventCategory["RecordingHealthDegraded"] = "recording.health.degraded";
346
- /** Recording enabled but no segment finalized for the NC stall window. */
347
- EventCategory["RecordingHealthStalled"] = "recording.health.stalled";
348
- /** Recovery from {@link RecordingHealthStalled}. */
349
- EventCategory["RecordingHealthOk"] = "recording.health.ok";
350
- EventCategory["RecordingStorageCritical"] = "recording.storage.critical";
351
- /** Free space on a storage location crossed the warn bar. */
352
- EventCategory["StorageLocationLow"] = "storage.location.low";
353
- /** Free space at/under the critical bar, or capacity probe failed (`null`). */
354
- EventCategory["StorageLocationCritical"] = "storage.location.critical";
355
- /** Recovery from low/critical on a storage location. */
356
- EventCategory["StorageLocationOk"] = "storage.location.ok";
357
- EventCategory["RecordingSegmentWritten"] = "recording.segment.written";
358
- EventCategory["RecordingPolicyFallback"] = "recording.policy.fallback";
359
- EventCategory["RecordingRetentionCompleted"] = "recording.retention.completed";
360
- /** Export render progress (0–100). Telemetry (D8): a lost tick is a stale
361
- * progress bar the client reconciles via `recordingExport.getExport`. */
362
- EventCategory["RecordingExportProgress"] = "recording.export.progress";
363
- EventCategory["RecordingExportCompleted"] = "recording.export.completed";
364
- EventCategory["RecordingExportFailed"] = "recording.export.failed";
365
- EventCategory["DetectionEvent"] = "detection.event";
366
- EventCategory["SessionTrackNew"] = "session.track.new";
367
- EventCategory["SessionTrackExpired"] = "session.track.expired";
368
- EventCategory["BenchmarkProgress"] = "benchmark.progress";
369
- EventCategory["PlatformProbePhase"] = "platform-probe.phase";
370
- EventCategory["PipelineProgress"] = "pipeline.progress";
371
- /** Per-frame execution trace emitted by the pipeline executor for live observability. */
372
- EventCategory["PipelineTrace"] = "pipeline.trace";
373
- /**
374
- * Raw inference output emitted by `addon-pipeline-runner` after running the
375
- * detection pipeline on a frame. Carries the `FrameResult` (with
376
- * `detections[]`, `width`/`height`, timing debug) — never the frame
377
- * buffer itself. Hub-side consumers (analysis pipeline, class filters,
378
- * notifications) subscribe to this and re-emit `detection.result` after
379
- * post-processing.
380
- */
381
- EventCategory["PipelineInferenceResult"] = "pipeline.inference-result";
382
- /**
383
- * Camera lifecycle event emitted by `addon-pipeline-orchestrator` when it
384
- * assigns or unassigns a camera to/from an agent. Carries no frame data;
385
- * pure observability for UI dashboards and metrics consumers.
386
- */
387
- EventCategory["PipelineCameraAssigned"] = "pipeline.camera-assigned";
388
- EventCategory["PipelineCameraUnassigned"] = "pipeline.camera-unassigned";
389
- /**
390
- * A node the orchestrator would otherwise place cameras on has NO usable
391
- * inference device: the operator enabled one or more accelerators there and
392
- * the live probe reports every one of them unavailable. Emitted once per
393
- * TRANSITION into that state (never per dispatch), and the node is dropped
394
- * from the placement candidate set for as long as it holds.
395
- *
396
- * This exists because the state was previously invisible: agent-a
397
- * absorbed 283k inference errors in a day while still being handed cameras,
398
- * and nothing in the system said so.
399
- *
400
- * A node with no accelerators configured at all is NOT this — its devices
401
- * are `disabled`, not `unavailable`, and the runner's default CPU pool
402
- * serves it exactly as before.
403
- */
404
- EventCategory["PipelineNodeInferenceUnavailable"] = "pipeline.node-inference-unavailable";
405
- /**
406
- * A camera has an OPEN detection session and has produced no detection at
407
- * all for longer than the blind threshold — the camera is being decoded and
408
- * inferred and is returning nothing. Emitted once per transition into blind,
409
- * per camera.
410
- *
411
- * The failure it reports: a 1h43 detection blackout on the entrance camera
412
- * that nobody noticed, because "a camera that detects nothing" and "a quiet
413
- * camera" produce byte-identical silence.
414
- */
415
- EventCategory["PipelineDetectionBlind"] = "pipeline.detection-blind";
416
- /**
417
- * A camera's motion source has fired constantly with no subject for an hour
418
- * (motion duty or session count over the bar, zero detections) — it is not
419
- * blind, its motion zones or sensitivity want tuning (D907). Paired with
420
- * {@link PipelineMotionCalm}.
421
- */
422
- EventCategory["PipelineMotionNoisy"] = "pipeline.motion-noisy";
423
- /** The recovery edge of {@link PipelineMotionNoisy}: the motion fell back, or a detection arrived. */
424
- EventCategory["PipelineMotionCalm"] = "pipeline.motion-calm";
425
- /**
426
- * A camera's package LLM confirm has failed closed three times in a row
427
- * (D931, 2026-10-26). One edge per camera until
428
- * {@link PipelinePackageLlmAnswered}.
429
- */
430
- EventCategory["PipelinePackageLlmSilent"] = "pipeline.package-llm-silent";
431
- /** The recovery edge of {@link PipelinePackageLlmSilent}: a confirm returned yes or no. */
432
- EventCategory["PipelinePackageLlmAnswered"] = "pipeline.package-llm-answered";
433
- /**
434
- * Per-camera pipeline config was mutated by the orchestrator
435
- * (a settings change via `setAgentInferenceDevices` /
436
- * `setCameraStepToggle` / `setCameraStepSettings`). Orchestrator
437
- * subscribes to its own emission to hot-reload the assigned runner
438
- * via `attachCamera` so the next frame executes against the new
439
- * engine/steps without waiting for a rebalance or the next
440
- * `DeviceStreamsRegistered` cycle.
441
- */
442
- EventCategory["PipelineCameraUpdated"] = "pipeline.camera-updated";
443
- /**
444
- * The cluster camera-source OWNER changed (`clusterRoles.ingestNode`).
445
- * Emitted by addon-pipeline-orchestrator whenever it (re)derives node
446
- * capabilities — at boot, on agent online/offline, and on an ingest-node
447
- * flip. Carries the resolved `ownerNodeId`. The stream-broker consumes it to
448
- * keep its ingest-owner-gate decision current WITHOUT a per-`ensureBroker`
449
- * cross-process `getIngestOwner` query (push the authority's decision instead
450
- * of polling it on the hot path). Idempotent state — re-emitted on every
451
- * topology change, so a dropped event self-heals on the next one (plus the
452
- * broker's long backstop reconcile query).
453
- */
454
- EventCategory["PipelineIngestOwnerChanged"] = "pipeline.ingest-owner-changed";
455
- /**
456
- * Periodic snapshot of per-node pipeline-runner load
457
- * (`RunnerLocalLoad`). Emitted ~1Hz by every runner so UI dashboards
458
- * subscribe instead of polling `pipelineRunner.getLocalLoad`.
459
- * `nodeId` carried in the payload + on `event.source.nodeId`.
460
- */
461
- EventCategory["PipelineRunnerLoadSnapshot"] = "pipeline.runner-load-snapshot";
462
- /**
463
- * Periodic snapshot of per-camera pipeline metrics (`CameraMetrics`
464
- * + `deviceId` + `nodeId`). Emitted ~1Hz by every runner for each
465
- * attached camera. UI subscribes to drive overlay phase / fps /
466
- * inference time without polling `getCameraMetrics`.
467
- */
468
- EventCategory["PipelineCameraMetricsSnapshot"] = "pipeline.camera-metrics-snapshot";
469
- /**
470
- * Periodic snapshot of stream-broker per-broker statistics (input
471
- * fps, decoded fps, bitrate, codec). Emitted ~1Hz by every
472
- * stream-broker process for each active broker so the UI can drive
473
- * the Stream / Cluster dashboards without polling
474
- * `streamBroker.listAllProfileSlots` and friends.
475
- */
476
- EventCategory["StreamBrokerMetricsSnapshot"] = "stream-broker.metrics-snapshot";
477
- /**
478
- * Cap event fired by `stream-broker` when a profile slot enters
479
- * "demanded" state — a cam stream has been assigned and at least one
480
- * consumer (RTSP restream, decoded subscriber, WebRTC session, …) is
481
- * present. Camera-provider addons (Reolink Baichuan push, …)
482
- * subscribe to this category to start their underlying transport
483
- * lazily. Payload: `{ deviceId, camStreamId, profile }`.
484
- */
485
- EventCategory["StreamBrokerOnCamStreamDemand"] = "stream-broker.onCamStreamDemand";
486
- /**
487
- * Cap event fired by `stream-broker` when the last consumer leaves a
488
- * previously-demanded cam stream. Providers tear down their
489
- * underlying transport on receipt. Payload: `{ deviceId, camStreamId }`.
490
- */
491
- EventCategory["StreamBrokerOnCamStreamIdle"] = "stream-broker.onCamStreamIdle";
492
- /**
493
- * Cap event fired by `stream-broker` when a broker fails to dial a
494
- * managed-loopback source (today: `pull-rfc4571`) and the publisher
495
- * needs to refresh the cached URL. The lib's TCP server idle-tears-down
496
- * on its own schedule, so a re-publish with a fresh `host:port` is the
497
- * only way to keep the broker dialable. Camera providers (Reolink
498
- * Baichuan native, …) subscribe and respond by re-running their publish
499
- * pipeline.
500
- * Payload: `{ deviceId, camStreamId, brokerId }`.
501
- */
502
- EventCategory["StreamBrokerOnRequestStreamSourceRefresh"] = "stream-broker.onRequestStreamSourceRefresh";
503
- /**
504
- * A camera provider changed a device's stream parameters (codec /
505
- * resolution / bitrate / a stream added or removed). A LOW-LATENCY NUDGE
506
- * for the stream-broker's catalog reconcile: it carries NO authoritative
507
- * data — the broker re-PULLS that device's `stream-catalog` cap on receipt
508
- * (the 30s reconcile poll is the backstop if this nudge is dropped). Emitted
509
- * by providers from `stream-params.setProfile`. Payload: `{ deviceId }`.
510
- */
511
- EventCategory["StreamParamsChanged"] = "stream-params.changed";
512
- /**
513
- * Generic per-device runtime-state change. Fired by `device-manager`
514
- * whenever a persisted slice in any cap's `runtimeState` shape
515
- * mutates. Payload: `{deviceId, capName, slice}`. Subscribers are
516
- * the `deviceState` cap router (cross-process listeners) and the
517
- * deviceProxy reactive bindings (`device.state.<capName>.value`).
518
- * Cap-specific events (`battery.onStatusChanged`, …) still fire
519
- * — they're authoritative for callers that want a typed payload
520
- * without filtering on `capName`.
521
- */
522
- EventCategory["DeviceStateChanged"] = "device.state-changed";
523
- /**
524
- * The NATIVE shadow of a cap a composition has claimed fields of moved
525
- * (D663). Payload: `{ deviceId, capName, native }` — what the provider
526
- * wrote, BEFORE the owned fields are overlaid. Owner-only (D224): it is for
527
- * the composer's native self-reads, and the public event routers refuse it
528
- * (`isOwnerOnlyEventCategory`) so no consumer surface ever shows a second
529
- * truth beside the merged `DeviceStateChanged.slice`. Emitted only under a
530
- * `replace` claim, one per native write of that cap.
531
- */
532
- EventCategory["DeviceNativeShadowChanged"] = "device.native-shadow-changed";
533
- /**
534
- * Frame occupancy for a camera CHANGED — a tracked object was gained or
535
- * lost. Carries `{ deviceId, totalObjects, byClass, zones }`.
536
- *
537
- * Emitted only on a change, so a steady scene is silent. It exists so a
538
- * client can stop polling `zoneAnalytics.getCurrentSnapshot`: that was the
539
- * one live badge with no push signal at all, and it cost a request every
540
- * four seconds per visible camera.
541
- *
542
- * Like every event it is telemetry and may be dropped ([D8]) — a consumer
543
- * keeps a slow reconcile rather than trusting it alone.
544
- */
545
- EventCategory["ZoneAnalyticsOccupancyChanged"] = "zone-analytics.occupancy-changed";
546
- /**
547
- * Cap event fired by every device that registers the `battery`
548
- * capability. Mirrors the cap definition's `onStatusChanged`. Carries
549
- * `{ deviceId, status: BatteryStatus }`. Subscribers (alert center,
550
- * snapshot wrapper, UI) react to charge/sleep transitions without
551
- * polling `batteryCapability.getStatus`.
552
- */
553
- EventCategory["BatteryOnStatusChanged"] = "battery.onStatusChanged";
554
- /**
555
- * Cap event fired by every device that registers the `network-link`
556
- * capability. Mirrors the cap definition's `onStatusChanged`. Carries
557
- * `{ deviceId, status: NetworkLinkStatus }` — a link switch or a signal
558
- * reading that moved.
559
- */
560
- EventCategory["NetworkLinkOnStatusChanged"] = "network-link.onStatusChanged";
561
- /**
562
- * Emitted by the battery cap provider WHEN `wakeForStream` enters the
563
- * "wake in progress" window — between the Baichuan wake-up issue and
564
- * the camera's first dialed-back RTP packet. The stream-broker
565
- * manager subscribes to flip the per-broker placeholder reason to
566
- * `'waking'` so viewers see a labelled "WAKING UP" tile instead of
567
- * the generic `'reconnecting'` frame. Carries `{ deviceId }`. The
568
- * complementary "wake complete" signal is the existing
569
- * `BatteryOnStatusChanged { sleeping: false }` event.
570
- */
571
- EventCategory["BatteryOnWakeStarted"] = "battery.onWakeStarted";
572
- /**
573
- * Cap event fired by every device that registers the `doorbell`
574
- * capability. Mirrors `doorbellCapability.events.onPressed`. Carries
575
- * `{ deviceId, timestamp }`. Operators consuming the UI subscribe
576
- * here to render transient ring toasts and a "Recent presses" row
577
- * on the device detail page.
578
- */
579
- EventCategory["DoorbellOnPressed"] = "doorbell.onPressed";
580
- /** Mirrors `runningStateCapability.events.onStarted`. */
581
- EventCategory["RunningStarted"] = "running.started";
582
- /** Mirrors `runningStateCapability.events.onFinished`. */
583
- EventCategory["RunningFinished"] = "running.finished";
584
- /** Mirrors `deviceRunsCapability.events.onRunOpened` - a durable run record opened. */
585
- EventCategory["DeviceRunOpened"] = "device-run.opened";
586
- /** Mirrors `deviceRunsCapability.events.onRunClosed` - a durable run record closed. */
587
- EventCategory["DeviceRunClosed"] = "device-run.closed";
588
- /**
589
- * Cap event fired by every device that registers the `event-emitter`
590
- * capability. Mirrors `eventEmitterCapability.events.onEvent`. Carries
591
- * `{ deviceId, eventType, data, timestamp, seq }` — the device's EXACT
592
- * declared event verbatim (NO normalization). Subscribers (UI event
593
- * stream, advanced-notifier rules) react to fired events without
594
- * holding a cap reference.
595
- */
596
- EventCategory["EventEmitted"] = "event-emitter.event";
597
- /**
598
- * Periodic snapshot of the per-node detection-pipeline engine
599
- * registry (loaded engines, models resident, in-use cameras, idle
600
- * TTL). Emitted ~0.2Hz (every 5 s) by every detection-pipeline
601
- * process. The Engines tab subscribes to drive its inventory view
602
- * without polling `pipelineExecutor.listLoadedEngines`.
603
- */
604
- EventCategory["PipelineEngineMetricsSnapshot"] = "pipeline.engine-metrics-snapshot";
605
- /**
606
- * Per-node detection-engine runtime-provisioning transition. Emitted by
607
- * the detection-pipeline provider on every state change of its lazy
608
- * engine-provisioning machine (idle → installing → verifying → ready,
609
- * or → failed with a `nextRetryAt`). Payload is the
610
- * `EngineProvisioningState` snapshot; `event.source.nodeId` carries the
611
- * node. The Pipeline page subscribes to drive a live "installing
612
- * OpenVINO… / ready" indicator per node without polling
613
- * `pipelineExecutor.getEngineProvisioning`. Telemetry-grade (D8): the UI
614
- * also reads the cap snapshot on mount / reconnect. Phase 2.
615
- */
616
- EventCategory["PipelineEngineProvisioning"] = "pipeline.engine-provisioning";
617
- /**
618
- * Cluster topology snapshot. Carries the same payload returned by
619
- * `nodes.topology` (every reachable node + addons + processes).
620
- * Emitted by the hub on any agent / addon lifecycle change
621
- * (debounced) plus a periodic safety net. Replaces UI polling on
622
- * `nodes.topology` — admin-ui dashboards subscribe to drive the
623
- * cluster view directly from the event payload.
624
- */
625
- EventCategory["ClusterTopologySnapshot"] = "cluster.topology-snapshot";
626
- /**
627
- * Periodic per-node system metrics snapshot (CPU / memory / GPU /
628
- * disk / network). Emitted ~0.2 Hz by the metrics-provider addon
629
- * for each node. Drives the dashboard SystemStatus / ProcessResources
630
- * widgets without polling `metricsProvider.getCurrent`.
631
- */
632
- EventCategory["MetricsNodeResourcesSnapshot"] = "metrics.node-resources-snapshot";
633
- /**
634
- * Periodic per-node process-tree snapshot (camstack-related pids
635
- * with root / managed / system classification). Emitted ~0.2 Hz by
636
- * the metrics-provider addon. Drives the Cluster → Processes tab
637
- * without polling `metricsProvider.listNodeProcesses`.
638
- */
639
- EventCategory["MetricsNodeProcessesSnapshot"] = "metrics.node-processes-snapshot";
640
- /**
641
- * Capability binding change event emitted by `addon-pipeline-orchestrator`
642
- * when a user changes which addon implements a cap on a node. Subscribed
643
- * by every kernel process to update its local `preferredProviderRegistry`
644
- * so future capability lookups respect the new binding.
645
- */
646
- /**
647
- * A capability binding was changed for a node — addon X now provides
648
- * capability `cap` on node `nodeId`. Lives under the generic
649
- * `capability.*` namespace because capability bindings are a kernel-
650
- * level concept used by many addons, not strictly pipeline-scoped.
651
- */
652
- EventCategory["CapabilityBindingChanged"] = "capability.binding-changed";
653
- EventCategory["ModelDownloadProgress"] = "model.download.progress";
654
- EventCategory["AgentRegistered"] = "agent.registered";
655
- EventCategory["AgentUnregistered"] = "agent.unregistered";
656
- EventCategory["AgentOnline"] = "agent.online";
657
- EventCategory["AgentOffline"] = "agent.offline";
658
- /** Forked worker process (e.g. hub/pipeline) connected to the broker. */
659
- EventCategory["WorkerOnline"] = "worker.online";
660
- /** Forked worker process disconnected from the broker. */
661
- EventCategory["WorkerOffline"] = "worker.offline";
662
- EventCategory["AgentTaskDispatched"] = "agent.task.dispatched";
663
- EventCategory["AgentTaskAssigned"] = "agent.task.assigned";
664
- EventCategory["AgentTrpcConnected"] = "agent.trpc.connected";
665
- EventCategory["AgentWsConnected"] = "agent.ws.connected";
666
- EventCategory["AgentWsDisconnected"] = "agent.ws.disconnected";
667
- EventCategory["AgentBackupActivated"] = "agent.backup.activated";
668
- EventCategory["OrchestrationSettingsUpdated"] = "orchestration.settings-updated";
669
- EventCategory["MotionAnalysis"] = "detection.motion-analysis";
670
- /** All raw motion zones from CCL before minArea filter — for UI debug overlay. */
671
- EventCategory["MotionZonesRaw"] = "detection.motion-zones-raw";
672
- /**
673
- * Per-camera motion phase transition (`watching ↔ active`) emitted
674
- * by the runner. Mirrors the `motion.onMotionChanged` cap event
675
- * surface — payload `MotionOnMotionChangedPayload` carries
676
- * `{deviceId, detected, timestamp, source, regions?}`. Subscribers
677
- * include addons that need to react to motion state without
678
- * polling the runtime-state mirror.
679
- */
680
- EventCategory["MotionOnMotionChanged"] = "motion.on-motion-changed";
681
- EventCategory["DetectionResult"] = "detection.result";
682
- EventCategory["DetectionRaw"] = "detection.raw";
683
- EventCategory["DetectionCameraNative"] = "detection.camera-native";
684
- /**
685
- * Canonical per-chunk live audio pipeline output. Payload is
686
- * `PipelineAudioInferenceResultPayload` carrying a full `AudioResult`
687
- * (level + detections + debug). Lives on the pipeline.* namespace
688
- * alongside `pipeline.inference-result` (video) for symmetry.
689
- */
690
- EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
691
- EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
692
- /**
693
- * A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
694
- * data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
695
- * consumer is the orchestrator's camera-sensors bridge, which re-emits the
696
- * camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
697
- * for a camera with no attached sensor). Providers must not emit
698
- * `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
699
- * keeps it so (camera-grid is a named, deferred exception).
700
- */
701
- EventCategory["ProviderMotion"] = "provider.motion";
702
- EventCategory["ProviderDetection"] = "provider.detection";
703
- EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
704
- EventCategory["EnrichmentSceneStateChanged"] = "enrichment.scene.state-changed";
705
- EventCategory["EnrichmentActivitySummary"] = "enrichment.activity.summary";
706
- /**
707
- * Unified track-lifecycle event: ONE category carrying `phase:
708
- * 'start' | 'update' | 'end'` with a rich, typed
709
- * `PipelineAnalyticsTrackLifecyclePayload`. Supersedes the thin
710
- * `PipelineAnalyticsTrackStarted` / `PipelineAnalyticsTrackEnded`
711
- * pair — a consumer subscribes once and branches on `phase`.
712
- */
713
- EventCategory["PipelineAnalyticsTrackLifecycle"] = "pipeline-analytics.track-lifecycle";
714
- /**
715
- * @deprecated Superseded by {@link PipelineAnalyticsTrackLifecycle}
716
- * (`phase:'start'`). Kept as a soft alias — no known subscribers.
717
- */
718
- EventCategory["PipelineAnalyticsTrackStarted"] = "pipeline-analytics.track-started";
719
- /**
720
- * @deprecated Superseded by {@link PipelineAnalyticsTrackLifecycle}
721
- * (`phase:'end'`). Kept as a soft alias — no known subscribers.
722
- */
723
- EventCategory["PipelineAnalyticsTrackEnded"] = "pipeline-analytics.track-ended";
724
- EventCategory["PipelineAnalyticsDetectionEvent"] = "pipeline-analytics.detection-event";
725
- EventCategory["PipelineAnalyticsFrameTracked"] = "pipeline-analytics.frame-tracked";
726
- /**
727
- * Fired by `addon-post-analysis` when a parked (stationary) object appears
728
- * (a track was promoted to a stationary-registry entry) or departs (the
729
- * object moved / was removed). Telemetry (D8): lossy, drives a UI refresh of
730
- * the dedicated "Stationary" section — never the live event feed. Payload:
731
- * `{ deviceId, entryId, className, phase:'appeared'|'departed', timestamp, observedAt, zones }`.
732
- */
733
- EventCategory["PipelineAnalyticsStationaryChanged"] = "pipeline-analytics.stationary-changed";
734
- /**
735
- * Fired by `addon-post-analysis` when a package-drop is confirmed inside
736
- * a package zone — a newly-appeared stationary object of a package class
737
- * that cleared the class / zone / dwell / size gates. Payload:
738
- * `PipelineAnalyticsPackageDeliveredPayload` carrying `{ deviceId,
739
- * entryId, className, zoneIds, keyFrameMediaId?, bbox, timestamp }`.
740
- * Telemetry (D8): the durable record is the `package-events` store row;
741
- * this bus topic drives notifier rules + live UI. See
742
- * docs/superpowers/specs/2026-07-17-package-zones-design.md §5.1.
743
- */
744
- EventCategory["PipelineAnalyticsPackageDelivered"] = "pipeline-analytics.package-delivered";
745
- /**
746
- * Fired by `addon-post-analysis` when a previously-delivered package
747
- * leaves its zone (the stationary entry departed — moved or swept).
748
- * Payload: `PipelineAnalyticsPackagePickedUpPayload` carrying
749
- * `{ deviceId, entryId, deliveredEventId, className, timestamp }`.
750
- * Telemetry (D8). See package-zones-design §5.2.
751
- */
752
- EventCategory["PipelineAnalyticsPackagePickedUp"] = "pipeline-analytics.package-picked-up";
753
- /**
754
- * Fired by `addon-post-analysis` whenever a gallery face row changes:
755
- * `kind:'buffered'` a new detected face was persisted, `'assigned'` /
756
- * `'unassigned'` its identity link changed, `'deleted'` the row was
757
- * removed. Telemetry semantics (D8): a lost event only delays a refresh,
758
- * never a correctness issue. Payload `PipelineAnalyticsFaceGalleryChangedPayload`.
759
- */
760
- EventCategory["PipelineAnalyticsFaceGalleryChanged"] = "pipeline-analytics.face-gallery-changed";
761
- /**
762
- * Fired by `addon-post-analysis` whenever a gallery plate row changes:
763
- * `kind:'buffered'` a new read was persisted (`PlateRecognizer.onTrackEnd`),
764
- * `'assigned'` / `'unassigned'` its vehicle link changed
765
- * (`PlateGalleryProvider`), `'deleted'` the row was removed. Telemetry
766
- * semantics (D8): a lost event only delays a refresh, never a correctness
767
- * issue. Payload `PipelineAnalyticsPlateGalleryChangedPayload`.
768
- */
769
- EventCategory["PipelineAnalyticsPlateGalleryChanged"] = "pipeline-analytics.plate-gallery-changed";
770
- EventCategory["CameraStreamsProfileSlotsChanged"] = "camera-streams.onProfileSlotsChanged";
771
- /**
772
- * Stream-broker health watchdog. Per-broker (deviceId/profile) emission.
773
- * `stream.offline` fires after STREAM_STALE_TIMEOUT_MS without an encoded
774
- * packet on an active broker. `stream.online` fires on first packet
775
- * after a stale gap (or on initial first packet). Payload includes
776
- * the assigned camStreamId as `profileKey`.
777
- */
778
- EventCategory["StreamOnline"] = "stream.online";
779
- EventCategory["StreamOffline"] = "stream.offline";
780
- EventCategory["NetworkTunnelStarted"] = "network.tunnel.started";
781
- EventCategory["NetworkTunnelStopped"] = "network.tunnel.stopped";
782
- /** Fired by the `local-network` cap when the host's interface set
783
- * changes (new IP from DHCP, VPN connect, docker bridge added). */
784
- EventCategory["LocalNetworkChanged"] = "network.local.changed";
785
- /**
786
- * Fired by a `mesh-network` provider (Tailscale, …) when its
787
- * mesh-reachable host changes (join / leave / MagicDNS or 100.x IP
788
- * change). Lets `local-network` fold the mesh endpoint into its
789
- * connection-endpoint list without a cross-package import. Payload
790
- * carries the preferred host (`host: ''` = no longer reachable),
791
- * the hub port, and the scheme. Telemetry-grade (D8): consumers
792
- * pull-reconcile from the provider's `getStatus` on reconnect. */
793
- EventCategory["MeshNetworkChanged"] = "network.mesh.changed";
794
- EventCategory["BackupCompleted"] = "backup.completed";
795
- /**
796
- * A whole backup RUN finished — every destination attempted, win or lose.
797
- *
798
- * `backup.completed` fires once per DESTINATION, which is the right grain for
799
- * a progress UI and the wrong one for a notification: an operator with three
800
- * destinations would be told three times. And a run where two of three
801
- * destinations succeeded is not a clean success — a single "backup
802
- * completed" that hid the failed one would be a lie, so the count of each is
803
- * carried here and the message says both.
804
- *
805
- * Emitted by the backup orchestrator only after the destination loop, so a
806
- * run that dies during the BUILD phase produces no completion at all.
807
- */
808
- EventCategory["BackupRunCompleted"] = "backup.run-completed";
809
- EventCategory["BackupRestored"] = "backup.restored";
810
- EventCategory["NotificationDispatched"] = "notification.dispatched";
811
- EventCategory["NotificationFailed"] = "notification.failed";
812
- /**
813
- * A notification rule that cannot work (D905): its stored row does not load,
814
- * or it still names a device / delivery target the prune CONFIRMED deleted.
815
- * One edge per rule per distinct set of reasons; never on an unanswered read.
816
- */
817
- EventCategory["NotificationRuleBroken"] = "notification.rule-broken";
818
- /** The clear of {@link NotificationRuleBroken}: the rule loads and names nothing deleted. */
819
- EventCategory["NotificationRuleRepaired"] = "notification.rule-repaired";
820
- /** A migration failed or was blocked; the Alert Center re-reads the ledger. */
821
- EventCategory["MigrationFailed"] = "migration.failed";
822
- /** A migration applied or a failure cleared; the Alert Center re-reads the ledger. */
823
- EventCategory["MigrationApplied"] = "migration.applied";
824
- EventCategory["DeviceUpdated"] = "device.updated";
825
- /**
826
- * Transport-level connectivity. Emitted by the device driver when
827
- * the underlying control socket actually connects / disconnects
828
- * (Baichuan TCP, ONVIF probe response, RTSP DESCRIBE, …) — NOT for
829
- * power-state transitions on a battery camera. For battery wake /
830
- * doze cycles see `DeviceAwake` / `DeviceSleeping`.
831
- */
832
- EventCategory["DeviceOnline"] = "device.online";
833
- /**
834
- * Stream-broker watchdog — emitted when no encoded packet has been
835
- * received for STREAM_STALE_TIMEOUT_MS on an active broker (rtsp or
836
- * push). Paired with DeviceOnline which fires on first packet after
837
- * a stale gap. Payload: DeviceStreamHealthPayload.
838
- */
839
- EventCategory["DeviceOffline"] = "device.offline";
840
- /**
841
- * Battery cam woke up — physical power-state transition reported
842
- * by the device firmware. Distinct from `DeviceOnline` so a UI panel
843
- * watching power state doesn't flap on every UDP socket reconnect.
844
- */
845
- EventCategory["DeviceAwake"] = "device.awake";
846
- /**
847
- * Battery cam went to sleep. See `DeviceAwake`.
848
- */
849
- EventCategory["DeviceSleeping"] = "device.sleeping";
850
- EventCategory["RetentionCleanup"] = "retention.cleanup";
851
- /**
852
- * Legacy bulk-update progress snapshot (payload `BulkUpdateState`). No longer
853
- * emitted — F3 removed the coordinator that produced it; "Update all" now runs
854
- * as one lifecycle engine job (`AddonsJobProgress`/`AddonsJobLog`). Retained
855
- * (with `BulkUpdateState`) only to avoid regenerating the event maps; removed
856
- * in F4 once live bulk progress is re-implemented over the engine events.
857
- */
858
- EventCategory["AddonsBulkUpdateProgress"] = "addons.bulk-update-progress";
859
- EventCategory["AddonsJobProgress"] = "addons.job-progress";
860
- EventCategory["AddonsJobLog"] = "addons.job-log";
861
- /**
862
- * A container's child visibility toggled (hidden/shown). Emitted by the
863
- * `accessories` cap when a child device is hidden or revealed.
864
- * Payload: `{ deviceId, childDeviceId, hidden }`.
865
- */
866
- EventCategory["AccessoriesChildVisibilityChanged"] = "accessories.onChildVisibilityChanged";
867
- /**
868
- * A container's child set changed (children added/removed/reordered).
869
- * Payload: `{ deviceId, childDeviceIds, hiddenChildIds }`.
870
- */
871
- EventCategory["AccessoriesChanged"] = "accessories.onAccessoriesChanged";
872
- /**
873
- * An action run started or ended. Emitted by the `actions` surface.
874
- * Payload: `ActionRunChanged` (`{ actionId, runId, isRunning, outcome?, lastRunAt, lastError }`).
875
- */
876
- EventCategory["ActionsRunChanged"] = "actions.onRunChanged";
877
- /**
878
- * Progress update from a running model conversion job.
879
- * Payload: `{ kind: 'model-convert', phase, sessionId?, pct?, detail? }`.
880
- * Emitted by `addon-model-studio` on the converting node.
881
- */
882
- EventCategory["ModelConvertProgress"] = "model-convert.progress";
883
- return EventCategory;
884
- }({});
885
82
  zod.z.object({
886
83
  field: zod.z.string().min(1),
887
84
  on: zod.z.literal("advance")
@@ -22313,46 +21510,6 @@ zod.z.object({
22313
21510
  description: zod.z.string()
22314
21511
  });
22315
21512
  //#endregion
22316
- //#region src/automation/action-target.ts
22317
- /**
22318
- * WHO an action step acts on (D983) — one target shape for every place that
22319
- * performs an action (automation steps, Action entries, notification
22320
- * sequences, scheduler points):
22321
- *
22322
- * - `devices` — device ids the operator picked, frozen at save time;
22323
- * - `domain` — every device that offers the step's VOCABULARY action,
22324
- * optionally narrowed to one device type and one room, resolved WHEN THE
22325
- * STEP RUNS (a device added later is included). The action always comes
22326
- * from the vocabulary (`cover.open`), never from a raw cap name, so a
22327
- * `domain` target needs an `actionId` (enforced on the step schema);
22328
- * - `var` — a `$var` resolved from the run's scope.
22329
- *
22330
- * {@link ActionTargetResolver} turns a target into device ids. It is pure
22331
- * (a {@link DeviceDirectory} is handed in) so the hub's core-blocks service and
22332
- * a generated automation block share it.
22333
- *
22334
- * A room is the device's `location` label (`DeviceInfo.location`); two labels
22335
- * name the same room when `locationIconKey` agrees (trimmed, lower-cased).
22336
- */
22337
- var ActionTargetSchema = zod.z.discriminatedUnion("kind", [
22338
- zod.z.object({
22339
- kind: zod.z.literal("devices"),
22340
- ids: zod.z.array(zod.z.number().int()).min(1)
22341
- }),
22342
- zod.z.object({
22343
- kind: zod.z.literal("domain"),
22344
- /** Narrow to one kind of device. */
22345
- deviceType: zod.z.enum(DeviceType).optional(),
22346
- /** Narrow to one room: the `location` label devices carry. */
22347
- roomId: zod.z.string().min(1).optional()
22348
- }),
22349
- zod.z.object({
22350
- kind: zod.z.literal("var"),
22351
- name: zod.z.string().min(1)
22352
- })
22353
- ]);
22354
- EventCategory.DeviceRegistered, EventCategory.DeviceUnregistered, EventCategory.DeviceUpdated, EventCategory.DeviceMetaChanged, EventCategory.DeviceBindingsChanged;
22355
- //#endregion
22356
21513
  //#region src/catalogs/sensor-active-state.ts
22357
21514
  /**
22358
21515
  * THE table "which boolean of this device type counts as HIGH", and the
@@ -24228,101 +23385,21 @@ var NcZoneConditionSchema = zod.z.object({
24228
23385
  * membership lists are OR within the list (spec §2.3).
24229
23386
  */
24230
23387
  /**
24231
- * What a rule may actuate.
24232
- *
24233
- * **No hand-maintained allowlist** (operator decision, and the right one — a
24234
- * written list of methods is a third parallel map to keep aligned, and this
24235
- * repo has paid for those). The boundary instead comes from a property the
24236
- * capabilities already carry: an action may target only a **device-scoped**
24237
- * capability method.
24238
- *
24239
- * That is not decoration. A rule can be authored by a NON-ADMIN — personal
24240
- * rules are a supported flow — and the executor runs with the addon's
24241
- * privileges, so an unbounded action is an arbitrary RPC channel with a
24242
- * privilege escalation attached. Restricting to device scope excludes the
24243
- * system caps (`device-manager.removeDevice` and friends) by construction,
24244
- * costs nothing to maintain, and cannot rot: a cap that stops being
24245
- * device-scoped stops being actuatable in the same change.
23388
+ * What a rule or a button runs: an **Action** of the `actions` surface
23389
+ * (`internal:<uuid>` or an addon's), by id, and nothing else (planning#473).
24246
23390
  *
24247
- * The executor enforces it; {@link NcRuleActionSchema} carries the intent.
23391
+ * The notification centre has no step vocabulary of its own. The steps, the
23392
+ * device-scope boundary, the stop-at-first-failure, the throttle
23393
+ * (`minDelaySec`), the variables and the runs ledger all belong to the Action;
23394
+ * an operator edits them in ONE place (the Actions page) and a rule points at
23395
+ * the result. A rule can be authored by a non-admin (personal rules), which is
23396
+ * safe for the same reason: it can only name an Action an admin already wrote.
24248
23397
  */
23398
+ var NcActionIdSchema = zod.z.string().min(1);
23399
+ /** Action ids one hook edge runs, in order. Capped so a slot never becomes a second editor. */
23400
+ var NcHookActionIdsSchema = zod.z.array(NcActionIdSchema).max(4);
24249
23401
  /**
24250
- * One step of a sequence.
24251
- *
24252
- * `wait` is a first-class step rather than a property of the next action: it is
24253
- * what makes a sequence a SEQUENCE and not a list — "unlock, wait 5s, open"
24254
- * cannot be expressed otherwise.
24255
- */
24256
- var NcRuleActionSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
24257
- kind: zod.z.literal("wait"),
24258
- seconds: zod.z.number().min(0).max(300)
24259
- }), zod.z.object({
24260
- kind: zod.z.literal("cap"),
24261
- /**
24262
- * WHO the step acts on (D983) — the only shape that is written. A sequence
24263
- * stored before D983 carries `deviceId`; the sequence store reads it as a
24264
- * `devices` target.
24265
- */
24266
- target: ActionTargetSchema.optional(),
24267
- /** The vocabulary action the step performs; required for a `domain` target. */
24268
- actionId: zod.z.string().min(1).optional(),
24269
- /** @deprecated The pre-D983 single device. Read, never written. */
24270
- deviceId: zod.z.number().int().optional(),
24271
- /** Capability name, e.g. `alarm-panel`. */
24272
- cap: zod.z.string().min(1),
24273
- /** Method on it. The executor refuses a non-device-scoped cap. */
24274
- method: zod.z.string().min(1),
24275
- /** Method arguments, minus `deviceId` (the executor injects it). */
24276
- args: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
24277
- }).refine((step) => step.target !== void 0 || step.deviceId !== void 0, {
24278
- message: "a cap step needs a target",
24279
- path: ["target"]
24280
- }).refine((step) => step.target?.kind !== "domain" || step.actionId !== void 0, {
24281
- message: "a domain target needs the vocabulary action it applies to (actionId)",
24282
- path: ["actionId"]
24283
- })]);
24284
- /**
24285
- * A named, ordered run of steps shared across rules, with its own throttle.
24286
- *
24287
- * Sequences live in the notification centre's sequence store — never inline on
24288
- * a rule. A rule binds to one by id ({@link NcActionBindingSchema}), and a
24289
- * button names one the same way. `minDelaySec` exists because a noisy rule
24290
- * otherwise hammers a physical actuator — the rule's own cooldown governs
24291
- * NOTIFICATIONS, which is a different budget from "how often may this gate
24292
- * actually open". The throttle key is the sequence id, so two rules sharing
24293
- * one sequence share its budget.
24294
- */
24295
- var NcSharedSequenceSchema = zod.z.object({
24296
- id: zod.z.string().min(1),
24297
- name: zod.z.string().min(1).max(120),
24298
- minDelaySec: zod.z.number().int().min(0).max(86400).optional(),
24299
- actions: zod.z.array(NcRuleActionSchema).min(1)
24300
- });
24301
- /** Create / update body — the id is minted by the provider. */
24302
- var NcSharedSequenceInputSchema = zod.z.object({
24303
- name: zod.z.string().min(1).max(120),
24304
- minDelaySec: zod.z.number().int().min(0).max(86400).optional(),
24305
- actions: zod.z.array(NcRuleActionSchema).min(1)
24306
- });
24307
- /**
24308
- * What one hook slot may run: a shared sequence, or a single step authored
24309
- * inline ("Do").
24310
- *
24311
- * A button may ONLY name a sequence — a one-shot Do on a public callback would
24312
- * be a parallel actuation vocabulary with no throttle and no shared authoring
24313
- * surface.
24314
- */
24315
- var NcActionBindingSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
24316
- kind: zod.z.literal("sequence"),
24317
- sequenceId: zod.z.string().min(1)
24318
- }), zod.z.object({
24319
- kind: zod.z.literal("do"),
24320
- action: NcRuleActionSchema
24321
- })]);
24322
- /** Bindings on one hook edge. Cap keeps a slot from becoming a second sequence editor. */
24323
- var NcHookBindingsSchema = zod.z.array(NcActionBindingSchema).max(4);
24324
- /**
24325
- * One button carried by the notification, running a shared sequence on tap.
23402
+ * One button carried by the notification, running an Action on tap.
24326
23403
  *
24327
23404
  * **Read this before adding a button that does something physical.** The tap
24328
23405
  * arrives over a link that travelled through third-party infrastructure — ntfy,
@@ -24337,9 +23414,9 @@ var NcRuleNotificationButtonSchema = zod.z.object({
24337
23414
  /** Stable id — travels in the callback and identifies the button in logs. */
24338
23415
  id: zod.z.string().min(1).max(64),
24339
23416
  label: zod.z.string().min(1).max(40),
24340
- /** Id of a shared sequence. The dispatcher drops a button whose sequence
24341
- * does not exist rather than minting a token for nothing. */
24342
- sequenceId: zod.z.string().min(1),
23417
+ /** The Action the tap runs. The dispatcher drops a button whose Action does
23418
+ * not exist rather than minting a token for nothing. */
23419
+ actionId: NcActionIdSchema,
24343
23420
  icon: NotificationActionIconSchema.optional(),
24344
23421
  destructive: zod.z.boolean().optional()
24345
23422
  });
@@ -24354,25 +23431,19 @@ var NcRuleNotificationButtonSchema = zod.z.object({
24354
23431
  * leave). A delivery with no clear edge never produces this hook.
24355
23432
  */
24356
23433
  var NcRuleActionsSchema = zod.z.object({
24357
- onActivation: NcHookBindingsSchema.optional(),
24358
- onDeactivation: NcHookBindingsSchema.optional(),
23434
+ onActivation: NcHookActionIdsSchema.optional(),
23435
+ onDeactivation: NcHookActionIdsSchema.optional(),
24359
23436
  /** Runs on a positive / raised match. */
24360
- onTrigger: NcHookBindingsSchema.optional(),
23437
+ onTrigger: NcHookActionIdsSchema.optional(),
24361
23438
  /** Runs on a clear / leave match, when the subject carries one. */
24362
- onTriggerOff: NcHookBindingsSchema.optional(),
23439
+ onTriggerOff: NcHookActionIdsSchema.optional(),
24363
23440
  /**
24364
- * Buttons the NOTIFICATION carries, each running one shared sequence when
24365
- * tapped. Deliberately a REFERENCE — a button that could define its own
24366
- * actions would be a parallel actuation vocabulary.
23441
+ * Buttons the NOTIFICATION carries, each running one Action when tapped.
23442
+ * Deliberately a REFERENCE — a button that could define its own steps would
23443
+ * be a parallel actuation vocabulary.
24367
23444
  */
24368
23445
  buttons: zod.z.array(NcRuleNotificationButtonSchema).max(8).optional()
24369
23446
  });
24370
- zod.z.object({
24371
- name: zod.z.string().min(1).max(120),
24372
- enabled: zod.z.boolean(),
24373
- minDelaySec: zod.z.number().int().min(0).max(86400).optional(),
24374
- actions: zod.z.array(NcRuleActionSchema).min(1)
24375
- });
24376
23447
  /**
24377
23448
  * "This rule applies only while `deviceId` is in one of `states`."
24378
23449
  *
@@ -26091,18 +25162,6 @@ method(zod.z.object({}), zod.z.object({ rules: zod.z.array(NcRuleSchema) }), { a
26091
25162
  }), zod.z.object({ success: zod.z.literal(true) }), {
26092
25163
  kind: "mutation",
26093
25164
  auth: "admin"
26094
- }), method(zod.z.object({}), zod.z.object({ sequences: zod.z.array(NcSharedSequenceSchema) }), { auth: "admin" }), method(zod.z.object({ sequenceId: zod.z.string().min(1) }), zod.z.object({ sequence: NcSharedSequenceSchema.nullable() }), { auth: "admin" }), method(zod.z.object({ sequence: NcSharedSequenceInputSchema }), zod.z.object({ sequence: NcSharedSequenceSchema }), {
26095
- kind: "mutation",
26096
- auth: "admin"
26097
- }), method(zod.z.object({
26098
- sequenceId: zod.z.string().min(1),
26099
- sequence: NcSharedSequenceInputSchema
26100
- }), zod.z.object({ sequence: NcSharedSequenceSchema }), {
26101
- kind: "mutation",
26102
- auth: "admin"
26103
- }), method(zod.z.object({ sequenceId: zod.z.string().min(1) }), zod.z.object({ success: zod.z.literal(true) }), {
26104
- kind: "mutation",
26105
- auth: "admin"
26106
25165
  }), method(zod.z.object({}), NcClipRetentionPlanSchema, { auth: "admin" }), method(zod.z.object({}), zod.z.object({ mutedDeviceIds: zod.z.array(zod.z.number().int()).readonly() }), { auth: "admin" }), method(zod.z.object({
26107
25166
  deviceId: zod.z.number().int(),
26108
25167
  muted: zod.z.boolean()
@@ -30033,11 +29092,6 @@ function createSystemProxy(api) {
30033
29092
  updateRule: (input) => dispatch("notificationRules", "updateRule", "mutation", input),
30034
29093
  deleteRule: (input) => dispatch("notificationRules", "deleteRule", "mutation", input),
30035
29094
  setRuleEnabled: (input) => dispatch("notificationRules", "setRuleEnabled", "mutation", input),
30036
- listSequences: (input) => dispatch("notificationRules", "listSequences", "query", input),
30037
- getSequence: (input) => dispatch("notificationRules", "getSequence", "query", input),
30038
- createSequence: (input) => dispatch("notificationRules", "createSequence", "mutation", input),
30039
- updateSequence: (input) => dispatch("notificationRules", "updateSequence", "mutation", input),
30040
- deleteSequence: (input) => dispatch("notificationRules", "deleteSequence", "mutation", input),
30041
29095
  getClipRetentionAsks: (input) => dispatch("notificationRules", "getClipRetentionAsks", "query", input),
30042
29096
  listDeviceMutes: (input) => dispatch("notificationRules", "listDeviceMutes", "query", input),
30043
29097
  testRule: (input) => dispatch("notificationRules", "testRule", "mutation", input),
@@ -31593,12 +30647,8 @@ var NC_ALARM_OPENING_EVENT_KINDS = [
31593
30647
  "lock",
31594
30648
  "switch"
31595
30649
  ];
31596
- function bindingPullsAlarmTrigger(binding, sequenceActionsOf) {
31597
- if (binding.kind === "do") {
31598
- const action = binding.action;
31599
- return action.kind === "cap" && action.cap === ALARM_PANEL_CAP && action.method === ALARM_PANEL_TRIGGER_METHOD;
31600
- }
31601
- const steps = sequenceActionsOf?.(binding.sequenceId);
30650
+ function actionPullsAlarmTrigger(actionId, actionStepsOf) {
30651
+ const steps = actionStepsOf?.(actionId);
31602
30652
  if (steps === void 0) return false;
31603
30653
  return steps.some((step) => step.kind === "cap" && step.cap === ALARM_PANEL_CAP && step.method === ALARM_PANEL_TRIGGER_METHOD);
31604
30654
  }
@@ -31608,13 +30658,13 @@ function ruleGatedOnArmedState(rule) {
31608
30658
  }
31609
30659
  /**
31610
30660
  * A rule belongs to the alarm when its `deviceState` gate names ANY device's
31611
- * `armed_*` word, or an on-match binding pulls the alarm panel's trigger
31612
- * (D630). Button-only sequences do NOT count — they are not an automatic
30661
+ * `armed_*` word, or an on-match Action pulls the alarm panel's trigger
30662
+ * (D630). Button-only Actions do NOT count — they are not an automatic
31613
30663
  * escalation.
31614
30664
  */
31615
30665
  function ruleBelongsToAlarm(rule) {
31616
30666
  if (ruleGatedOnArmedState(rule)) return true;
31617
- for (const binding of rule.actions?.onTrigger ?? []) if (bindingPullsAlarmTrigger(binding, rule.sequenceActionsOf)) return true;
30667
+ for (const actionId of rule.actions?.onTrigger ?? []) if (actionPullsAlarmTrigger(actionId, rule.actionStepsOf)) return true;
31618
30668
  return false;
31619
30669
  }
31620
30670
  function isOpeningKind(kind) {