@camstack/types 1.2.537 → 1.2.538

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