@camstack/server 1.2.928 → 1.2.929
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/CHANGELOG.md +6 -0
- package/package.json +10 -8
- package/system/dist/addon-id-CVg1_r5E.mjs +39 -0
- package/system/dist/addon-id-Di0lNJ89.js +50 -0
- package/system/dist/addon-pages.cap-Df9FQwN1.js +49 -0
- package/system/dist/addon-pages.cap-DksUlE8j.mjs +44 -0
- package/system/dist/addon-settings.cap-3-TIIMq_.mjs +592 -0
- package/system/dist/addon-settings.cap-DAiE0Nb0.js +651 -0
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/addon-widgets.cap-C4jxflbF.js +200 -0
- package/system/dist/addon-widgets.cap-D9m48X78.mjs +183 -0
- package/system/dist/base-addon-DD5dIfcZ.js +4624 -0
- package/system/dist/base-addon-Md14i7pe.mjs +4505 -0
- package/system/dist/base-device-2sL1DMm1.js +1103 -0
- package/system/dist/base-device-IuM1AwXZ.mjs +1098 -0
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +6 -4
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +7 -5
- package/system/dist/builtins/alerts/alerts.addon.js +113 -56
- package/system/dist/builtins/alerts/alerts.addon.mjs +60 -3
- package/system/dist/builtins/autotrack/index.js +21 -17
- package/system/dist/builtins/autotrack/index.mjs +5 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +14 -11
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +8 -5
- package/system/dist/builtins/calendars/calendars.addon.js +8 -6
- package/system/dist/builtins/calendars/calendars.addon.mjs +3 -1
- package/system/dist/builtins/camera-grid/index.js +615 -58
- package/system/dist/builtins/camera-grid/index.mjs +558 -1
- package/system/dist/builtins/composer/composer.addon.js +788 -209
- package/system/dist/builtins/composer/composer.addon.mjs +583 -4
- package/system/dist/builtins/console-logging/index.js +4 -3
- package/system/dist/builtins/console-logging/index.mjs +2 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +7887 -381
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +7511 -5
- package/system/dist/builtins/core-notifier/core-notifier.addon.js +731 -21
- package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +711 -1
- package/system/dist/builtins/device-history/device-history.addon.js +110 -31
- package/system/dist/builtins/device-history/device-history.addon.mjs +81 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +12806 -227
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +12583 -5
- package/system/dist/builtins/hub-forwarder/index.js +4 -3
- package/system/dist/builtins/hub-forwarder/index.mjs +2 -1
- package/system/dist/builtins/keychain/index.js +31 -28
- package/system/dist/builtins/keychain/index.mjs +7 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +15 -12
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +4 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +140 -39
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +106 -6
- package/system/dist/builtins/local-network/local-network.addon.js +43 -39
- package/system/dist/builtins/local-network/local-network.addon.mjs +7 -3
- package/system/dist/builtins/loki-logging/index.js +23 -17
- package/system/dist/builtins/loki-logging/index.mjs +7 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +156 -15
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +151 -10
- package/system/dist/builtins/platform-probe/index.js +25 -23
- package/system/dist/builtins/platform-probe/index.mjs +12 -10
- package/system/dist/builtins/record-entries/index.js +9 -7
- package/system/dist/builtins/record-entries/index.mjs +3 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +97 -44
- package/system/dist/builtins/snapshot/index.mjs +54 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +5 -4
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +21 -20
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +87 -61
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +81 -72
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +10 -1
- package/system/dist/builtins/system-config/system-config.addon.js +17 -14
- package/system/dist/builtins/system-config/system-config.addon.mjs +118 -115
- package/system/dist/builtins/winston-logging/index.js +7 -5
- package/system/dist/builtins/winston-logging/index.mjs +3 -1
- package/system/dist/calendars.cap-CaFlShS9.js +155 -0
- package/system/dist/calendars.cap-_C4eD4fi.mjs +138 -0
- package/system/dist/camstack-error-DJ-TUAi1.js +23 -0
- package/system/dist/camstack-error-viZYfcj9.mjs +18 -0
- package/system/dist/cap-call-context-Bd76CbOW.js +95 -0
- package/system/dist/cap-call-context-DNwdgGSQ.mjs +78 -0
- package/system/dist/capability-definition-C2rJdVeX.mjs +177 -0
- package/system/dist/capability-definition-HCmTem8c.js +242 -0
- package/system/dist/{capture-engine-BcuwOSXv.js → capture-engine-DZ0LIUqA.js} +5 -4
- package/system/dist/{capture-engine-Bz7eXFjT.mjs → capture-engine-DiwbjoWp.mjs} +2 -1
- package/system/dist/command-origin-claim-Cief660O.js +35 -0
- package/system/dist/command-origin-claim-D1Wy7Qld.mjs +24 -0
- package/system/dist/composition-sources-Caqv7O7z.mjs +391 -0
- package/system/dist/composition-sources-CgnHjm8Q.js +408 -0
- package/system/dist/{constants-D2etJ02O.js → constants-Ba3FTIHl.js} +1 -1
- package/system/dist/constants-C860Y6U4.js +26 -0
- package/system/dist/{constants-BcUTQd1M.mjs → constants-DB4piTD5.mjs} +1 -1
- package/system/dist/constants-DCLpoF4L.mjs +21 -0
- package/system/dist/coral-accelerators-7o8hqvcN.js +564 -0
- package/system/dist/coral-accelerators-BKcXP59c.mjs +521 -0
- package/system/dist/core-blocks.cap-C6iKAZ-x.mjs +17986 -0
- package/system/dist/core-blocks.cap-LEMqVwxO.js +18705 -0
- package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
- package/system/dist/custom-actions-BFUSalC9.mjs +25 -0
- package/system/dist/custom-actions-D92NRi2c.js +36 -0
- package/system/dist/database-snapshot.cap-DF38e-0P.js +162 -0
- package/system/dist/database-snapshot.cap-dhrc9xnY.mjs +133 -0
- package/system/dist/declared-device-BWphj9WE.js +303 -0
- package/system/dist/declared-device-CKERA1Hi.mjs +286 -0
- package/system/dist/{device-ca-ExMN3xW3.mjs → device-ca-BLM6fccc.mjs} +2 -1
- package/system/dist/{device-ca-CU8zh9Pi.js → device-ca-C5kJE6mL.js} +7 -6
- package/system/dist/device-certificate-Cddm4Idn.mjs +91 -0
- package/system/dist/device-certificate-CguVACQO.js +162 -0
- package/system/dist/device-identifiers-BQg9EQi1.js +600 -0
- package/system/dist/device-identifiers-iSuQCKmK.mjs +529 -0
- package/system/dist/device-kind-BJ2pfsjw.mjs +78 -0
- package/system/dist/device-kind-CsSiv_YF.js +101 -0
- package/system/dist/device-manager.cap-2abwVLCM.js +2874 -0
- package/system/dist/device-manager.cap-CFZSPfUh.mjs +2749 -0
- package/system/dist/device-provider.cap-3Uvk6f5-.mjs +331 -0
- package/system/dist/device-provider.cap-D7TV2kVH.js +366 -0
- package/system/dist/{device-row-store-CeW_GWh9.mjs → device-row-store-YF3jtmkk.mjs} +4 -1
- package/system/dist/{device-row-store-BMIR-n3m.js → device-row-store-doTfMOqn.js} +12 -9
- package/system/dist/device-transitions.cap-B5w5PYU_.js +860 -0
- package/system/dist/device-transitions.cap-DojcwEuX.mjs +819 -0
- package/system/dist/device-type-CbQsnFdC.js +477 -0
- package/system/dist/device-type-DgEvK3ch.mjs +454 -0
- package/system/dist/entry-kind-D9MuVJCK.mjs +44 -0
- package/system/dist/entry-kind-cq90c--V.js +55 -0
- package/system/dist/error.cap-CSM_SRfR.mjs +3423 -0
- package/system/dist/error.cap-DBhgPeWK.js +3848 -0
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/history-catalog-BKRarIL_.js +831 -0
- package/system/dist/history-catalog-BwTeQ4Mr.mjs +802 -0
- package/system/dist/{hub-identity-Csxx2Q8k.js → hub-identity-BMdR3Mw9.js} +2 -2
- package/system/dist/{hub-identity-CYC1820R.mjs → hub-identity-DjMN9Ac2.mjs} +10 -10
- package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
- package/system/dist/{hub-mdns-ciao-CCDxM5qz.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
- package/system/dist/index.js +763 -151
- package/system/dist/index.mjs +832 -220
- package/system/dist/integration-instances.cap-Cl9O-k4h.mjs +538 -0
- package/system/dist/integration-instances.cap-dJIxg2_s.js +549 -0
- package/system/dist/keychain-admin.cap-Db_oFX4H.js +425 -0
- package/system/dist/keychain-admin.cap-GtM7gVGG.mjs +396 -0
- package/system/dist/l10n-Bu6aUvSY.mjs +10 -0
- package/system/dist/l10n-CGMvp7NF.js +15 -0
- package/system/dist/labels-DX5S8deC.js +81 -0
- package/system/dist/labels-DsBcU7md.mjs +64 -0
- package/system/dist/{legacy-integration-rows-door-CVwOo5aq.js → legacy-integration-rows-door-B1nzxxr5.js} +2 -2
- package/system/dist/{legacy-integration-rows-door-D9tQOUzh.mjs → legacy-integration-rows-door-nTvo_6jQ.mjs} +1 -1
- package/system/dist/log-destination.cap-CxZzAVaR.mjs +143 -0
- package/system/dist/log-destination.cap-DELPJkZ0.js +148 -0
- package/system/dist/low-power-sleep.cap-7lfVU41N.js +103 -0
- package/system/dist/low-power-sleep.cap-tGPmaZ_V.mjs +92 -0
- package/system/dist/mask-shape-Ci8Co9w0.mjs +57 -0
- package/system/dist/mask-shape-CmPA2fst.js +92 -0
- package/system/dist/metrics-provider.cap-BNmcHDkQ.mjs +405 -0
- package/system/dist/metrics-provider.cap-BcmQUt6l.js +410 -0
- package/system/dist/migration-BMjgkyG2.js +380 -0
- package/system/dist/migration-DRJAtdy7.mjs +321 -0
- package/system/dist/network-access.cap-B5TWLDCC.js +1099 -0
- package/system/dist/network-access.cap-BJnGbE6n.mjs +1004 -0
- package/system/dist/notification-rules.cap-B__YBgnG.js +3422 -0
- package/system/dist/notification-rules.cap-D9ArZlwx.mjs +3357 -0
- package/system/dist/ops-log-CB4pIdqi.mjs +64 -0
- package/system/dist/ops-log-pxt9176Z.js +81 -0
- package/system/dist/pinned-binary-BOhOSNff.js +28 -0
- package/system/dist/pinned-binary-CrIRAi4G.mjs +23 -0
- package/system/dist/platform-probe.cap-1WrMhWHx.js +250 -0
- package/system/dist/platform-probe.cap-BFeqFLtQ.mjs +233 -0
- package/system/dist/prefix-walk-B4b2-9aK.mjs +790 -0
- package/system/dist/prefix-walk-DC0ljmbB.js +843 -0
- package/system/dist/ptz-autotrack.cap-BW7w0zHD.js +229 -0
- package/system/dist/ptz-autotrack.cap-DT2GypXw.mjs +224 -0
- package/system/dist/quantity-D3g5SxsZ.mjs +114 -0
- package/system/dist/quantity-lY1KiTSZ.js +143 -0
- package/system/dist/raw-secret-migration-DxuBFtvi.js +50 -0
- package/system/dist/raw-secret-migration-iv88mLoc.mjs +39 -0
- package/system/dist/record-entries.cap-sMUhTvTU.mjs +75 -0
- package/system/dist/record-entries.cap-ti1C046R.js +80 -0
- package/system/dist/record-kind-DoBfYHCs.js +203 -0
- package/system/dist/record-kind-ub6NXqfh.mjs +162 -0
- package/system/dist/recording-archive.cap-7OrIn9e5.mjs +1299 -0
- package/system/dist/recording-archive.cap-D7bo-QSM.js +1328 -0
- package/system/dist/records.cap-ClcWV64i.js +329 -0
- package/system/dist/records.cap-CwLT2ByG.mjs +294 -0
- package/system/dist/relocate-CdVQAk-w.js +804 -0
- package/system/dist/relocate-CoZZTui1.mjs +661 -0
- package/system/dist/rename-composition-block-7WIICIDq.mjs +33525 -0
- package/system/dist/rename-composition-block-CcWLwVhG.js +34692 -0
- package/system/dist/{restore-archive-BJfyu0sG.mjs → restore-archive-CjAyKpgX.mjs} +96 -94
- package/system/dist/{restore-archive-CIFvqOze.js → restore-archive-CkTkv3Ss.js} +6 -4
- package/system/dist/scoped-settings-CylSSq_8.js +955 -0
- package/system/dist/scoped-settings-DVWUIP7Z.mjs +650 -0
- package/system/dist/server-name-BIhLuHvX.mjs +35 -0
- package/system/dist/server-name-OALNvpqC.js +52 -0
- package/system/dist/settings-store.cap-Ci4F2zul.mjs +569 -0
- package/system/dist/settings-store.cap-wlJhCspr.js +640 -0
- package/system/dist/snapshot.cap-3suPdBHV.js +250 -0
- package/system/dist/snapshot.cap-Bs8Oyaqh.mjs +245 -0
- package/system/dist/source-info-DGB7SdB_.mjs +190 -0
- package/system/dist/source-info-DtWf4k2j.js +225 -0
- package/system/dist/storage-admin.cap-BSv1NjKJ.mjs +883 -0
- package/system/dist/storage-admin.cap-he0OqvVM.js +906 -0
- package/system/dist/storage-location-CBT8GCD6.mjs +163 -0
- package/system/dist/storage-location-CTweDMZf.js +198 -0
- package/system/dist/storage-location-mode-B21UVRRX.mjs +167 -0
- package/system/dist/storage-location-mode-CS4sMzo-.js +232 -0
- package/system/dist/storage-migration.cap-CyyATY_p.js +330 -0
- package/system/dist/storage-migration.cap-D7QqGobp.mjs +313 -0
- package/system/dist/storage-occupancy.cap-2rmnS58Z.js +622 -0
- package/system/dist/storage-occupancy.cap-CqBztTl9.mjs +611 -0
- package/system/dist/storage-provider.cap-Bw0CfxVc.js +213 -0
- package/system/dist/storage-provider.cap-CMeck2w4.mjs +202 -0
- package/system/dist/stream-catalog.cap-Bp7SkgIf.mjs +6560 -0
- package/system/dist/stream-catalog.cap-D3uwePiA.js +6763 -0
- package/system/dist/streaming-shared-B8cXatuU.mjs +431 -0
- package/system/dist/streaming-shared-DQwFZOSi.js +526 -0
- package/system/dist/system-reasons-Be_k1W8g.js +25 -0
- package/system/dist/system-reasons-CYj4qwyS.mjs +20 -0
- package/system/dist/tag-BxLazvVb.js +2138 -0
- package/system/dist/tag-uZBAq6ox.mjs +2073 -0
- package/system/dist/user-management.cap-B9QDu8NE.js +825 -0
- package/system/dist/user-management.cap-DBIi77sB.mjs +766 -0
- package/system/dist/vector-store.cap-DnyfrYDn.js +330 -0
- package/system/dist/vector-store.cap-h2GHWQ1t.mjs +319 -0
- package/system/dist/{wal-maintenance-CTrCPzds.mjs → wal-maintenance-BG01rOn9.mjs} +0 -0
- package/system/dist/{wal-maintenance-dq7T3quB.js → wal-maintenance-DyrebYKF.js} +0 -0
- package/system/dist/zod-secret-DS7mj1bk.js +78 -0
- package/system/dist/zod-secret-zY4nM61M.mjs +73 -0
- package/system/package.json +1 -1
- package/system/dist/composition-sources-BI614LJx.mjs +0 -141
- package/system/dist/composition-sources-v_kkb8A9.js +0 -152
- package/system/dist/coral-accelerators-BSVsBVzt.js +0 -250
- package/system/dist/coral-accelerators-BW3OcrLD.mjs +0 -231
- package/system/dist/dist-BCHMSqzc.mjs +0 -143467
- package/system/dist/dist-BZfvhfS1.js +0 -146970
- package/system/dist/prefix-walk-DAOBSyH1.mjs +0 -88
- package/system/dist/prefix-walk-Dv6MLZlM.js +0 -99
- package/system/dist/rename-composition-block-C9HuBrKS.js +0 -112
- package/system/dist/rename-composition-block-DtaYmYAR.mjs +0 -101
|
@@ -0,0 +1,3422 @@
|
|
|
1
|
+
const require_streaming_shared = require("./streaming-shared-DQwFZOSi.js");
|
|
2
|
+
const require_capability_definition = require("./capability-definition-HCmTem8c.js");
|
|
3
|
+
const require_tag = require("./tag-BxLazvVb.js");
|
|
4
|
+
const require_device_type = require("./device-type-CbQsnFdC.js");
|
|
5
|
+
const require_l10n = require("./l10n-CGMvp7NF.js");
|
|
6
|
+
const require_mask_shape = require("./mask-shape-CmPA2fst.js");
|
|
7
|
+
let zod = require("zod");
|
|
8
|
+
//#region ../types/dist/esm/capabilities/notification-output.cap.mjs
|
|
9
|
+
/**
|
|
10
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
11
|
+
*
|
|
12
|
+
* Apprise-derived model (see
|
|
13
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
15
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
16
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
17
|
+
* message to what the kind supports — callers never special-case a service.
|
|
18
|
+
*
|
|
19
|
+
* DESIGN DECISIONS (locked):
|
|
20
|
+
* - A target is an INSTANCE of this function cap (epic #440, step 6): the
|
|
21
|
+
* providers serve their targets as `integration-instances` records, one
|
|
22
|
+
* record kind per target kind, and the admin lists, adds, edits, switches
|
|
23
|
+
* and deletes them through that cap. This cap keeps what an instance cannot
|
|
24
|
+
* say: the kind catalogue (`listTargetKinds`: capabilities, delivery
|
|
25
|
+
* parameters, brand icon), dispatch (`send`, `testTarget`) and the form
|
|
26
|
+
* helpers (`discoverTargets`, `probeTargetConfig`).
|
|
27
|
+
* - `listTargetKinds` / `discoverTargets` return arrays → the generated
|
|
28
|
+
* cap-mount auto-`concatCollection`-fans them across every registered
|
|
29
|
+
* provider so one catalog is routable. `send` / `testTarget` /
|
|
30
|
+
* `probeTargetConfig` route to ONE provider by the `addonId` the generated
|
|
31
|
+
* collection router extracts from the call input.
|
|
32
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
33
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
34
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
35
|
+
* base64 fallback needed.
|
|
36
|
+
*
|
|
37
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
38
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
39
|
+
* admin "Integrations" page.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
43
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
44
|
+
*/
|
|
45
|
+
var AttachmentMediaTypeSchema = /* @__PURE__ */ zod.z.enum([
|
|
46
|
+
"image",
|
|
47
|
+
"video",
|
|
48
|
+
"gif",
|
|
49
|
+
"audio",
|
|
50
|
+
"icon"
|
|
51
|
+
]);
|
|
52
|
+
/**
|
|
53
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
54
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
55
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
56
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
57
|
+
*/
|
|
58
|
+
var AttachmentSchema = /* @__PURE__ */ zod.z.object({
|
|
59
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
60
|
+
url: /* @__PURE__ */ zod.z.string().optional(),
|
|
61
|
+
bytes: /* @__PURE__ */ zod.z.instanceof(Uint8Array).optional(),
|
|
62
|
+
mime: /* @__PURE__ */ zod.z.string().optional(),
|
|
63
|
+
name: /* @__PURE__ */ zod.z.string().optional()
|
|
64
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
65
|
+
var NotificationFormatSchema = /* @__PURE__ */ zod.z.enum([
|
|
66
|
+
"text",
|
|
67
|
+
"markdown",
|
|
68
|
+
"html"
|
|
69
|
+
]);
|
|
70
|
+
/**
|
|
71
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
72
|
+
*
|
|
73
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
74
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
75
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
76
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
77
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
78
|
+
*
|
|
79
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
80
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
81
|
+
* differently.
|
|
82
|
+
*
|
|
83
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
84
|
+
*
|
|
85
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
86
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
87
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
88
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
89
|
+
* decides its glyph, which is the only place that decision can be made
|
|
90
|
+
* honestly.
|
|
91
|
+
*
|
|
92
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
93
|
+
* `disarm` straight through; iOS feeds that string to
|
|
94
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
95
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
96
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
97
|
+
*
|
|
98
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
99
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
100
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
101
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
102
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
103
|
+
*/
|
|
104
|
+
var NotificationActionIconSchema = /* @__PURE__ */ zod.z.enum([
|
|
105
|
+
"acknowledge",
|
|
106
|
+
"dismiss",
|
|
107
|
+
"silence",
|
|
108
|
+
"snooze",
|
|
109
|
+
"view",
|
|
110
|
+
"play",
|
|
111
|
+
"open",
|
|
112
|
+
"close",
|
|
113
|
+
"lock",
|
|
114
|
+
"unlock",
|
|
115
|
+
"arm",
|
|
116
|
+
"arm-home",
|
|
117
|
+
"arm-away",
|
|
118
|
+
"arm-night",
|
|
119
|
+
"disarm",
|
|
120
|
+
"light",
|
|
121
|
+
"alert",
|
|
122
|
+
"camera"
|
|
123
|
+
]);
|
|
124
|
+
/** A single tap-through action button. */
|
|
125
|
+
var NotificationActionSchema = /* @__PURE__ */ zod.z.object({
|
|
126
|
+
id: /* @__PURE__ */ zod.z.string(),
|
|
127
|
+
label: /* @__PURE__ */ zod.z.string(),
|
|
128
|
+
url: /* @__PURE__ */ zod.z.string().optional(),
|
|
129
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
130
|
+
icon: /* @__PURE__ */ NotificationActionIconSchema.optional(),
|
|
131
|
+
/**
|
|
132
|
+
* Renders in a warning style where the notifier supports it.
|
|
133
|
+
*
|
|
134
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
135
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
136
|
+
* does not buy.
|
|
137
|
+
*/
|
|
138
|
+
destructive: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
139
|
+
/**
|
|
140
|
+
* How the tap should REACH the url.
|
|
141
|
+
*
|
|
142
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
143
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
144
|
+
* That is right for a button whose answer the operator wants to read.
|
|
145
|
+
*
|
|
146
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
147
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
148
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
149
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
150
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
151
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
152
|
+
* a requirement.
|
|
153
|
+
*/
|
|
154
|
+
mode: /* @__PURE__ */ zod.z.enum(["navigate", "background"]).optional()
|
|
155
|
+
});
|
|
156
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
157
|
+
var DeliveryParamValueSchema = /* @__PURE__ */ zod.z.union([
|
|
158
|
+
/* @__PURE__ */ zod.z.string(),
|
|
159
|
+
/* @__PURE__ */ zod.z.number(),
|
|
160
|
+
/* @__PURE__ */ zod.z.boolean()
|
|
161
|
+
]);
|
|
162
|
+
/**
|
|
163
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
164
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
165
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
166
|
+
* no editor knows a service by name.
|
|
167
|
+
*
|
|
168
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
169
|
+
* run on the addon cap path).
|
|
170
|
+
*/
|
|
171
|
+
var DeliveryParamSchema = /* @__PURE__ */ zod.z.object({
|
|
172
|
+
key: /* @__PURE__ */ zod.z.string().min(1),
|
|
173
|
+
label: /* @__PURE__ */ zod.z.string(),
|
|
174
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
175
|
+
labelKey: /* @__PURE__ */ zod.z.string().optional(),
|
|
176
|
+
type: /* @__PURE__ */ zod.z.enum([
|
|
177
|
+
"enum",
|
|
178
|
+
"number",
|
|
179
|
+
"boolean",
|
|
180
|
+
"string"
|
|
181
|
+
]),
|
|
182
|
+
/** `enum` only: the closed set of accepted values. */
|
|
183
|
+
options: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
|
|
184
|
+
value: /* @__PURE__ */ zod.z.string(),
|
|
185
|
+
label: /* @__PURE__ */ zod.z.string()
|
|
186
|
+
})).optional(),
|
|
187
|
+
/** `number` only. */
|
|
188
|
+
min: /* @__PURE__ */ zod.z.number().optional(),
|
|
189
|
+
max: /* @__PURE__ */ zod.z.number().optional(),
|
|
190
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
191
|
+
default: /* @__PURE__ */ DeliveryParamValueSchema.optional()
|
|
192
|
+
});
|
|
193
|
+
/**
|
|
194
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
195
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
196
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
197
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
198
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
199
|
+
* `priority` for that one target.
|
|
200
|
+
*/
|
|
201
|
+
var NotificationSchema = /* @__PURE__ */ zod.z.object({
|
|
202
|
+
body: /* @__PURE__ */ zod.z.string(),
|
|
203
|
+
title: /* @__PURE__ */ zod.z.string().optional(),
|
|
204
|
+
format: /* @__PURE__ */ NotificationFormatSchema.default("text"),
|
|
205
|
+
priority: /* @__PURE__ */ zod.z.number().int().min(1).max(5).default(3),
|
|
206
|
+
level: /* @__PURE__ */ zod.z.string().optional(),
|
|
207
|
+
attachments: /* @__PURE__ */ zod.z.array(AttachmentSchema).optional(),
|
|
208
|
+
clickUrl: /* @__PURE__ */ zod.z.string().optional(),
|
|
209
|
+
actions: /* @__PURE__ */ zod.z.array(NotificationActionSchema).optional(),
|
|
210
|
+
sound: /* @__PURE__ */ zod.z.string().optional(),
|
|
211
|
+
ttl: /* @__PURE__ */ zod.z.number().optional(),
|
|
212
|
+
tag: /* @__PURE__ */ zod.z.string().optional(),
|
|
213
|
+
deviceId: /* @__PURE__ */ zod.z.number().optional(),
|
|
214
|
+
eventId: /* @__PURE__ */ zod.z.string().optional(),
|
|
215
|
+
metadata: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()).optional(),
|
|
216
|
+
/**
|
|
217
|
+
* Values for the parameters the target's kind DECLARES in
|
|
218
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
219
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
220
|
+
*/
|
|
221
|
+
delivery: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), DeliveryParamValueSchema).optional()
|
|
222
|
+
});
|
|
223
|
+
/** One declared native severity/priority level for a kind. */
|
|
224
|
+
var TargetKindLevelSchema = /* @__PURE__ */ zod.z.object({
|
|
225
|
+
id: /* @__PURE__ */ zod.z.string(),
|
|
226
|
+
label: /* @__PURE__ */ zod.z.string(),
|
|
227
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
228
|
+
ordinal: /* @__PURE__ */ zod.z.number().int().min(1).max(5).nullable(),
|
|
229
|
+
flags: /* @__PURE__ */ zod.z.object({
|
|
230
|
+
critical: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
231
|
+
silent: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
232
|
+
noPush: /* @__PURE__ */ zod.z.boolean().optional()
|
|
233
|
+
}).optional(),
|
|
234
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
235
|
+
requires: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).optional(),
|
|
236
|
+
description: /* @__PURE__ */ zod.z.string().optional()
|
|
237
|
+
});
|
|
238
|
+
/** Attachment capabilities for a kind (drives the degrade engine + test panel). */
|
|
239
|
+
var TargetKindAttachmentsCapsSchema = /* @__PURE__ */ zod.z.object({
|
|
240
|
+
mediaTypes: /* @__PURE__ */ zod.z.array(AttachmentMediaTypeSchema),
|
|
241
|
+
mode: /* @__PURE__ */ zod.z.enum([
|
|
242
|
+
"url",
|
|
243
|
+
"bytes",
|
|
244
|
+
"both"
|
|
245
|
+
]),
|
|
246
|
+
max: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
247
|
+
maxBytes: /* @__PURE__ */ zod.z.number().int().positive().optional()
|
|
248
|
+
});
|
|
249
|
+
/**
|
|
250
|
+
* Which TEXT fields a kind delivers (#483). Alexa speaks a title and nothing
|
|
251
|
+
* else; a push service shows both.
|
|
252
|
+
*
|
|
253
|
+
* `.optional()` on the caps block, never defaulted: absent = both, which is
|
|
254
|
+
* what every kind declared before this field meant (D938's rule for a Zod
|
|
255
|
+
* default on the addon cap path).
|
|
256
|
+
*/
|
|
257
|
+
var TargetKindTextCapsSchema = /* @__PURE__ */ zod.z.object({
|
|
258
|
+
title: /* @__PURE__ */ zod.z.boolean(),
|
|
259
|
+
body: /* @__PURE__ */ zod.z.boolean()
|
|
260
|
+
});
|
|
261
|
+
/**
|
|
262
|
+
* The message fields a rule can author for a target (#483). Derived from a
|
|
263
|
+
* kind's caps by `deliverableFields` — the ONE reading of the declaration, used
|
|
264
|
+
* by the dispatcher (drop), the admin rule editor (show) and the viewer.
|
|
265
|
+
*/
|
|
266
|
+
var NotificationFieldSchema = /* @__PURE__ */ zod.z.enum([
|
|
267
|
+
"title",
|
|
268
|
+
"body",
|
|
269
|
+
"attachments",
|
|
270
|
+
"actions",
|
|
271
|
+
"priority",
|
|
272
|
+
"sound",
|
|
273
|
+
"clickUrl"
|
|
274
|
+
]);
|
|
275
|
+
/** The full capability block consulted before dispatch. */
|
|
276
|
+
var TargetKindCapsSchema = /* @__PURE__ */ zod.z.object({
|
|
277
|
+
/** Text fields this kind delivers (#483). Absent = title AND body. */
|
|
278
|
+
text: /* @__PURE__ */ TargetKindTextCapsSchema.optional(),
|
|
279
|
+
attachments: TargetKindAttachmentsCapsSchema,
|
|
280
|
+
/** Max action buttons (0 = none). */
|
|
281
|
+
actions: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
282
|
+
/**
|
|
283
|
+
* Whether this kind renders a per-action ICON.
|
|
284
|
+
*
|
|
285
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
286
|
+
* run on the addon cap path — three production failures in one day taught
|
|
287
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
288
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
289
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
290
|
+
*/
|
|
291
|
+
actionIcons: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
292
|
+
levels: /* @__PURE__ */ zod.z.array(TargetKindLevelSchema),
|
|
293
|
+
format: /* @__PURE__ */ zod.z.array(NotificationFormatSchema),
|
|
294
|
+
clickUrl: /* @__PURE__ */ zod.z.boolean(),
|
|
295
|
+
sound: /* @__PURE__ */ zod.z.boolean(),
|
|
296
|
+
ttl: /* @__PURE__ */ zod.z.boolean(),
|
|
297
|
+
bodyMaxLen: /* @__PURE__ */ zod.z.number().int().positive()
|
|
298
|
+
});
|
|
299
|
+
/**
|
|
300
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
301
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
302
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
303
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
304
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
305
|
+
*/
|
|
306
|
+
var ConfigSchemaPassthrough = /* @__PURE__ */ zod.z.unknown();
|
|
307
|
+
var TargetKindSchema = /* @__PURE__ */ zod.z.object({
|
|
308
|
+
kind: /* @__PURE__ */ zod.z.string(),
|
|
309
|
+
label: /* @__PURE__ */ zod.z.string(),
|
|
310
|
+
icon: /* @__PURE__ */ zod.z.string(),
|
|
311
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
312
|
+
addonId: /* @__PURE__ */ zod.z.string(),
|
|
313
|
+
/**
|
|
314
|
+
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
315
|
+
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
316
|
+
* when the addon bundles no icon for that kind — the client then falls back
|
|
317
|
+
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
318
|
+
*
|
|
319
|
+
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
320
|
+
* client, and a native client joins it onto its own hub base.
|
|
321
|
+
*
|
|
322
|
+
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
323
|
+
* field that survived only because the runtime cap-router forwards provider
|
|
324
|
+
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
325
|
+
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
326
|
+
* broken silently the moment output validation was tightened anywhere.
|
|
327
|
+
*/
|
|
328
|
+
iconUrl: /* @__PURE__ */ zod.z.string().optional(),
|
|
329
|
+
/**
|
|
330
|
+
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
331
|
+
*
|
|
332
|
+
* The server knows this and therefore says it, because the client cannot
|
|
333
|
+
* safely guess: a React-Native client renders SVG and raster through two
|
|
334
|
+
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
335
|
+
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
336
|
+
* placeholder glyph for every vector icon while the web build looked fine.
|
|
337
|
+
*
|
|
338
|
+
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
339
|
+
* not been updated — a client that cannot determine the type should prefer
|
|
340
|
+
* its raster path, which is the safe default for an unknown image.
|
|
341
|
+
*/
|
|
342
|
+
iconMediaType: /* @__PURE__ */ zod.z.string().optional(),
|
|
343
|
+
configSchema: ConfigSchemaPassthrough,
|
|
344
|
+
/**
|
|
345
|
+
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
346
|
+
* base URL, instance, chat, recipient). A save that changes any of them
|
|
347
|
+
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
348
|
+
* editor uses this to ask for the secret on exactly those edits instead of
|
|
349
|
+
* on every edit.
|
|
350
|
+
*
|
|
351
|
+
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
352
|
+
* kinds) and from a provider older than this field — an editor that finds
|
|
353
|
+
* it absent must assume ANY edit may need the secret.
|
|
354
|
+
*/
|
|
355
|
+
destinationKeys: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).optional(),
|
|
356
|
+
supportsDiscovery: /* @__PURE__ */ zod.z.boolean(),
|
|
357
|
+
/**
|
|
358
|
+
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
359
|
+
* Absent = none; the rule editor then offers nothing.
|
|
360
|
+
*/
|
|
361
|
+
deliveryParams: /* @__PURE__ */ zod.z.array(DeliveryParamSchema).optional(),
|
|
362
|
+
caps: TargetKindCapsSchema
|
|
363
|
+
});
|
|
364
|
+
/**
|
|
365
|
+
* A target as a provider's own code sees it (the notification-center bridge, the
|
|
366
|
+
* send path): the flat record body split into the name, the switch and the
|
|
367
|
+
* kind's fields. `config` holds secrets; a reader that serves it to a client
|
|
368
|
+
* REDACTS secret fields (a presence marker only) — never round-trip a stored
|
|
369
|
+
* secret to the UI.
|
|
370
|
+
*/
|
|
371
|
+
var TargetSchema = /* @__PURE__ */ zod.z.object({
|
|
372
|
+
id: /* @__PURE__ */ zod.z.string(),
|
|
373
|
+
name: /* @__PURE__ */ zod.z.string(),
|
|
374
|
+
kind: /* @__PURE__ */ zod.z.string(),
|
|
375
|
+
addonId: /* @__PURE__ */ zod.z.string(),
|
|
376
|
+
enabled: /* @__PURE__ */ zod.z.boolean(),
|
|
377
|
+
config: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown())
|
|
378
|
+
});
|
|
379
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
380
|
+
var DiscoveredTargetSchema = /* @__PURE__ */ zod.z.object({
|
|
381
|
+
kind: /* @__PURE__ */ zod.z.string(),
|
|
382
|
+
suggestedName: /* @__PURE__ */ zod.z.string(),
|
|
383
|
+
config: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown())
|
|
384
|
+
});
|
|
385
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
386
|
+
var RenderedAsSchema = /* @__PURE__ */ zod.z.object({
|
|
387
|
+
level: /* @__PURE__ */ zod.z.string(),
|
|
388
|
+
format: NotificationFormatSchema,
|
|
389
|
+
attachmentsSent: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
390
|
+
actionsSent: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
391
|
+
truncated: /* @__PURE__ */ zod.z.boolean(),
|
|
392
|
+
dropped: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string())
|
|
393
|
+
});
|
|
394
|
+
var SendResultSchema = /* @__PURE__ */ zod.z.object({
|
|
395
|
+
success: /* @__PURE__ */ zod.z.boolean(),
|
|
396
|
+
error: /* @__PURE__ */ zod.z.string().optional(),
|
|
397
|
+
renderedAs: /* @__PURE__ */ RenderedAsSchema.optional()
|
|
398
|
+
});
|
|
399
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
400
|
+
var TestResultSchema = SendResultSchema;
|
|
401
|
+
/**
|
|
402
|
+
* Pre-save credential probe against a partial (unsaved) target config.
|
|
403
|
+
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
404
|
+
*/
|
|
405
|
+
var ProbeTargetConfigResultSchema = /* @__PURE__ */ zod.z.object({
|
|
406
|
+
ok: /* @__PURE__ */ zod.z.boolean(),
|
|
407
|
+
resolvedUrl: /* @__PURE__ */ zod.z.string(),
|
|
408
|
+
httpStatus: /* @__PURE__ */ zod.z.number().int().optional(),
|
|
409
|
+
stateInstance: /* @__PURE__ */ zod.z.string().optional(),
|
|
410
|
+
error: /* @__PURE__ */ zod.z.string().optional()
|
|
411
|
+
});
|
|
412
|
+
var notificationOutputCapability = {
|
|
413
|
+
name: "notification-output",
|
|
414
|
+
scope: "system",
|
|
415
|
+
mode: "collection",
|
|
416
|
+
methods: {
|
|
417
|
+
listTargetKinds: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.array(TargetKindSchema)),
|
|
418
|
+
discoverTargets: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
419
|
+
kind: /* @__PURE__ */ zod.z.string(),
|
|
420
|
+
config: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()).optional(),
|
|
421
|
+
/**
|
|
422
|
+
* When editing / duplicating, the blank password field never round-trips
|
|
423
|
+
* the stored token. Pass the source target id so the provider can restore
|
|
424
|
+
* secrets server-side before dialling.
|
|
425
|
+
*/
|
|
426
|
+
targetId: /* @__PURE__ */ zod.z.string().optional()
|
|
427
|
+
}), /* @__PURE__ */ zod.z.array(DiscoveredTargetSchema), { auth: "admin" }),
|
|
428
|
+
probeTargetConfig: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
429
|
+
kind: /* @__PURE__ */ zod.z.string(),
|
|
430
|
+
config: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()),
|
|
431
|
+
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
432
|
+
targetId: /* @__PURE__ */ zod.z.string().optional()
|
|
433
|
+
}), ProbeTargetConfigResultSchema, {
|
|
434
|
+
kind: "mutation",
|
|
435
|
+
auth: "admin"
|
|
436
|
+
}),
|
|
437
|
+
send: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
438
|
+
targetId: /* @__PURE__ */ zod.z.string(),
|
|
439
|
+
notification: NotificationSchema
|
|
440
|
+
}), SendResultSchema, {
|
|
441
|
+
kind: "mutation",
|
|
442
|
+
auth: "admin"
|
|
443
|
+
}),
|
|
444
|
+
testTarget: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
445
|
+
targetId: /* @__PURE__ */ zod.z.string(),
|
|
446
|
+
sample: /* @__PURE__ */ NotificationSchema.optional()
|
|
447
|
+
}), TestResultSchema, {
|
|
448
|
+
kind: "mutation",
|
|
449
|
+
auth: "admin"
|
|
450
|
+
})
|
|
451
|
+
},
|
|
452
|
+
vocabulary: { notOperatorFacing: "notification delivery — reached through notifier devices and rules" }
|
|
453
|
+
};
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region ../types/dist/esm/capabilities/alarm-panel.cap.mjs
|
|
456
|
+
/**
|
|
457
|
+
* Alarm-panel cap. Models HA `alarm_control_panel.*` on
|
|
458
|
+
* `DeviceType.AlarmPanel`. State follows HA's canonical lifecycle
|
|
459
|
+
* across disarmed / armed_(home|away|night|vacation|custom_bypass) /
|
|
460
|
+
* arming / pending / triggered / disarming.
|
|
461
|
+
*
|
|
462
|
+
* Many panels require a PIN code on arm / disarm — the optional
|
|
463
|
+
* `code` field on the methods passes it through to the upstream
|
|
464
|
+
* service; it's NEVER persisted in the runtime slice or any event
|
|
465
|
+
* payload. Whether a code is required is the slice's `codeRequired`
|
|
466
|
+
* (#459): `null` when the provider cannot tell (D393).
|
|
467
|
+
*
|
|
468
|
+
* `availableModes` mirrors HA's `supported_features`-derived arm
|
|
469
|
+
* mode list — the UI renders only the buttons the panel accepts.
|
|
470
|
+
*/
|
|
471
|
+
var AlarmStateSchema = /* @__PURE__ */ zod.z.enum([
|
|
472
|
+
"disarmed",
|
|
473
|
+
"armed_home",
|
|
474
|
+
"armed_away",
|
|
475
|
+
"armed_night",
|
|
476
|
+
"armed_vacation",
|
|
477
|
+
"armed_custom_bypass",
|
|
478
|
+
"arming",
|
|
479
|
+
"disarming",
|
|
480
|
+
"pending",
|
|
481
|
+
"triggered"
|
|
482
|
+
]);
|
|
483
|
+
var AlarmArmModeSchema = /* @__PURE__ */ zod.z.enum([
|
|
484
|
+
"home",
|
|
485
|
+
"away",
|
|
486
|
+
"night",
|
|
487
|
+
"vacation",
|
|
488
|
+
"custom_bypass"
|
|
489
|
+
]);
|
|
490
|
+
var AlarmPanelStatusSchema = /* @__PURE__ */ zod.z.object({
|
|
491
|
+
/** Current lifecycle state. */
|
|
492
|
+
state: AlarmStateSchema,
|
|
493
|
+
/**
|
|
494
|
+
* The arm mode the machine belongs to under transitional words
|
|
495
|
+
* (`arming` / `pending` / `triggered` / `disarming`). `null` when
|
|
496
|
+
* disarmed or when a provider cannot name one. Exporters MUST prefer
|
|
497
|
+
* this over an in-process memo — a HomeKit accessory that missed the
|
|
498
|
+
* settled `armed_*` slice used to map `pending` to DISARMED and hide
|
|
499
|
+
* an entry delay.
|
|
500
|
+
*/
|
|
501
|
+
targetMode: /* @__PURE__ */ AlarmArmModeSchema.nullable().optional(),
|
|
502
|
+
/** Subset of arm modes the panel accepts. UI renders one button per
|
|
503
|
+
* mode in this list. */
|
|
504
|
+
availableModes: /* @__PURE__ */ zod.z.array(AlarmArmModeSchema),
|
|
505
|
+
/**
|
|
506
|
+
* Whether the panel requires a PIN on arm / disarm (#459; the field was
|
|
507
|
+
* `requiresCode`, and the `alarm-pin-required` device feature is gone).
|
|
508
|
+
* `null` = the provider cannot tell (D393), never `false`. A slice restored
|
|
509
|
+
* from before the rename is upgraded at boot by `restoredFieldRenames`.
|
|
510
|
+
*/
|
|
511
|
+
codeRequired: /* @__PURE__ */ zod.z.boolean().nullable(),
|
|
512
|
+
/** Ms epoch when the slice was last updated. */
|
|
513
|
+
lastChangedAt: /* @__PURE__ */ zod.z.number()
|
|
514
|
+
});
|
|
515
|
+
var alarmPanelCapability = {
|
|
516
|
+
name: "alarm-panel",
|
|
517
|
+
scope: "device",
|
|
518
|
+
deviceNative: true,
|
|
519
|
+
mode: "singleton",
|
|
520
|
+
deviceTypes: [require_device_type.DeviceType.AlarmPanel],
|
|
521
|
+
methods: {
|
|
522
|
+
/**
|
|
523
|
+
* Force the panel into the `triggered` state — used by HA
|
|
524
|
+
* automations to surface external sensor events through the panel
|
|
525
|
+
* (e.g. a Reolink camera intrusion event firing the security
|
|
526
|
+
* system). Provider rejects when the panel hardware doesn't
|
|
527
|
+
* support a software-initiated trigger.
|
|
528
|
+
*/
|
|
529
|
+
trigger: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ deviceId: /* @__PURE__ */ zod.z.number().int().nonnegative() }), /* @__PURE__ */ zod.z.void(), {
|
|
530
|
+
kind: "mutation",
|
|
531
|
+
auth: "protected",
|
|
532
|
+
actions: [{
|
|
533
|
+
id: "alarm.trigger",
|
|
534
|
+
label: /* @__PURE__ */ require_l10n.t("Trigger alarm", "Fai scattare l’allarme"),
|
|
535
|
+
phrase: /* @__PURE__ */ require_l10n.t("Trigger the alarm on {device}", "Fai scattare l’allarme su {device}"),
|
|
536
|
+
icon: "siren"
|
|
537
|
+
}]
|
|
538
|
+
}),
|
|
539
|
+
disarm: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
540
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
541
|
+
code: /* @__PURE__ */ zod.z.string().min(1).optional()
|
|
542
|
+
}), /* @__PURE__ */ zod.z.void(), {
|
|
543
|
+
kind: "mutation",
|
|
544
|
+
auth: "protected",
|
|
545
|
+
actions: [{
|
|
546
|
+
id: "alarm.disarm",
|
|
547
|
+
label: /* @__PURE__ */ require_l10n.t("Disarm", "Disinserisci"),
|
|
548
|
+
phrase: /* @__PURE__ */ require_l10n.t("Disarm {device}", "Disinserisci {device}"),
|
|
549
|
+
icon: "shield-off",
|
|
550
|
+
effect: {
|
|
551
|
+
field: "state",
|
|
552
|
+
value: "disarmed"
|
|
553
|
+
},
|
|
554
|
+
hold: { effects: [{
|
|
555
|
+
field: "state",
|
|
556
|
+
value: "disarming",
|
|
557
|
+
when: {
|
|
558
|
+
field: "state",
|
|
559
|
+
notIn: ["disarmed"]
|
|
560
|
+
}
|
|
561
|
+
}] },
|
|
562
|
+
openArgs: [{
|
|
563
|
+
key: "code",
|
|
564
|
+
label: /* @__PURE__ */ require_l10n.t("PIN code", "Codice PIN"),
|
|
565
|
+
offer: {
|
|
566
|
+
kind: "text",
|
|
567
|
+
secret: true
|
|
568
|
+
},
|
|
569
|
+
optional: true
|
|
570
|
+
}]
|
|
571
|
+
}]
|
|
572
|
+
}),
|
|
573
|
+
arm: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
574
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
575
|
+
mode: AlarmArmModeSchema,
|
|
576
|
+
/** Optional PIN code. Required when `codeRequired === true`.
|
|
577
|
+
* Passed through to the upstream service; never persisted. */
|
|
578
|
+
code: /* @__PURE__ */ zod.z.string().min(1).optional()
|
|
579
|
+
}), /* @__PURE__ */ zod.z.void(), {
|
|
580
|
+
kind: "mutation",
|
|
581
|
+
auth: "protected",
|
|
582
|
+
actions: [
|
|
583
|
+
{
|
|
584
|
+
id: "alarm.arm.home",
|
|
585
|
+
label: /* @__PURE__ */ require_l10n.t("Arm home", "Inserisci in casa"),
|
|
586
|
+
phrase: /* @__PURE__ */ require_l10n.t("Arm {device} for home", "Inserisci {device} in modalità casa"),
|
|
587
|
+
icon: "house",
|
|
588
|
+
effect: {
|
|
589
|
+
field: "state",
|
|
590
|
+
value: "armed_home"
|
|
591
|
+
},
|
|
592
|
+
hold: { effects: [{
|
|
593
|
+
field: "state",
|
|
594
|
+
value: "arming",
|
|
595
|
+
when: {
|
|
596
|
+
field: "state",
|
|
597
|
+
notIn: ["armed_home"]
|
|
598
|
+
}
|
|
599
|
+
}] },
|
|
600
|
+
args: { mode: "home" },
|
|
601
|
+
openArgs: [{
|
|
602
|
+
key: "code",
|
|
603
|
+
label: /* @__PURE__ */ require_l10n.t("PIN code", "Codice PIN"),
|
|
604
|
+
offer: {
|
|
605
|
+
kind: "text",
|
|
606
|
+
secret: true
|
|
607
|
+
},
|
|
608
|
+
optional: true
|
|
609
|
+
}]
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
id: "alarm.arm.away",
|
|
613
|
+
label: /* @__PURE__ */ require_l10n.t("Arm away", "Inserisci fuori casa"),
|
|
614
|
+
phrase: /* @__PURE__ */ require_l10n.t("Arm {device} for away", "Inserisci {device} in modalità fuori casa"),
|
|
615
|
+
icon: "shield-check",
|
|
616
|
+
effect: {
|
|
617
|
+
field: "state",
|
|
618
|
+
value: "armed_away"
|
|
619
|
+
},
|
|
620
|
+
hold: { effects: [{
|
|
621
|
+
field: "state",
|
|
622
|
+
value: "arming",
|
|
623
|
+
when: {
|
|
624
|
+
field: "state",
|
|
625
|
+
notIn: ["armed_away"]
|
|
626
|
+
}
|
|
627
|
+
}] },
|
|
628
|
+
args: { mode: "away" },
|
|
629
|
+
openArgs: [{
|
|
630
|
+
key: "code",
|
|
631
|
+
label: /* @__PURE__ */ require_l10n.t("PIN code", "Codice PIN"),
|
|
632
|
+
offer: {
|
|
633
|
+
kind: "text",
|
|
634
|
+
secret: true
|
|
635
|
+
},
|
|
636
|
+
optional: true
|
|
637
|
+
}]
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
id: "alarm.arm.night",
|
|
641
|
+
label: /* @__PURE__ */ require_l10n.t("Arm night", "Inserisci notte"),
|
|
642
|
+
phrase: /* @__PURE__ */ require_l10n.t("Arm {device} for the night", "Inserisci {device} in modalità notte"),
|
|
643
|
+
icon: "moon",
|
|
644
|
+
effect: {
|
|
645
|
+
field: "state",
|
|
646
|
+
value: "armed_night"
|
|
647
|
+
},
|
|
648
|
+
hold: { effects: [{
|
|
649
|
+
field: "state",
|
|
650
|
+
value: "arming",
|
|
651
|
+
when: {
|
|
652
|
+
field: "state",
|
|
653
|
+
notIn: ["armed_night"]
|
|
654
|
+
}
|
|
655
|
+
}] },
|
|
656
|
+
args: { mode: "night" },
|
|
657
|
+
openArgs: [{
|
|
658
|
+
key: "code",
|
|
659
|
+
label: /* @__PURE__ */ require_l10n.t("PIN code", "Codice PIN"),
|
|
660
|
+
offer: {
|
|
661
|
+
kind: "text",
|
|
662
|
+
secret: true
|
|
663
|
+
},
|
|
664
|
+
optional: true
|
|
665
|
+
}]
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
id: "alarm.arm.vacation",
|
|
669
|
+
label: /* @__PURE__ */ require_l10n.t("Arm vacation", "Inserisci vacanza"),
|
|
670
|
+
phrase: /* @__PURE__ */ require_l10n.t("Arm {device} for vacation", "Inserisci {device} in modalità vacanza"),
|
|
671
|
+
icon: "plane",
|
|
672
|
+
effect: {
|
|
673
|
+
field: "state",
|
|
674
|
+
value: "armed_vacation"
|
|
675
|
+
},
|
|
676
|
+
hold: { effects: [{
|
|
677
|
+
field: "state",
|
|
678
|
+
value: "arming",
|
|
679
|
+
when: {
|
|
680
|
+
field: "state",
|
|
681
|
+
notIn: ["armed_vacation"]
|
|
682
|
+
}
|
|
683
|
+
}] },
|
|
684
|
+
args: { mode: "vacation" },
|
|
685
|
+
openArgs: [{
|
|
686
|
+
key: "code",
|
|
687
|
+
label: /* @__PURE__ */ require_l10n.t("PIN code", "Codice PIN"),
|
|
688
|
+
offer: {
|
|
689
|
+
kind: "text",
|
|
690
|
+
secret: true
|
|
691
|
+
},
|
|
692
|
+
optional: true
|
|
693
|
+
}]
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
id: "alarm.arm.custom_bypass",
|
|
697
|
+
label: /* @__PURE__ */ require_l10n.t("Arm custom bypass", "Inserisci con esclusioni"),
|
|
698
|
+
phrase: /* @__PURE__ */ require_l10n.t("Arm {device} with its custom bypass", "Inserisci {device} con le zone escluse"),
|
|
699
|
+
icon: "shield-half",
|
|
700
|
+
effect: {
|
|
701
|
+
field: "state",
|
|
702
|
+
value: "armed_custom_bypass"
|
|
703
|
+
},
|
|
704
|
+
hold: { effects: [{
|
|
705
|
+
field: "state",
|
|
706
|
+
value: "arming",
|
|
707
|
+
when: {
|
|
708
|
+
field: "state",
|
|
709
|
+
notIn: ["armed_custom_bypass"]
|
|
710
|
+
}
|
|
711
|
+
}] },
|
|
712
|
+
args: { mode: "custom_bypass" },
|
|
713
|
+
openArgs: [{
|
|
714
|
+
key: "code",
|
|
715
|
+
label: /* @__PURE__ */ require_l10n.t("PIN code", "Codice PIN"),
|
|
716
|
+
offer: {
|
|
717
|
+
kind: "text",
|
|
718
|
+
secret: true
|
|
719
|
+
},
|
|
720
|
+
optional: true
|
|
721
|
+
}]
|
|
722
|
+
}
|
|
723
|
+
]
|
|
724
|
+
})
|
|
725
|
+
},
|
|
726
|
+
status: {
|
|
727
|
+
schema: AlarmPanelStatusSchema,
|
|
728
|
+
kind: "push"
|
|
729
|
+
},
|
|
730
|
+
/**
|
|
731
|
+
* Runtime-state slice — mirrored by the kernel. UI panel reads the
|
|
732
|
+
* full slice; renders an arm button per `availableModes` entry and
|
|
733
|
+
* a PIN field iff `codeRequired === true`.
|
|
734
|
+
*/
|
|
735
|
+
runtimeState: AlarmPanelStatusSchema,
|
|
736
|
+
/**
|
|
737
|
+
* Runtime-state durability: **restored** — armed state is the one thing a panel must not lose across a restart.
|
|
738
|
+
*
|
|
739
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
740
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
741
|
+
*/
|
|
742
|
+
durability: "restored",
|
|
743
|
+
/**
|
|
744
|
+
* A slice persisted before #459 carries `requiresCode`; the boot seed reads it
|
|
745
|
+
* once into `codeRequired` (`restoredPart`), so no reader meets the old key,
|
|
746
|
+
* and rewrites the row once without it (`seedMirrorFromRow`) — so this entry
|
|
747
|
+
* can be dropped after every node has booted once on a release that has it.
|
|
748
|
+
*/
|
|
749
|
+
restoredFieldRenames: { requiresCode: "codeRequired" },
|
|
750
|
+
/**
|
|
751
|
+
* History (D850): the panel's lifecycle state as an `enum` series —
|
|
752
|
+
* change-only, no floor, so an `arming -> pending -> triggered` sequence of a
|
|
753
|
+
* few seconds keeps every step. Who armed it stays in the events ledger.
|
|
754
|
+
*/
|
|
755
|
+
history: { fields: { state: { kind: "enum" } } },
|
|
756
|
+
/** Clock fields: written, but excluded from the compare that decides
|
|
757
|
+
* whether persisting is worth a SQLite commit. */
|
|
758
|
+
volatileStateFields: ["lastChangedAt"],
|
|
759
|
+
vocabulary: {
|
|
760
|
+
noun: /* @__PURE__ */ require_l10n.t("Alarm panel", "Centrale d’allarme"),
|
|
761
|
+
order: 1120,
|
|
762
|
+
state: [{
|
|
763
|
+
kind: "enum",
|
|
764
|
+
field: "state",
|
|
765
|
+
label: /* @__PURE__ */ require_l10n.t("Alarm state", "Stato dell’allarme"),
|
|
766
|
+
values: [
|
|
767
|
+
{
|
|
768
|
+
value: "disarmed",
|
|
769
|
+
label: /* @__PURE__ */ require_l10n.t("Disarmed", "Disinserito"),
|
|
770
|
+
phrase: /* @__PURE__ */ require_l10n.t("When {device} is disarmed", "Quando {device} viene disinserito")
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
value: "armed_home",
|
|
774
|
+
label: /* @__PURE__ */ require_l10n.t("Armed home", "Inserito in casa"),
|
|
775
|
+
phrase: /* @__PURE__ */ require_l10n.t("When {device} is armed for home", "Quando {device} viene inserito in modalità casa")
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
value: "armed_away",
|
|
779
|
+
label: /* @__PURE__ */ require_l10n.t("Armed away", "Inserito fuori casa"),
|
|
780
|
+
phrase: /* @__PURE__ */ require_l10n.t("When {device} is armed for away", "Quando {device} viene inserito in modalità fuori casa")
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
value: "armed_night",
|
|
784
|
+
label: /* @__PURE__ */ require_l10n.t("Armed night", "Inserito notte"),
|
|
785
|
+
phrase: /* @__PURE__ */ require_l10n.t("When {device} is armed for the night", "Quando {device} viene inserito in modalità notte")
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
value: "armed_vacation",
|
|
789
|
+
label: /* @__PURE__ */ require_l10n.t("Armed vacation", "Inserito vacanza")
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
value: "armed_custom_bypass",
|
|
793
|
+
label: /* @__PURE__ */ require_l10n.t("Armed with bypass", "Inserito con esclusioni")
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
value: "arming",
|
|
797
|
+
label: /* @__PURE__ */ require_l10n.t("Arming", "In inserimento")
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
value: "disarming",
|
|
801
|
+
label: /* @__PURE__ */ require_l10n.t("Disarming", "In disinserimento")
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
value: "pending",
|
|
805
|
+
label: /* @__PURE__ */ require_l10n.t("Entry delay", "Ritardo d’ingresso")
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
value: "triggered",
|
|
809
|
+
label: /* @__PURE__ */ require_l10n.t("Triggered", "In allarme"),
|
|
810
|
+
phrase: /* @__PURE__ */ require_l10n.t("When {device} goes off", "Quando {device} scatta")
|
|
811
|
+
}
|
|
812
|
+
],
|
|
813
|
+
icon: "shield"
|
|
814
|
+
}]
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
//#endregion
|
|
818
|
+
//#region ../types/dist/esm/catalogs/nc-taxonomy.mjs
|
|
819
|
+
/**
|
|
820
|
+
* Notification-Center taxonomy — the fixed vocabulary the NC rule editor
|
|
821
|
+
* offers as pickers instead of free text. Derived (never hand-listed) from the
|
|
822
|
+
* single `EVENT_TAXONOMY` dictionary so it stays in lockstep with every other
|
|
823
|
+
* taxonomy surface (timeline, filters, event page).
|
|
824
|
+
*
|
|
825
|
+
* Three buckets, mapped onto the rule editor's `stringList` conditions:
|
|
826
|
+
* - `videoClasses` → detection classes (person / vehicle / animal + subs)
|
|
827
|
+
* for the `classes` / `classesExclude` conditions.
|
|
828
|
+
* - `audioKinds` → audio-analyzer sub kinds (`audio-scream`, …) shown in
|
|
829
|
+
* the same class picker, grouped under an Audio header.
|
|
830
|
+
* - `labels` → sensor + control taxonomy kinds (doorbell / contact /
|
|
831
|
+
* lock / …) for the `sensorKinds` device-event condition.
|
|
832
|
+
*
|
|
833
|
+
* Each entry carries `parentKind` so the client can group video subs under
|
|
834
|
+
* their macro and sensor/control kinds under their category. This surface is
|
|
835
|
+
* served ADDITIVELY on the `nc.getConditionCatalog` bridge response — no cap
|
|
836
|
+
* method, no codegen — so it ships train-free with an addon deploy.
|
|
837
|
+
*/
|
|
838
|
+
/** One selectable taxonomy value: a stable kind id + display label + parent. */
|
|
839
|
+
var NcTaxonomyEntrySchema = /* @__PURE__ */ zod.z.object({
|
|
840
|
+
/** Stable kind id (e.g. 'person', 'car', 'audio-scream', 'doorbell'). */
|
|
841
|
+
kind: /* @__PURE__ */ zod.z.string(),
|
|
842
|
+
/** English fallback label (the UI translates via the event-kind i18n key). */
|
|
843
|
+
label: /* @__PURE__ */ zod.z.string(),
|
|
844
|
+
/** Macro/category parent for grouping ('car' → 'vehicle'); null for a top. */
|
|
845
|
+
parentKind: /* @__PURE__ */ zod.z.string().nullable()
|
|
846
|
+
});
|
|
847
|
+
/** The complete NC picker taxonomy — three grouped buckets. */
|
|
848
|
+
var NcTaxonomySchema = /* @__PURE__ */ zod.z.object({
|
|
849
|
+
videoClasses: /* @__PURE__ */ zod.z.array(NcTaxonomyEntrySchema),
|
|
850
|
+
audioKinds: /* @__PURE__ */ zod.z.array(NcTaxonomyEntrySchema),
|
|
851
|
+
labels: /* @__PURE__ */ zod.z.array(NcTaxonomyEntrySchema)
|
|
852
|
+
});
|
|
853
|
+
//#endregion
|
|
854
|
+
//#region ../types/dist/esm/capabilities/notification-rules.cap.mjs
|
|
855
|
+
/**
|
|
856
|
+
* notification-rules — the Notification Center rule surface (P1 core).
|
|
857
|
+
*
|
|
858
|
+
* Spec: `docs/superpowers/specs/2026-07-22-notification-center-requirements.md`
|
|
859
|
+
* (operator decisions D-1/D-2/D-3 are binding):
|
|
860
|
+
*
|
|
861
|
+
* - D-2: rule EVALUATION lives in `addon-post-analysis` (the
|
|
862
|
+
* `notification-center` module), hooked on the durable persistence
|
|
863
|
+
* moments (object-event insert, TrackCloser.closeExpired) with a
|
|
864
|
+
* persisted outbox + retry — never the lossy telemetry bus (D8).
|
|
865
|
+
* - D-3: urgency belongs to the RULE. `delivery: 'immediate'` fires on the
|
|
866
|
+
* FIRST persisted detection matching the conditions (per-track dedup,
|
|
867
|
+
* `maxPerTrack` fixed at 1 — see {@link NC_MAX_PER_TRACK_IMMEDIATE});
|
|
868
|
+
* `delivery: 'track-end'` evaluates the finalized track record at close.
|
|
869
|
+
* - DISPATCH stays behind `notification-output` (rules reference targets
|
|
870
|
+
* by id; per-backend params are a passthrough blob capped by the
|
|
871
|
+
* target kind's own caps/degrade engine).
|
|
872
|
+
*
|
|
873
|
+
* P1 scope: admin-authored rules only (`createdBy` stamped from the
|
|
874
|
+
* server-injected caller identity — the first `caller: 'required'`
|
|
875
|
+
* adopter). The P1 condition subset is: devices, classes(+exclude),
|
|
876
|
+
* minConfidence, admin zones (any/all + exclude), weekly schedule
|
|
877
|
+
* windows, and the optional label/identity/plate matchers. User rules,
|
|
878
|
+
* private zones, per-recipient fan-out and the wider condition table are
|
|
879
|
+
* P2+ (see spec §7).
|
|
880
|
+
*
|
|
881
|
+
* All schemas here are the single source of truth — `NcRule` etc. are
|
|
882
|
+
* `z.infer` exports; no duplicate interfaces (the advanced-notifier
|
|
883
|
+
* schema/interface drift is explicitly not repeated).
|
|
884
|
+
*/
|
|
885
|
+
/**
|
|
886
|
+
* D-3: the trigger/urgency of a rule — which persistence moment evaluates it.
|
|
887
|
+
* The value maps 1:1 onto the evaluated record kind:
|
|
888
|
+
* - `immediate` ↔ object-event persist (lowest-latency detection burst)
|
|
889
|
+
* - `track-end` ↔ TrackCloser.closeExpired (finalized track record)
|
|
890
|
+
* - `device-event` ↔ SensorEventStore insert (doorbell press / sensor state
|
|
891
|
+
* change of a LINKED device, one row per linked camera)
|
|
892
|
+
* - `package-event` ↔ PackageDropDetector object-event insert (a `package`
|
|
893
|
+
* delivery / pick-up)
|
|
894
|
+
*
|
|
895
|
+
* `immediate`/`track-end` carry the D-3 urgency semantics; `device-event`/
|
|
896
|
+
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
897
|
+
* this one field keeps the schema additive — a rule still declares exactly
|
|
898
|
+
* one trigger.
|
|
899
|
+
*
|
|
900
|
+
* AUDIO rules add no member here, for the reason occupancy added none: the
|
|
901
|
+
* enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
|
|
902
|
+
* mirror.ts` fails the build on a member the app cannot render) and every
|
|
903
|
+
* member costs a release train. A sustained-sound rule is therefore an
|
|
904
|
+
* `immediate` rule carrying {@link NcConditions.audio} — the condition is the
|
|
905
|
+
* trigger discriminator, exactly as `occupancy` is on `device-event`.
|
|
906
|
+
*/
|
|
907
|
+
var NcDeliverySchema = /* @__PURE__ */ zod.z.enum([
|
|
908
|
+
"immediate",
|
|
909
|
+
"track-end",
|
|
910
|
+
"device-event",
|
|
911
|
+
"package-event",
|
|
912
|
+
"system-event"
|
|
913
|
+
]);
|
|
914
|
+
/**
|
|
915
|
+
* Stable Notification Center vocabulary over infrastructure/liveness events.
|
|
916
|
+
* Bus categories are normalized into these intent-level kinds so rules do not
|
|
917
|
+
* depend on a provider's raw event name or payload shape.
|
|
918
|
+
*/
|
|
919
|
+
var NcSystemEventKindSchema = /* @__PURE__ */ zod.z.enum([
|
|
920
|
+
"device-online",
|
|
921
|
+
"device-offline",
|
|
922
|
+
"device-disabled",
|
|
923
|
+
"device-enabled",
|
|
924
|
+
"device-battery-low",
|
|
925
|
+
"device-battery-normal",
|
|
926
|
+
"device-consumable-low",
|
|
927
|
+
"device-consumable-normal",
|
|
928
|
+
"stream-online",
|
|
929
|
+
"stream-offline",
|
|
930
|
+
"node-online",
|
|
931
|
+
"node-offline",
|
|
932
|
+
"node-restarting",
|
|
933
|
+
"node-updating",
|
|
934
|
+
"node-inference-unavailable",
|
|
935
|
+
"detection-blind",
|
|
936
|
+
"motion-noisy",
|
|
937
|
+
"motion-calm",
|
|
938
|
+
"package-llm-silent",
|
|
939
|
+
"package-llm-answered",
|
|
940
|
+
"recording-stalled",
|
|
941
|
+
"recording-healthy",
|
|
942
|
+
"recording-degraded",
|
|
943
|
+
"device-attention-required",
|
|
944
|
+
"device-attention-resolved",
|
|
945
|
+
"device-command",
|
|
946
|
+
"storage-location-low",
|
|
947
|
+
"storage-location-critical",
|
|
948
|
+
"storage-location-ok",
|
|
949
|
+
"storage-drain-progress",
|
|
950
|
+
"storage-drain-complete",
|
|
951
|
+
"addon-crash-loop",
|
|
952
|
+
"addon-update-available",
|
|
953
|
+
"server-update-available",
|
|
954
|
+
"wrapper-update-available",
|
|
955
|
+
"alarm-triggered",
|
|
956
|
+
"alarm-armed",
|
|
957
|
+
"alarm-disarmed",
|
|
958
|
+
"alarm-arming",
|
|
959
|
+
"alarm-arm-refused",
|
|
960
|
+
"alarm-pending",
|
|
961
|
+
"alarm-rearmed",
|
|
962
|
+
"alarm-sensor-bypass",
|
|
963
|
+
"alarm-check-failed",
|
|
964
|
+
"addon-updated",
|
|
965
|
+
"server-updated",
|
|
966
|
+
"export-completed",
|
|
967
|
+
"backup-completed",
|
|
968
|
+
"alert-critical",
|
|
969
|
+
"alert-error",
|
|
970
|
+
"alert-critical-resolved",
|
|
971
|
+
"rule-broken",
|
|
972
|
+
"rule-repaired",
|
|
973
|
+
"camera-online",
|
|
974
|
+
"camera-offline",
|
|
975
|
+
"camera-disabled",
|
|
976
|
+
"camera-enabled"
|
|
977
|
+
]);
|
|
978
|
+
var NcSystemEventConditionSchema = /* @__PURE__ */ zod.z.object({
|
|
979
|
+
kinds: /* @__PURE__ */ zod.z.array(NcSystemEventKindSchema).min(1),
|
|
980
|
+
deviceIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int()).min(1).optional(),
|
|
981
|
+
/**
|
|
982
|
+
* Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
|
|
983
|
+
* `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
|
|
984
|
+
* is what a liveness rule means when nobody said otherwise.
|
|
985
|
+
*
|
|
986
|
+
* This is where "only my cameras" is expressed, and it lives on the rule for
|
|
987
|
+
* one reason: the intake cannot know which devices this household cares
|
|
988
|
+
* about, and a producer-side filter is one no operator can change. Fails
|
|
989
|
+
* CLOSED — a subject whose device type is unknown (an id the device mirror
|
|
990
|
+
* does not carry) matches no `deviceTypes` list.
|
|
991
|
+
*/
|
|
992
|
+
deviceTypes: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).min(1).optional(),
|
|
993
|
+
/**
|
|
994
|
+
* Devices this rule NEVER speaks about, whatever else matched. Scoped to the
|
|
995
|
+
* same kind family as `deviceIds` (`systemEventFilterApplies(kind,
|
|
996
|
+
* 'deviceIds')`) and applied AFTER it: include first, then exclude. A
|
|
997
|
+
* consumable subject (`consumable:<id>:<key>`) is excluded by its device id.
|
|
998
|
+
*
|
|
999
|
+
* It never fails closed: a subject that carries no device id is not in the
|
|
1000
|
+
* list, so it is not excluded. "Every battery except the one thermometer that
|
|
1001
|
+
* reads 0 % forever" is the question this answers — expressed as an include
|
|
1002
|
+
* list it would have to name every other battery device, and every device
|
|
1003
|
+
* adopted later would be silently left out (D636).
|
|
1004
|
+
*/
|
|
1005
|
+
excludeDeviceIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int()).min(1).optional(),
|
|
1006
|
+
nodeIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).min(1).optional(),
|
|
1007
|
+
packageNames: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).min(1).optional(),
|
|
1008
|
+
/**
|
|
1009
|
+
* `device-command` only: the vocabulary ACTION IDS (D983, `powerSource.forceRestart`)
|
|
1010
|
+
* this rule speaks about - the same dictionary the automation action blocks
|
|
1011
|
+
* pick from. The hub refuses an id the action index does not know.
|
|
1012
|
+
*/
|
|
1013
|
+
commandActions: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).min(1).optional(),
|
|
1014
|
+
/**
|
|
1015
|
+
* `device-attention-*` only: the fault CODES this rule speaks about (the
|
|
1016
|
+
* integration declares them through `error.listFaultTypes`; free text is
|
|
1017
|
+
* accepted too). Absent or empty = any fault. The rule matches when any
|
|
1018
|
+
* fault of the episode is in the list.
|
|
1019
|
+
*/
|
|
1020
|
+
faultCodes: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
|
|
1021
|
+
/** `device-command` only: how the command settled. A device's own change is not a command. */
|
|
1022
|
+
commandOutcomes: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.enum([
|
|
1023
|
+
"confirmed",
|
|
1024
|
+
"already",
|
|
1025
|
+
"unconfirmed",
|
|
1026
|
+
"failed"
|
|
1027
|
+
])).min(1).optional(),
|
|
1028
|
+
/** `device-command` only: who asked (`user`, `addon`, `action`, `scheduler`, `composition`, `node`). */
|
|
1029
|
+
commandActorKinds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.enum([
|
|
1030
|
+
"user",
|
|
1031
|
+
"addon",
|
|
1032
|
+
"action",
|
|
1033
|
+
"scheduler",
|
|
1034
|
+
"composition",
|
|
1035
|
+
"node"
|
|
1036
|
+
])).min(1).optional(),
|
|
1037
|
+
/**
|
|
1038
|
+
* At or below this remaining-life %, a consumable is LOW for THIS rule
|
|
1039
|
+
* (D642). Absent = {@link NC_CONSUMABLE_LOW_PERCENT_DEFAULT}; at most
|
|
1040
|
+
* {@link NC_CONSUMABLE_LOW_PERCENT_MAX}, so every episode can recover. Scoped to the
|
|
1041
|
+
* consumable kinds (`systemEventFilterApplies`) and to the device-events
|
|
1042
|
+
* family; ignored on every other kind.
|
|
1043
|
+
*
|
|
1044
|
+
* It is a property of the RULE because the operator decided so: a rule at
|
|
1045
|
+
* 25 must be told about a filter at 20 %, a rule at 10 must not. The hub
|
|
1046
|
+
* keeps one episode per (threshold, device, item) — its own hysteresis, its
|
|
1047
|
+
* own reminder — and a rule hears only the episode judged at ITS threshold,
|
|
1048
|
+
* exactly as an occupancy rule hears only the edge of its own count. A
|
|
1049
|
+
* provider's own `replace` verdict is low at every threshold.
|
|
1050
|
+
*/
|
|
1051
|
+
consumableLowPercent: /* @__PURE__ */ zod.z.number().int().min(1).max(95).optional()
|
|
1052
|
+
});
|
|
1053
|
+
/** Hard ceiling on a window (24h). A snooze that could not expire would be an
|
|
1054
|
+
* outage the operator asked for once and forgot. */
|
|
1055
|
+
var NC_SNOOZE_MAX_MINUTES = 1440;
|
|
1056
|
+
/** One weekly activation window. `startMinute > endMinute` crosses midnight. */
|
|
1057
|
+
var NcScheduleWindowSchema = /* @__PURE__ */ zod.z.object({
|
|
1058
|
+
/** Days of week the window STARTS on (0 = Sunday … 6 = Saturday). */
|
|
1059
|
+
days: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int().min(0).max(6)).min(1),
|
|
1060
|
+
startMinute: /* @__PURE__ */ zod.z.number().int().min(0).max(1439),
|
|
1061
|
+
endMinute: /* @__PURE__ */ zod.z.number().int().min(0).max(1439)
|
|
1062
|
+
});
|
|
1063
|
+
/** Weekly schedule — OR of windows; absence on the rule = always active. */
|
|
1064
|
+
var NcScheduleSchema = /* @__PURE__ */ zod.z.object({
|
|
1065
|
+
windows: /* @__PURE__ */ zod.z.array(NcScheduleWindowSchema).min(1),
|
|
1066
|
+
/** IANA timezone; default = hub host timezone. */
|
|
1067
|
+
timezone: /* @__PURE__ */ zod.z.string().optional(),
|
|
1068
|
+
/** Active OUTSIDE the windows (e.g. "only outside business hours"). */
|
|
1069
|
+
invert: /* @__PURE__ */ zod.z.boolean().optional()
|
|
1070
|
+
});
|
|
1071
|
+
/**
|
|
1072
|
+
* How a system-event rule of the `device-events` or `system` family speaks
|
|
1073
|
+
* (D647): at once, per event (`instant`, the only behaviour before D647), or
|
|
1074
|
+
* as a STATE SUMMARY at the end of each window of `schedule`.
|
|
1075
|
+
*/
|
|
1076
|
+
var NcSystemEventDeliveryModeSchema = /* @__PURE__ */ zod.z.enum(["instant", "summary"]);
|
|
1077
|
+
/**
|
|
1078
|
+
* How a summary window is SENT (D698): `rule` (absent) = ONE notification with
|
|
1079
|
+
* every section; `section` = one notification per section with something to
|
|
1080
|
+
* say (an unavailable section included), each titled by its section.
|
|
1081
|
+
*/
|
|
1082
|
+
var NcStateSummarySplitSchema = /* @__PURE__ */ zod.z.enum(["rule", "section"]);
|
|
1083
|
+
/**
|
|
1084
|
+
* `summary`: the rule sends NOTHING per event. When a window of `schedule`
|
|
1085
|
+
* CLOSES, it sends one notification with the current state of its kinds
|
|
1086
|
+
* (low batteries, consumables to replace, devices offline, updates
|
|
1087
|
+
* available, ...), after its own filters — or, with `split: 'section'`
|
|
1088
|
+
* (D698), one notification per section. Nothing to report sends nothing.
|
|
1089
|
+
* The schedule is the ordinary `NcSchedule` (weekly windows, IANA timezone,
|
|
1090
|
+
* midnight crossing); the send time is each window's END. Refused on the
|
|
1091
|
+
* `alarm` family, which stays instant (`systemEventDeliveryProblems`).
|
|
1092
|
+
*/
|
|
1093
|
+
var NcSystemEventDeliverySchema = /* @__PURE__ */ zod.z.discriminatedUnion("mode", [
|
|
1094
|
+
/* @__PURE__ */ zod.z.object({ mode: /* @__PURE__ */ zod.z.literal("instant") }),
|
|
1095
|
+
/* @__PURE__ */ zod.z.object({
|
|
1096
|
+
mode: /* @__PURE__ */ zod.z.literal("summary"),
|
|
1097
|
+
schedule: NcScheduleSchema,
|
|
1098
|
+
split: /* @__PURE__ */ NcStateSummarySplitSchema.optional()
|
|
1099
|
+
}),
|
|
1100
|
+
/* @__PURE__ */ zod.z.object({
|
|
1101
|
+
mode: /* @__PURE__ */ zod.z.literal("modes"),
|
|
1102
|
+
/** The bad edge, and every kind that has a single edge. */
|
|
1103
|
+
onActivation: /* @__PURE__ */ zod.z.boolean(),
|
|
1104
|
+
/** The recovery edges of the classes of the selected kinds (derived, never stored per kind). */
|
|
1105
|
+
onDeactivation: /* @__PURE__ */ zod.z.boolean(),
|
|
1106
|
+
/** A state summary at the end of each window; absent = no summary. */
|
|
1107
|
+
onSchedule: /* @__PURE__ */ zod.z.object({
|
|
1108
|
+
schedule: NcScheduleSchema,
|
|
1109
|
+
grouping: NcStateSummarySplitSchema
|
|
1110
|
+
}).optional()
|
|
1111
|
+
})
|
|
1112
|
+
]);
|
|
1113
|
+
/** Fuzzy plate matcher — OCR noise makes exact match useless (spec row 12/13). */
|
|
1114
|
+
var NcPlateMatcherSchema = /* @__PURE__ */ zod.z.object({
|
|
1115
|
+
/**
|
|
1116
|
+
* Plate texts (or gallery vehicle names) to match. EMPTY = **any plate the
|
|
1117
|
+
* pipeline could read** — the plate half of "no selection = no narrowing",
|
|
1118
|
+
* and the switch that says this rule is about vehicles that were IDENTIFIED
|
|
1119
|
+
* rather than merely seen. A subject carrying no plate still fails.
|
|
1120
|
+
*
|
|
1121
|
+
* The `.min(1)` this used to carry made that state unauthorable; nothing has
|
|
1122
|
+
* ever persisted an empty list, so widening it cannot change an existing rule.
|
|
1123
|
+
*/
|
|
1124
|
+
values: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)),
|
|
1125
|
+
/** Max Levenshtein distance after normalization (uppercase alphanumeric). */
|
|
1126
|
+
maxDistance: /* @__PURE__ */ zod.z.number().int().min(0).max(3).default(1)
|
|
1127
|
+
});
|
|
1128
|
+
/**
|
|
1129
|
+
* Occupancy condition (DEVICE-EVENT trigger). Fires on a ZoneAnalytics
|
|
1130
|
+
* occupancy edge for a device — optionally narrowed to a single admin
|
|
1131
|
+
* `zoneId` and/or object `className`. `op` selects the edge/threshold:
|
|
1132
|
+
* - `became-occupied` (default) — count crossed 0 → ≥ `count`
|
|
1133
|
+
* - `became-free` — count crossed ≥ `count` → below it
|
|
1134
|
+
* - `>=` / `<=` — count is at/over or at/under `count`
|
|
1135
|
+
* `sustainSeconds` requires the condition hold continuously that long
|
|
1136
|
+
* before firing (debounces flicker; 0 = fire on the first matching edge).
|
|
1137
|
+
* Fail-closed: no ZoneAnalytics snapshot / missing zone / null snapshot ⇒
|
|
1138
|
+
* the condition never matches. Confirmed edge-state survives addon restarts
|
|
1139
|
+
* (declared SQLite collection, reseeded on boot).
|
|
1140
|
+
*/
|
|
1141
|
+
var NcOccupancyConditionSchema = /* @__PURE__ */ zod.z.object({
|
|
1142
|
+
/** Admin zone id to scope the count to; absent = whole-frame occupancy. */
|
|
1143
|
+
zoneId: /* @__PURE__ */ zod.z.string().optional(),
|
|
1144
|
+
/** Object class to count; absent = any class. */
|
|
1145
|
+
className: /* @__PURE__ */ zod.z.string().optional(),
|
|
1146
|
+
op: /* @__PURE__ */ zod.z.enum([
|
|
1147
|
+
"became-occupied",
|
|
1148
|
+
"became-free",
|
|
1149
|
+
">=",
|
|
1150
|
+
"<="
|
|
1151
|
+
]).default("became-occupied"),
|
|
1152
|
+
count: /* @__PURE__ */ zod.z.number().int().min(0).default(1),
|
|
1153
|
+
sustainSeconds: /* @__PURE__ */ zod.z.number().int().min(0).max(3600).default(15)
|
|
1154
|
+
});
|
|
1155
|
+
/**
|
|
1156
|
+
* Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
|
|
1157
|
+
*
|
|
1158
|
+
* **TWO EXCLUSIVE MODES** (operator decision 2026-08-14, D157). Which one a
|
|
1159
|
+
* rule is in is not a stored field — it is WHICH FILTER the rule carries, so
|
|
1160
|
+
* there is no second switch that can disagree with the first and every rule
|
|
1161
|
+
* authored before the decision migrates for free (`audioModeOf`):
|
|
1162
|
+
*
|
|
1163
|
+
* - **LABEL mode — `labels` present.** The rule fires when `confirmHits`
|
|
1164
|
+
* labelled frames land inside `confirmWindowSec` (default 2 in 5 s).
|
|
1165
|
+
* `hitPercent` and `samplingSeconds` are still ignored — a percentage of
|
|
1166
|
+
* frames is the wrong question for a classifier that labels 1–3 frames
|
|
1167
|
+
* per episode. The count window is the brake that drops a single-frame
|
|
1168
|
+
* false positive; the rule's own `throttle` cooldown is the other. The
|
|
1169
|
+
* per-label confidence floor is the analyzer's (`classificationMinScore`,
|
|
1170
|
+
* per device) — a label only reaches this condition if the classifier was
|
|
1171
|
+
* already confident enough. `confirmHits: 1` restores first-frame fire.
|
|
1172
|
+
* - **LEVEL mode — `dbThreshold` present, no labels.** The sampling window IS
|
|
1173
|
+
* the condition: at least `hitPercent`% of the samples over
|
|
1174
|
+
* `samplingSeconds` must be at or above `dbThreshold` dBFS (see
|
|
1175
|
+
* {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale). The window
|
|
1176
|
+
* must be FULL before it can match — a window open for two of its ten
|
|
1177
|
+
* seconds is 100% of nothing.
|
|
1178
|
+
*
|
|
1179
|
+
* **Why label mode has no window.** It had one, and it never fired: the
|
|
1180
|
+
* analyzer emits ~1 audio frame per second but YAMNet only LABELS one to three
|
|
1181
|
+
* of them per episode, even through continuous crying. The measured maximum
|
|
1182
|
+
* `hitPercent` over the whole live history was 40 — under the shipped default
|
|
1183
|
+
* of 60, so a label rule could not fire at all, ever. A percentage of frames is
|
|
1184
|
+
* the wrong question to ask of a sparse classifier.
|
|
1185
|
+
*
|
|
1186
|
+
* **Fail-closed when NEITHER is given** — every sample would be a trivial hit
|
|
1187
|
+
* and the rule would fire on silence. The schema cannot express "exactly one
|
|
1188
|
+
* of" without becoming a ZodEffects the cap path would have to special-case, so
|
|
1189
|
+
* the exclusivity is enforced where every editor writes (`patchAudio`) and a
|
|
1190
|
+
* legacy rule carrying both resolves to LABEL (the mode that fires).
|
|
1191
|
+
*
|
|
1192
|
+
* Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
|
|
1193
|
+
* `audio-*` ids). Both spellings are accepted — the matcher normalizes the
|
|
1194
|
+
* `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
|
|
1195
|
+
* an operator who typed `dog` mean the same thing.
|
|
1196
|
+
*/
|
|
1197
|
+
var NcAudioConditionSchema = /* @__PURE__ */ zod.z.object({
|
|
1198
|
+
/** LABEL MODE: audio macro labels. Present ⇒ count-in-window confirm. */
|
|
1199
|
+
labels: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).min(1).optional(),
|
|
1200
|
+
/** LEVEL MODE: floor in dBFS (negative-going, `0` = full scale). */
|
|
1201
|
+
dbThreshold: /* @__PURE__ */ zod.z.number().min(-96).max(0).optional(),
|
|
1202
|
+
/** LEVEL MODE ONLY: percentage of the window's samples that must be hits (1–100). */
|
|
1203
|
+
hitPercent: /* @__PURE__ */ zod.z.number().int().min(1).max(100).default(60),
|
|
1204
|
+
/** LEVEL MODE ONLY: length of the sampling window in seconds. */
|
|
1205
|
+
samplingSeconds: /* @__PURE__ */ zod.z.number().int().min(1).max(300).default(10),
|
|
1206
|
+
/**
|
|
1207
|
+
* LABEL MODE: how many labelled frames must land inside
|
|
1208
|
+
* {@link NcAudioConditionSchema.shape.confirmWindowSec} before dispatch.
|
|
1209
|
+
* Absent ⇒ 2 (the matcher default). `1` is first-frame fire.
|
|
1210
|
+
*/
|
|
1211
|
+
confirmHits: /* @__PURE__ */ zod.z.number().int().min(1).max(20).optional(),
|
|
1212
|
+
/** LABEL MODE: the window those frames must share, in seconds. Absent ⇒ 5. */
|
|
1213
|
+
confirmWindowSec: /* @__PURE__ */ zod.z.number().int().min(1).max(60).optional()
|
|
1214
|
+
});
|
|
1215
|
+
/**
|
|
1216
|
+
* Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
|
|
1217
|
+
*
|
|
1218
|
+
* The values are not symmetric, and deliberately so — the absent value has to
|
|
1219
|
+
* mean exactly what every rule authored before this condition existed already
|
|
1220
|
+
* does:
|
|
1221
|
+
* - `enter` — entries and every NON-crossing record (movement state,
|
|
1222
|
+
* package, sensor). Exits are rejected. **This is the absent behaviour**:
|
|
1223
|
+
* an operator who never asked for exits must not start receiving them.
|
|
1224
|
+
* - `exit` — ONLY an exit crossing. A record that is not a crossing at all
|
|
1225
|
+
* fails closed, because "the car left the drive" is a question about a
|
|
1226
|
+
* boundary, not about a detection.
|
|
1227
|
+
* - `any` — no direction filter; entries, exits and non-crossings alike.
|
|
1228
|
+
*
|
|
1229
|
+
* A rule asking for a direction should normally also scope `zones`, which the
|
|
1230
|
+
* engine evaluates against the crossed zone as well as the current membership
|
|
1231
|
+
* (an exit's membership no longer contains the zone it just left).
|
|
1232
|
+
*/
|
|
1233
|
+
var NcCrossingSchema = /* @__PURE__ */ zod.z.enum([
|
|
1234
|
+
"enter",
|
|
1235
|
+
"exit",
|
|
1236
|
+
"any"
|
|
1237
|
+
]);
|
|
1238
|
+
/**
|
|
1239
|
+
* Which edge of a BOOLEAN sensor fires a device-event rule (D640).
|
|
1240
|
+
* - `raised` — the sensor went high: water detected, smoke, open, tampered.
|
|
1241
|
+
* - `cleared` — it went back: dry, clear, closed.
|
|
1242
|
+
* - absent — both edges, which is what every rule authored before this did.
|
|
1243
|
+
*
|
|
1244
|
+
* There is no third member for "both": absence already says it, and a value
|
|
1245
|
+
* that means the same as absence is a second way to write one rule.
|
|
1246
|
+
*/
|
|
1247
|
+
var NcSensorTransitionSchema = /* @__PURE__ */ zod.z.enum(["raised", "cleared"]);
|
|
1248
|
+
/** Admin-zone membership condition (zone IDs as stamped by the ZoneEngine). */
|
|
1249
|
+
var NcZoneConditionSchema = /* @__PURE__ */ zod.z.object({
|
|
1250
|
+
ids: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).min(1),
|
|
1251
|
+
/**
|
|
1252
|
+
* LEGACY quantifier over `ids`. Absent = `any` (at least one visited), which
|
|
1253
|
+
* is what both editors mean and all they write since D690: "all of" was
|
|
1254
|
+
* removed from the editors because on an immediate rule it asked one
|
|
1255
|
+
* detection to stand in every zone at once. Still ACCEPTED, and `all` still
|
|
1256
|
+
* evaluated, so a stored rule keeps parsing and meaning what it meant.
|
|
1257
|
+
*/
|
|
1258
|
+
match: /* @__PURE__ */ zod.z.enum(["any", "all"]).optional()
|
|
1259
|
+
});
|
|
1260
|
+
/**
|
|
1261
|
+
* The P1 condition set — a flat AND of groups; absent group = pass;
|
|
1262
|
+
* membership lists are OR within the list (spec §2.3).
|
|
1263
|
+
*/
|
|
1264
|
+
/**
|
|
1265
|
+
* What a rule or a button runs: an **Action** of the `actions` surface
|
|
1266
|
+
* (`internal:<uuid>` or an addon's), by id, and nothing else (planning#473).
|
|
1267
|
+
*
|
|
1268
|
+
* The notification centre has no step vocabulary of its own. The steps, the
|
|
1269
|
+
* device-scope boundary, the stop-at-first-failure, the throttle
|
|
1270
|
+
* (`minDelaySec`), the variables and the runs ledger all belong to the Action;
|
|
1271
|
+
* an operator edits them in ONE place (the Actions page) and a rule points at
|
|
1272
|
+
* the result. A rule can be authored by a non-admin (personal rules), which is
|
|
1273
|
+
* safe for the same reason: it can only name an Action an admin already wrote.
|
|
1274
|
+
*/
|
|
1275
|
+
var NcActionIdSchema = /* @__PURE__ */ zod.z.string().min(1);
|
|
1276
|
+
/** Action ids one hook edge runs, in order. Capped so a slot never becomes a second editor. */
|
|
1277
|
+
var NcHookActionIdsSchema = /* @__PURE__ */ zod.z.array(NcActionIdSchema).max(4);
|
|
1278
|
+
/**
|
|
1279
|
+
* One button carried by the notification, running an Action on tap.
|
|
1280
|
+
*
|
|
1281
|
+
* **Read this before adding a button that does something physical.** The tap
|
|
1282
|
+
* arrives over a link that travelled through third-party infrastructure — ntfy,
|
|
1283
|
+
* a push relay, whatever forwarded the message — and the callback's ONLY
|
|
1284
|
+
* authority is the token in that link: single-use, short-lived, bound to this
|
|
1285
|
+
* one action of this one notification. It does not identify who tapped.
|
|
1286
|
+
* Whoever holds the notification can run the button, once, inside the window.
|
|
1287
|
+
* That is the operator's explicit choice (2026-08-05), and `destructive` is a
|
|
1288
|
+
* rendering hint, not a second gate. [D47](decisions/adr-0047.md).
|
|
1289
|
+
*/
|
|
1290
|
+
var NcRuleNotificationButtonSchema = /* @__PURE__ */ zod.z.object({
|
|
1291
|
+
/** Stable id — travels in the callback and identifies the button in logs. */
|
|
1292
|
+
id: /* @__PURE__ */ zod.z.string().min(1).max(64),
|
|
1293
|
+
label: /* @__PURE__ */ zod.z.string().min(1).max(40),
|
|
1294
|
+
/** The Action the tap runs. The dispatcher drops a button whose Action does
|
|
1295
|
+
* not exist rather than minting a token for nothing. */
|
|
1296
|
+
actionId: NcActionIdSchema,
|
|
1297
|
+
icon: /* @__PURE__ */ NotificationActionIconSchema.optional(),
|
|
1298
|
+
destructive: /* @__PURE__ */ zod.z.boolean().optional()
|
|
1299
|
+
});
|
|
1300
|
+
/**
|
|
1301
|
+
* What a rule runs, by hook edge.
|
|
1302
|
+
*
|
|
1303
|
+
* Each hook appears here only with an edge that produces it:
|
|
1304
|
+
*
|
|
1305
|
+
* - `onActivation` / `onDeactivation` — `setRuleEnabled`
|
|
1306
|
+
* - `onTrigger` — a positive/raised match
|
|
1307
|
+
* - `onTriggerOff` — a clear/leave match (`sensorRaised === false`, occupancy
|
|
1308
|
+
* leave). A delivery with no clear edge never produces this hook.
|
|
1309
|
+
*/
|
|
1310
|
+
var NcRuleActionsSchema = /* @__PURE__ */ zod.z.object({
|
|
1311
|
+
onActivation: /* @__PURE__ */ NcHookActionIdsSchema.optional(),
|
|
1312
|
+
onDeactivation: /* @__PURE__ */ NcHookActionIdsSchema.optional(),
|
|
1313
|
+
/** Runs on a positive / raised match. */
|
|
1314
|
+
onTrigger: /* @__PURE__ */ NcHookActionIdsSchema.optional(),
|
|
1315
|
+
/** Runs on a clear / leave match, when the subject carries one. */
|
|
1316
|
+
onTriggerOff: /* @__PURE__ */ NcHookActionIdsSchema.optional(),
|
|
1317
|
+
/**
|
|
1318
|
+
* Buttons the NOTIFICATION carries, each running one Action when tapped.
|
|
1319
|
+
* Deliberately a REFERENCE — a button that could define its own steps would
|
|
1320
|
+
* be a parallel actuation vocabulary.
|
|
1321
|
+
*/
|
|
1322
|
+
buttons: /* @__PURE__ */ zod.z.array(NcRuleNotificationButtonSchema).max(8).optional()
|
|
1323
|
+
});
|
|
1324
|
+
/**
|
|
1325
|
+
* "This rule applies only while `deviceId` is in one of `states`."
|
|
1326
|
+
*
|
|
1327
|
+
* The states are the DEVICE's own vocabulary — `AlarmState` for a panel,
|
|
1328
|
+
* `on`/`off` for a switch — not a normalised set, because normalising would
|
|
1329
|
+
* make the condition lie about devices whose states have no equivalent.
|
|
1330
|
+
*
|
|
1331
|
+
* An unreadable state does NOT match: see the engine's fail-closed gate. A
|
|
1332
|
+
* condition that fired on "I could not read it" would be worse than no gate.
|
|
1333
|
+
*/
|
|
1334
|
+
var NcDeviceStateConditionSchema = /* @__PURE__ */ zod.z.object({
|
|
1335
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
1336
|
+
/** Any of these matches. */
|
|
1337
|
+
states: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).min(1)
|
|
1338
|
+
});
|
|
1339
|
+
/**
|
|
1340
|
+
* "This rule applies only while scene `sceneId` is `matched` / `diverged`."
|
|
1341
|
+
*
|
|
1342
|
+
* A GATE, not a trigger. `occupancy` and `audio` each DISCRIMINATE their rule —
|
|
1343
|
+
* carrying one makes the rule fire on that subject and nothing else. Scene is
|
|
1344
|
+
* the other shape entirely, the `deviceState` shape: it narrows a rule that
|
|
1345
|
+
* already has a trigger ("tell me about a person at the front door, but only
|
|
1346
|
+
* while the bin is still out"). That is why it composes with every delivery
|
|
1347
|
+
* instead of owning one, and why no new `NcDelivery` member and no new subject
|
|
1348
|
+
* kind exist for it — see D159.
|
|
1349
|
+
*
|
|
1350
|
+
* ── Identity ───────────────────────────────────────────────────────────────
|
|
1351
|
+
* `sceneId` is `SceneMonitor.id`, a `randomUUID()` minted by `createScene` —
|
|
1352
|
+
* globally unique, so it needs no device to disambiguate it. `deviceId` is
|
|
1353
|
+
* carried as a HINT for the editor and for the log line, never as part of the
|
|
1354
|
+
* lookup key: a rule whose hint drifted must still gate correctly.
|
|
1355
|
+
*
|
|
1356
|
+
* ── Which boolean ──────────────────────────────────────────────────────────
|
|
1357
|
+
* `latched` ABSENT means "whatever the scene itself says" — `SceneMonitor.emit`
|
|
1358
|
+
* already declares which boolean drives notification rules, and a second knob
|
|
1359
|
+
* that could disagree with it is exactly the D62 failure. Set it only to
|
|
1360
|
+
* override one rule against the scene's own default.
|
|
1361
|
+
*
|
|
1362
|
+
* - LIVE reading (`emit`/`latched` resolve to live): passes iff
|
|
1363
|
+
* `verdict === requiredState`. `unknown` — no reference for this light, view
|
|
1364
|
+
* shifted, no snapshot — passes NEITHER. A scene that cannot judge is not
|
|
1365
|
+
* evidence, in either direction.
|
|
1366
|
+
* - LATCHED reading: passes iff `latched === (requiredState === 'diverged')`.
|
|
1367
|
+
* The latch is a durable fact about the past ("it has diverged since I armed
|
|
1368
|
+
* it"), so a camera that has gone dark does not clear it — that is the whole
|
|
1369
|
+
* reason the operator asked for a latch.
|
|
1370
|
+
*
|
|
1371
|
+
* The gate reads an in-memory mirror (`NcSceneStateCache`) refreshed OFF the
|
|
1372
|
+
* event path, never the cap: D49. A mirror that has never loaded, or a scene it
|
|
1373
|
+
* does not carry, reads absent and the rule does NOT fire — fail closed, and
|
|
1374
|
+
* said out loud in the log rather than dropped in silence.
|
|
1375
|
+
*/
|
|
1376
|
+
var NcSceneConditionSchema = /* @__PURE__ */ zod.z.object({
|
|
1377
|
+
/** `SceneMonitor.id` — the uuid the cap mints. The whole lookup key. */
|
|
1378
|
+
sceneId: /* @__PURE__ */ zod.z.string().min(1),
|
|
1379
|
+
/** The camera the scene lives on. A hint for the editor and the log line. */
|
|
1380
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().optional(),
|
|
1381
|
+
/** The state the scene must be in for the rule to fire. */
|
|
1382
|
+
requiredState: /* @__PURE__ */ zod.z.enum(["matched", "diverged"]),
|
|
1383
|
+
/**
|
|
1384
|
+
* Read the LATCH (`true`) or the LIVE verdict (`false`). Absent = follow the
|
|
1385
|
+
* scene's own `emit` field, which is the only place that decision belongs.
|
|
1386
|
+
*/
|
|
1387
|
+
latched: /* @__PURE__ */ zod.z.boolean().optional()
|
|
1388
|
+
});
|
|
1389
|
+
var NcConditionsSchema = /* @__PURE__ */ zod.z.object({
|
|
1390
|
+
/** Gate on ANOTHER device's current state (the alarm armed, a switch on). */
|
|
1391
|
+
deviceState: /* @__PURE__ */ NcDeviceStateConditionSchema.optional(),
|
|
1392
|
+
/**
|
|
1393
|
+
* Gate on a SCENE's state — "only while the bin is still out". Composes with
|
|
1394
|
+
* every trigger (detection, occupancy, audio, sensor, package, track-end);
|
|
1395
|
+
* unlike `occupancy`/`audio` it discriminates nothing. See
|
|
1396
|
+
* {@link NcSceneCondition} and D159.
|
|
1397
|
+
*/
|
|
1398
|
+
scene: /* @__PURE__ */ NcSceneConditionSchema.optional(),
|
|
1399
|
+
/** Device scope — absent = all devices. */
|
|
1400
|
+
devices: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number()).optional(),
|
|
1401
|
+
/**
|
|
1402
|
+
* Device EXCLUSION (D641) — "every device except these". Judged on the SAME
|
|
1403
|
+
* subject ids {@link devices} is judged on (the camera, the sensor that
|
|
1404
|
+
* fired, a linked set's sensor and row cameras), so a sensor fanned out per
|
|
1405
|
+
* linked camera is excluded exactly where an include would have tested it.
|
|
1406
|
+
* `min(1)`: an empty exclusion excludes nothing and is written as absent.
|
|
1407
|
+
*
|
|
1408
|
+
* Not for `system-event` rules — those carry their own
|
|
1409
|
+
* `systemEvent.excludeDeviceIds` (D636), and the hub refuses this key there.
|
|
1410
|
+
* Editors present the two lists as ONE field (All | Only these | All except
|
|
1411
|
+
* these); the engine evaluates each independently, so a legacy rule
|
|
1412
|
+
* carrying both still means "these, minus those".
|
|
1413
|
+
*/
|
|
1414
|
+
devicesExclude: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number()).min(1).optional(),
|
|
1415
|
+
/** Detector class names (any overlap with the record's class set). */
|
|
1416
|
+
classes: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
|
|
1417
|
+
/** Veto classes — any overlap fails the rule. */
|
|
1418
|
+
classesExclude: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
|
|
1419
|
+
/** Minimum detection confidence 0–1 (fails when the record has none). */
|
|
1420
|
+
minConfidence: /* @__PURE__ */ zod.z.number().min(0).max(1).optional(),
|
|
1421
|
+
/** Admin zone membership over event `zones` / track `zonesVisited`. */
|
|
1422
|
+
zones: /* @__PURE__ */ NcZoneConditionSchema.optional(),
|
|
1423
|
+
/** Veto zones — any hit fails the rule. */
|
|
1424
|
+
zonesExclude: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
|
|
1425
|
+
/**
|
|
1426
|
+
* Zone-crossing direction. IMMEDIATE only — a crossing is a per-event fact
|
|
1427
|
+
* and a closed track carries none, so a `track-end` rule asking for one
|
|
1428
|
+
* fails closed (use `zones`, which tests `zonesVisited`). ABSENT = `enter`,
|
|
1429
|
+
* which is exactly today's behaviour. See {@link NcCrossingSchema}.
|
|
1430
|
+
*/
|
|
1431
|
+
crossing: /* @__PURE__ */ NcCrossingSchema.optional(),
|
|
1432
|
+
/**
|
|
1433
|
+
* Exact (case-insensitive) match on the record's collapsed `label`
|
|
1434
|
+
* (identity name / plate text / subclass).
|
|
1435
|
+
*/
|
|
1436
|
+
labelEquals: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
|
|
1437
|
+
/**
|
|
1438
|
+
* KNOWN FACES — the rule's identity scope, and the switch that says the rule
|
|
1439
|
+
* is about recognised people at all.
|
|
1440
|
+
*
|
|
1441
|
+
* Three states, and the empty one is the point:
|
|
1442
|
+
*
|
|
1443
|
+
* | value | meaning |
|
|
1444
|
+
* | --- | --- |
|
|
1445
|
+
* | absent | the rule does not care who it is; an unrecognised person matches |
|
|
1446
|
+
* | `[]` | **only known faces** — any identity in the gallery, nobody in particular |
|
|
1447
|
+
* | a list | only these identities |
|
|
1448
|
+
*
|
|
1449
|
+
* `[]` is the repo-wide "no selection = no narrowing" reading (an absent
|
|
1450
|
+
* `devices` list is every device), applied one level down: the operator has
|
|
1451
|
+
* turned the face scope ON and narrowed it to nothing, which is every known
|
|
1452
|
+
* face. No second field states the same thing — a switch that can disagree
|
|
1453
|
+
* with the list under it is worse than no switch (D62).
|
|
1454
|
+
*
|
|
1455
|
+
* MEMBERS ARE FACE-GALLERY `Identity.id`s (uuid), not display names. A name is
|
|
1456
|
+
* renameable, and a rule authored on "Alice" went silently dark the moment
|
|
1457
|
+
* the operator fixed the spelling. The id reaches the record on
|
|
1458
|
+
* `LabelAttribution.identityId`; the name is what the editor shows and what
|
|
1459
|
+
* `{{label}}` renders.
|
|
1460
|
+
*
|
|
1461
|
+
* Rules written before this carry NAMES, and are resolved to ids lazily at
|
|
1462
|
+
* load (`NcRuleStore.load`) against the live gallery — a name nothing answers
|
|
1463
|
+
* for is left as it stands and reported, never dropped. The engine also
|
|
1464
|
+
* accepts a display-name hit as a compatibility leg, so a rule whose
|
|
1465
|
+
* migration could not resolve keeps matching exactly what it matched before.
|
|
1466
|
+
*/
|
|
1467
|
+
identities: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
|
|
1468
|
+
/**
|
|
1469
|
+
* KNOWN PLATES / VEHICLES — the plate mirror of {@link identities}, including
|
|
1470
|
+
* the empty-list reading: `values: []` is "any plate the OCR could read",
|
|
1471
|
+
* a non-empty list is those plates (fuzzily). See {@link NcPlateMatcherSchema}.
|
|
1472
|
+
*/
|
|
1473
|
+
plates: /* @__PURE__ */ NcPlateMatcherSchema.optional(),
|
|
1474
|
+
/**
|
|
1475
|
+
* Identity EXCLUDE — mirror of {@link identities} with `notIn` semantics, and
|
|
1476
|
+
* the same id members and the same lazy name→id migration. A record with NO
|
|
1477
|
+
* identity passes (nothing to exclude), unlike the include variant which
|
|
1478
|
+
* fails on an unrecognised subject. An EMPTY list excludes nobody.
|
|
1479
|
+
*/
|
|
1480
|
+
identitiesExclude: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
|
|
1481
|
+
/**
|
|
1482
|
+
* Minimum server-computed key-event importance in [0,1] (`Track.importance`).
|
|
1483
|
+
* TRACK-END only: importance is scored at track close, so it does not exist
|
|
1484
|
+
* at immediate / object-event evaluation time (see catalog `appliesTo`). At
|
|
1485
|
+
* close the value is threaded via the close-time info (the `Track` clone is
|
|
1486
|
+
* captured before the DB row is updated, so it would otherwise read stale).
|
|
1487
|
+
* Fails when the record carries no importance (never guess quality — the
|
|
1488
|
+
* `minConfidence` precedent). MVP cut: a single scalar threshold.
|
|
1489
|
+
*/
|
|
1490
|
+
minImportance: /* @__PURE__ */ zod.z.number().min(0).max(1).optional(),
|
|
1491
|
+
/**
|
|
1492
|
+
* Minimum track dwell in SECONDS — `(lastSeen − firstSeen) / 1000`.
|
|
1493
|
+
* TRACK-END only: an `immediate` / object-event subject has no closed
|
|
1494
|
+
* lifespan, so a dwell condition never matches immediate delivery
|
|
1495
|
+
* (documented choice — the object-event record carries no `firstSeen`,
|
|
1496
|
+
* so dwell cannot be computed from what the subject actually carries).
|
|
1497
|
+
*/
|
|
1498
|
+
minDwellSeconds: /* @__PURE__ */ zod.z.number().min(0).optional(),
|
|
1499
|
+
/**
|
|
1500
|
+
* Detection provenance filter. `any` (default / absent) matches every
|
|
1501
|
+
* source; otherwise the subject's source must equal it. Legacy records
|
|
1502
|
+
* with no stamped source are treated as `pipeline`. The union spans both
|
|
1503
|
+
* record kinds — object events carry `pipeline` | `onboard`, synthetic
|
|
1504
|
+
* tracks carry `sensor` (a linked device) or `audio` (a D62 audio marker).
|
|
1505
|
+
*/
|
|
1506
|
+
source: /* @__PURE__ */ zod.z.enum([
|
|
1507
|
+
"pipeline",
|
|
1508
|
+
"onboard",
|
|
1509
|
+
"sensor",
|
|
1510
|
+
"audio",
|
|
1511
|
+
"any"
|
|
1512
|
+
]).optional(),
|
|
1513
|
+
/**
|
|
1514
|
+
* Minimum identity / plate MATCH confidence in [0,1] — DISTINCT from the
|
|
1515
|
+
* detector `minConfidence` (that gates the object-detection score; this
|
|
1516
|
+
* gates the recognition/OCR match score). Fails when the subject carries
|
|
1517
|
+
* no label-match confidence (never guess). TRACK-END only: the confidence
|
|
1518
|
+
* lives on the recognition result and reaches the subject at track close.
|
|
1519
|
+
*
|
|
1520
|
+
* What it measures precisely (plumbed at track close — the closer threads
|
|
1521
|
+
* the value into `NcTrackClosedInfo.labelConfidence`, the same seam as
|
|
1522
|
+
* `importance`): the BEST recognition match confidence observed for the
|
|
1523
|
+
* label the track carries at close — for a face, the peak cosine similarity
|
|
1524
|
+
* of the ASSIGNED identity (`FaceMatch.score`, reset on an identity switch);
|
|
1525
|
+
* for a plate, the peak OCR read score of the best-held plate
|
|
1526
|
+
* (`plateText.confidence`). When BOTH a face and a plate were recognized on
|
|
1527
|
+
* one track the higher of the two is used. A track that ended with no
|
|
1528
|
+
* confident identity/plate match carries no value, so the condition fails
|
|
1529
|
+
* closed for it (an un-recognized subject).
|
|
1530
|
+
*/
|
|
1531
|
+
minLabelConfidence: /* @__PURE__ */ zod.z.number().min(0).max(1).optional(),
|
|
1532
|
+
/**
|
|
1533
|
+
* DEVICE-EVENT only. Raw device event-type tokens (`EventFire.eventType`,
|
|
1534
|
+
* e.g. a doorbell `press` / `press_long`) — matched case-insensitively
|
|
1535
|
+
* against the token carried on the device-event subject (extracted from the
|
|
1536
|
+
* event-emitter runtime slice's `lastEvent.eventType`). Fails when the
|
|
1537
|
+
* subject carries no token. Doorbell-pulse / passive-sensor kinds emit no
|
|
1538
|
+
* eventType, so gate those with {@link sensorKinds} instead.
|
|
1539
|
+
*/
|
|
1540
|
+
eventTypeTokens: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
|
|
1541
|
+
/**
|
|
1542
|
+
* DEVICE-EVENT only. Sensor/control taxonomy kinds (e.g. `doorbell`,
|
|
1543
|
+
* `contact`, `button`, `device-event`) — matched against the persisted
|
|
1544
|
+
* `SensorEvent.kind` (see `sensor-event-kinds.ts`). Membership is OR.
|
|
1545
|
+
*/
|
|
1546
|
+
sensorKinds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
|
|
1547
|
+
/**
|
|
1548
|
+
* DEVICE-EVENT only (D640). Fire on one edge of a boolean sensor —
|
|
1549
|
+
* {@link NcSensorTransitionSchema}. Which field of the slice means "raised"
|
|
1550
|
+
* is `@camstack/types` → `notification/sensor-raised.ts`. A reading the
|
|
1551
|
+
* engine cannot place (a kind with no raise, an unreadable slice) PASSES:
|
|
1552
|
+
* the condition fails open towards notifying, never towards silence. Editors
|
|
1553
|
+
* offer it only when every chosen {@link sensorKinds} member has a raise
|
|
1554
|
+
* (`sensorTransitionOffered`), and the hub refuses it on any other delivery.
|
|
1555
|
+
*/
|
|
1556
|
+
sensorTransition: /* @__PURE__ */ NcSensorTransitionSchema.optional(),
|
|
1557
|
+
/**
|
|
1558
|
+
* PACKAGE-EVENT only. Which package phase fires the rule — `delivered`
|
|
1559
|
+
* (a parked parcel appeared), `picked-up` (it departed), or `both`. Fails
|
|
1560
|
+
* when the subject's phase does not match (a subject always carries a phase
|
|
1561
|
+
* on the package-event trigger).
|
|
1562
|
+
*/
|
|
1563
|
+
packagePhase: /* @__PURE__ */ zod.z.enum([
|
|
1564
|
+
"delivered",
|
|
1565
|
+
"picked-up",
|
|
1566
|
+
"both"
|
|
1567
|
+
]).optional(),
|
|
1568
|
+
/** Infrastructure/liveness/update event matcher (`system-event` delivery). */
|
|
1569
|
+
systemEvent: /* @__PURE__ */ NcSystemEventConditionSchema.optional(),
|
|
1570
|
+
/**
|
|
1571
|
+
* PERSONAL-RULE custom zones (viewer-drawn). Inline normalized polygons
|
|
1572
|
+
* (MaskShape vocabulary). A record passes when its bbox overlaps ANY
|
|
1573
|
+
* listed polygon (ZoneEngine membership semantics). Evaluated only when
|
|
1574
|
+
* the subject carries a bbox; absent bbox ⇒ the condition FAILS.
|
|
1575
|
+
*/
|
|
1576
|
+
customZones: /* @__PURE__ */ zod.z.array(require_mask_shape.MaskPolygonShapeSchema).optional(),
|
|
1577
|
+
/**
|
|
1578
|
+
* DEVICE-EVENT only. ZoneAnalytics occupancy edge — fires when a device's
|
|
1579
|
+
* (optionally zone/class-scoped) occupancy count crosses the configured
|
|
1580
|
+
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
1581
|
+
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
1582
|
+
*/
|
|
1583
|
+
occupancy: /* @__PURE__ */ NcOccupancyConditionSchema.optional(),
|
|
1584
|
+
/**
|
|
1585
|
+
* IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
|
|
1586
|
+
* `samplingSeconds` window clear the optional `dbThreshold` and carry one of
|
|
1587
|
+
* the optional `labels`. Fail-closed on missing substrate (no audio samples,
|
|
1588
|
+
* a window that is not full yet, neither filter given). See
|
|
1589
|
+
* {@link NcAudioCondition}.
|
|
1590
|
+
*
|
|
1591
|
+
* Presence of this key is what makes a rule an AUDIO rule: the engine fires
|
|
1592
|
+
* it ONLY on a confirmed audio window, and a rule carrying it never fires on
|
|
1593
|
+
* a detection, a track or a device event (the same fail-closed pairing
|
|
1594
|
+
* `occupancy` has with the `device-event` trigger). That is how audio labels
|
|
1595
|
+
* leave `classes`: an audio rule names its sounds HERE, and the legacy path
|
|
1596
|
+
* (an `immediate` rule naming an `audio-*` class, one notification per
|
|
1597
|
+
* classified sample) stays exactly as it was for rules that already use it.
|
|
1598
|
+
*
|
|
1599
|
+
* In {@link NC_CONDITION_CATALOG} since P2, and the ORDER it got there is the
|
|
1600
|
+
* rule rather than an accident: the viewer mirrors the descriptor enums BY
|
|
1601
|
+
* HAND (`camstack/src/data/notification-center.ts`, guarded by
|
|
1602
|
+
* `scripts/check-viewer-condition-mirror.ts`) and its rule editor strips the
|
|
1603
|
+
* condition fields it does not know when a rule is saved from the phone.
|
|
1604
|
+
* Publishing an editor for a condition the app cannot round-trip is how an
|
|
1605
|
+
* operator loses a rule's conditions by opening it — so the viewer mirror
|
|
1606
|
+
* (P3, shipped) went FIRST, and the descriptor an editor renders from
|
|
1607
|
+
* follows here.
|
|
1608
|
+
*/
|
|
1609
|
+
audio: /* @__PURE__ */ NcAudioConditionSchema.optional()
|
|
1610
|
+
});
|
|
1611
|
+
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
1612
|
+
var NcRuleTargetSchema = /* @__PURE__ */ zod.z.object({
|
|
1613
|
+
/** `notification-output` Target id. */
|
|
1614
|
+
targetId: /* @__PURE__ */ zod.z.string().min(1),
|
|
1615
|
+
/**
|
|
1616
|
+
* Per-backend passthrough. Recognized keys are mapped onto the canonical
|
|
1617
|
+
* Notification (`priority`, `level`, `sound`, `clickUrl`, `ttl`); the
|
|
1618
|
+
* degrade engine drops what the backend can't render.
|
|
1619
|
+
*/
|
|
1620
|
+
params: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()).optional()
|
|
1621
|
+
});
|
|
1622
|
+
/** Which picture kind one target receives (#487). */
|
|
1623
|
+
var NcTargetAttachmentSchema = /* @__PURE__ */ zod.z.enum([
|
|
1624
|
+
"none",
|
|
1625
|
+
"image",
|
|
1626
|
+
"clip",
|
|
1627
|
+
"gif"
|
|
1628
|
+
]);
|
|
1629
|
+
var NcTargetOverrideSchema = /* @__PURE__ */ zod.z.object({
|
|
1630
|
+
template: /* @__PURE__ */ zod.z.object({
|
|
1631
|
+
title: /* @__PURE__ */ zod.z.string().max(500).optional(),
|
|
1632
|
+
body: /* @__PURE__ */ zod.z.string().max(2e3).optional()
|
|
1633
|
+
}).optional(),
|
|
1634
|
+
schedule: /* @__PURE__ */ NcScheduleSchema.optional(),
|
|
1635
|
+
priority: /* @__PURE__ */ zod.z.number().int().min(1).max(5).optional(),
|
|
1636
|
+
attachment: /* @__PURE__ */ NcTargetAttachmentSchema.optional(),
|
|
1637
|
+
/** `false` = no buttons for this target; `true` is the same as absent. */
|
|
1638
|
+
actions: /* @__PURE__ */ zod.z.boolean().optional()
|
|
1639
|
+
});
|
|
1640
|
+
/** Per-target settings keyed by target id (#487). */
|
|
1641
|
+
var NcTargetOverridesSchema = /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), NcTargetOverrideSchema);
|
|
1642
|
+
/**
|
|
1643
|
+
* WHAT THE NOTIFICATION'S PICTURE IS (D897) — the ONE media choice of a rule.
|
|
1644
|
+
*
|
|
1645
|
+
* Every mode starts from the same CLEAN source frame of the trigger moment
|
|
1646
|
+
* (keyFrame → sceneFrame → lastSceneFrame, narrowed to the trigger instant and
|
|
1647
|
+
* to the zone that fired the rule) and renders it once at send time:
|
|
1648
|
+
* - `scene-boxes` — the whole scene, the subject outlined thick in the accent
|
|
1649
|
+
* colour and every OTHER track visible at that instant outlined thin, each
|
|
1650
|
+
* labelled with class and confidence ("dog 87%").
|
|
1651
|
+
* - `crop` — the subject cut out of that frame around its box at that instant.
|
|
1652
|
+
* - `clean` — the whole scene with nothing drawn on it.
|
|
1653
|
+
* - `none` — no picture.
|
|
1654
|
+
*
|
|
1655
|
+
* A mode that cannot be honoured (no box at that instant, a photograph with no
|
|
1656
|
+
* tracked subject) ships `clean` and names the reason in the log, per camera.
|
|
1657
|
+
* It replaces the `attach` × `frame` × `zoneCrop` triple, which let one rule
|
|
1658
|
+
* ship a crop on one event and a boxed scene on the next depending on which
|
|
1659
|
+
* stored kind had landed.
|
|
1660
|
+
*/
|
|
1661
|
+
var NcMediaImageSchema = /* @__PURE__ */ zod.z.enum([
|
|
1662
|
+
"scene-boxes",
|
|
1663
|
+
"crop",
|
|
1664
|
+
"clean",
|
|
1665
|
+
"none"
|
|
1666
|
+
]);
|
|
1667
|
+
/**
|
|
1668
|
+
* @deprecated Read only by `normalizeNcMediaPolicy` (D897) — see {@link NcMediaImageSchema}.
|
|
1669
|
+
*
|
|
1670
|
+
* Media attachment policy (P1 still-image subset).
|
|
1671
|
+
* - `best` — the best AVAILABLE subject image at dispatch time (D-3).
|
|
1672
|
+
* - `best-matching` — the media that explains WHY the rule fired: a rule
|
|
1673
|
+
* matched on identities attaches the subject's `faceCrop`, one matched on
|
|
1674
|
+
* plates attaches the `plateCrop`; a rule with no identity/plate condition
|
|
1675
|
+
* (or when the specific crop is missing) degrades to `best`, then
|
|
1676
|
+
* `keyFrame`, then no attachment — never delaying the send. The matched
|
|
1677
|
+
* condition summary is frozen on the outbox row at enqueue (like the rule
|
|
1678
|
+
* name), so the choice never drifts from the record that fired it.
|
|
1679
|
+
* - `keyFrame` — the clean scene frame (no subject box).
|
|
1680
|
+
* - `none` — no attachment.
|
|
1681
|
+
*/
|
|
1682
|
+
/**
|
|
1683
|
+
* @deprecated Read only by `normalizeNcMediaPolicy` (D897) — see {@link NcMediaImageSchema}.
|
|
1684
|
+
*
|
|
1685
|
+
* WHAT THE PICTURE SHOWS — chosen explicitly, because the implicit ladders
|
|
1686
|
+
* conflate it with the selection strategy and betray the request: asking for
|
|
1687
|
+
* the clean scene frame on an object-event owner used to start at
|
|
1688
|
+
* `fullFrameBoxed`, i.e. the annotated frame (2026-07-30).
|
|
1689
|
+
* - `cropped` — the subject, tight. What "who is at the door" wants.
|
|
1690
|
+
* - `full` — the clean scene, no annotation. What "what is going on" wants.
|
|
1691
|
+
* - `boxed` — the scene WITH the detection boxes drawn, for verifying what
|
|
1692
|
+
* the pipeline actually saw.
|
|
1693
|
+
*/
|
|
1694
|
+
var NcMediaFrameSchema = /* @__PURE__ */ zod.z.enum([
|
|
1695
|
+
"cropped",
|
|
1696
|
+
"full",
|
|
1697
|
+
"boxed"
|
|
1698
|
+
]);
|
|
1699
|
+
/**
|
|
1700
|
+
* How a SENSOR notification shows the cameras that link the sensor.
|
|
1701
|
+
*
|
|
1702
|
+
* `mosaic` — one image composed of every linked camera's photograph, taken at
|
|
1703
|
+
* the trigger. `each` — one image per camera where the target takes several
|
|
1704
|
+
* attachments; a target that takes one keeps the first camera's (the degrade
|
|
1705
|
+
* engine drops the rest by order). Either way ONE notification per event.
|
|
1706
|
+
* Absent = `mosaic`, applied by the Notification Center and deliberately NOT
|
|
1707
|
+
* a Zod default (see NcRulePatchSchema: a default materialises on every
|
|
1708
|
+
* partial patch). Meaningless for a rule whose subject is not a sensor, and a
|
|
1709
|
+
* sensor linked to one camera ships that camera's plain snapshot either way.
|
|
1710
|
+
*/
|
|
1711
|
+
var NcLinkedCameraModeSchema = /* @__PURE__ */ zod.z.enum(["mosaic", "each"]);
|
|
1712
|
+
var NcMediaPolicySchema = /* @__PURE__ */ zod.z.object({
|
|
1713
|
+
/**
|
|
1714
|
+
* The picture — see {@link NcMediaImageSchema}. Absent on a rule nobody has
|
|
1715
|
+
* saved since D897: `normalizeNcMediaPolicy` derives it from the legacy
|
|
1716
|
+
* triple below, at load and at every write, and the store keeps only this.
|
|
1717
|
+
*/
|
|
1718
|
+
image: /* @__PURE__ */ NcMediaImageSchema.optional(),
|
|
1719
|
+
/**
|
|
1720
|
+
* Draw the zone that FIRED the rule on the picture (`scene-boxes` / `clean`;
|
|
1721
|
+
* a `crop` never shows it). Valid only on a rule whose trigger is a zone —
|
|
1722
|
+
* `conditions.zones` or an occupancy zone — and refused on save otherwise.
|
|
1723
|
+
* Replaces `zoneCrop`.
|
|
1724
|
+
*/
|
|
1725
|
+
showTriggerZone: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
1726
|
+
/**
|
|
1727
|
+
* Draw the SUBJECT'S PATH on the picture — a line in the subject's colour
|
|
1728
|
+
* through the track's positions up to the frame shown, the same path the
|
|
1729
|
+
* debug views draw (`buildSubjectPath`, D903). Every picture mode a subject
|
|
1730
|
+
* is drawn on: a `crop` maps the path into the crop and clips it. Valid only
|
|
1731
|
+
* on a rule whose subject is a tracked object (refused on a sound rule);
|
|
1732
|
+
* dropped on `image: 'none'`. Absent = off.
|
|
1733
|
+
*/
|
|
1734
|
+
showSubjectPath: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
1735
|
+
/** @deprecated D897 — accepted from an editor that predates `image`, folded into it on save. */
|
|
1736
|
+
attach: /* @__PURE__ */ zod.z.enum([
|
|
1737
|
+
"best",
|
|
1738
|
+
"best-matching",
|
|
1739
|
+
"keyFrame",
|
|
1740
|
+
"none"
|
|
1741
|
+
]).optional(),
|
|
1742
|
+
/** @deprecated D897 — accepted from an editor that predates `image`, folded into it on save. */
|
|
1743
|
+
frame: /* @__PURE__ */ NcMediaFrameSchema.optional(),
|
|
1744
|
+
/** @deprecated D897 — folded into `image: 'clean'` + `showTriggerZone` on save. */
|
|
1745
|
+
zoneCrop: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
1746
|
+
/**
|
|
1747
|
+
* Also attach a short GIF cut from the stream broker's clip ring around the
|
|
1748
|
+
* event — NOT from the recording, so the camera does not have to be
|
|
1749
|
+
* recording, and the window sits AROUND the moment instead of a segment
|
|
1750
|
+
* behind it. Fail-closed: a window the ring does not cover contributes no
|
|
1751
|
+
* gif, never a failed notification.
|
|
1752
|
+
*/
|
|
1753
|
+
gif: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
1754
|
+
/**
|
|
1755
|
+
* Also attach a short MP4 CLIP of the same cut. Same source and the same
|
|
1756
|
+
* fail-closed rule as `gif`. Prefer it where the backend takes video
|
|
1757
|
+
* (telegram, discord, zentik, webhook); backends that do not are handled by
|
|
1758
|
+
* the degrade engine, which drops the video and keeps the still.
|
|
1759
|
+
*/
|
|
1760
|
+
clip: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
1761
|
+
/**
|
|
1762
|
+
* Seconds of footage BEFORE / AFTER the event instant. Absent =
|
|
1763
|
+
* {@link NC_CLIP_PRE_ROLL_DEFAULT_SEC} / {@link NC_CLIP_POST_ROLL_DEFAULT_SEC}
|
|
1764
|
+
* (4 / 6), resolved by the Notification Center at dispatch — deliberately not
|
|
1765
|
+
* a Zod default, so a rule that never chose keeps following the hub's.
|
|
1766
|
+
*/
|
|
1767
|
+
clipPreRollSec: /* @__PURE__ */ zod.z.number().int().min(0).max(30).optional(),
|
|
1768
|
+
clipPostRollSec: /* @__PURE__ */ zod.z.number().int().min(0).max(30).optional(),
|
|
1769
|
+
/**
|
|
1770
|
+
* Playback rate of the attached gif / clip. Absent = 2x.
|
|
1771
|
+
*
|
|
1772
|
+
* A notification clip is GLANCED at on a lock screen, not watched: at real
|
|
1773
|
+
* time an eight-second passage is eight seconds of the recipient's attention
|
|
1774
|
+
* and twice the bytes. 1 is real time for the operator who wants it.
|
|
1775
|
+
*/
|
|
1776
|
+
clipSpeed: /* @__PURE__ */ zod.z.number().min(1).max(8).optional(),
|
|
1777
|
+
/**
|
|
1778
|
+
* Which stream profile the footage is cut from. Absent = the CHEAPEST
|
|
1779
|
+
* assigned profile: a notification is watched on a phone, so the 4K
|
|
1780
|
+
* rendition would burn CPU to produce a file the client downscales anyway.
|
|
1781
|
+
* A profile that is not assigned falls back to the cheapest, and the render
|
|
1782
|
+
* reports which one actually ran.
|
|
1783
|
+
*/
|
|
1784
|
+
profile: /* @__PURE__ */ require_streaming_shared.CamProfileSchema.optional(),
|
|
1785
|
+
/** See {@link NcLinkedCameraModeSchema}. */
|
|
1786
|
+
linkedCameras: /* @__PURE__ */ NcLinkedCameraModeSchema.optional(),
|
|
1787
|
+
/**
|
|
1788
|
+
* Sensor rules only: may this rule wake a SLEEPING battery camera to take
|
|
1789
|
+
* the linked still it attaches (D998)? Absent means yes, an explicit `false`
|
|
1790
|
+
* opts out. Deliberately not a Zod default: a rule that never chose keeps
|
|
1791
|
+
* following the hub's. One bounded wake per event; nothing is attached later.
|
|
1792
|
+
*/
|
|
1793
|
+
wakeSleepingCamera: /* @__PURE__ */ zod.z.boolean().optional()
|
|
1794
|
+
});
|
|
1795
|
+
/**
|
|
1796
|
+
* Cooldown GRANULARITY over the subject's class — how much a fired
|
|
1797
|
+
* notification suppresses.
|
|
1798
|
+
* - `per-class` (default, and the absent value since 2026-10-01 — D36) — an
|
|
1799
|
+
* independent window per detected class: cat→dog fires at once, cat→cat
|
|
1800
|
+
* still waits.
|
|
1801
|
+
* - `shared` — one window for the whole rule/scope: a cat silences the next
|
|
1802
|
+
* dog for `cooldownSec`. Only written when an operator picks it; it is no
|
|
1803
|
+
* longer what an unset rule means.
|
|
1804
|
+
*
|
|
1805
|
+
* AUDIO subjects are ALWAYS per-class regardless of this setting: a scream
|
|
1806
|
+
* must not be swallowed by a bark's window (the precedent this generalizes —
|
|
1807
|
+
* see `cooldownKey` in the rule engine).
|
|
1808
|
+
*/
|
|
1809
|
+
var NcThrottleGranularitySchema = /* @__PURE__ */ zod.z.enum(["shared", "per-class"]);
|
|
1810
|
+
/** Throttle — cooldown survives restarts (rebuilt from the outbox on boot). */
|
|
1811
|
+
var NcThrottleSchema = /* @__PURE__ */ zod.z.object({
|
|
1812
|
+
cooldownSec: /* @__PURE__ */ zod.z.number().int().min(0).max(86400).default(60),
|
|
1813
|
+
/** `rule` = one shared cooldown; `rule-device` = per-camera cooldown. */
|
|
1814
|
+
scope: /* @__PURE__ */ zod.z.enum(["rule", "rule-device"]).default("rule-device"),
|
|
1815
|
+
/**
|
|
1816
|
+
* Class granularity of the cooldown key. Optional rather than defaulted:
|
|
1817
|
+
* a Zod default does NOT run on the addon→addon cap path, so a persisted
|
|
1818
|
+
* rule authored before this field simply carries none. The engine used to
|
|
1819
|
+
* read absent as `shared` (D36); since 2026-10-01 it reads absent as
|
|
1820
|
+
* `per-class` — the operator's default — and only an explicit `shared`
|
|
1821
|
+
* still means `shared`. See `cooldownKey` / `keysPerClass` in the rule
|
|
1822
|
+
* engine, and D36's dated note.
|
|
1823
|
+
*/
|
|
1824
|
+
granularity: /* @__PURE__ */ NcThrottleGranularitySchema.optional()
|
|
1825
|
+
});
|
|
1826
|
+
/**
|
|
1827
|
+
* How long the confirm gate may hold ONE notification, and how big the picture
|
|
1828
|
+
* it judges may be.
|
|
1829
|
+
*
|
|
1830
|
+
* The clamp is the product decision, not a coincidence of the model: p50 was
|
|
1831
|
+
* 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
|
|
1832
|
+
* arrives after the visitor has gone is not a notification. 448 px was enough
|
|
1833
|
+
* to score 16/16 on the operator's parking scenario — bigger costs latency and
|
|
1834
|
+
* tokens for pixels the model pools away.
|
|
1835
|
+
*/
|
|
1836
|
+
var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
|
|
1837
|
+
var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
|
|
1838
|
+
var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
|
|
1839
|
+
/** Comparison the model's COUNT must satisfy for the notification to fire. */
|
|
1840
|
+
var NcConfirmExpectSchema = /* @__PURE__ */ zod.z.object({
|
|
1841
|
+
op: /* @__PURE__ */ zod.z.enum([
|
|
1842
|
+
">=",
|
|
1843
|
+
">",
|
|
1844
|
+
"<=",
|
|
1845
|
+
"<",
|
|
1846
|
+
"=="
|
|
1847
|
+
]),
|
|
1848
|
+
count: /* @__PURE__ */ zod.z.number().int().min(0).max(1e3)
|
|
1849
|
+
});
|
|
1850
|
+
/**
|
|
1851
|
+
* AI CONFIRM — a vision model looks at the picture this notification is about
|
|
1852
|
+
* to ship and says whether it agrees with the rule.
|
|
1853
|
+
*
|
|
1854
|
+
* It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
|
|
1855
|
+
* crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
|
|
1856
|
+
* on the operator's phone is not a verdict about this notification.
|
|
1857
|
+
*
|
|
1858
|
+
* FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
|
|
1859
|
+
* whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
|
|
1860
|
+
* the default and every fail-open is COUNTED, because a gate that always fails
|
|
1861
|
+
* open looks in the log exactly like a gate that works.
|
|
1862
|
+
*
|
|
1863
|
+
* Every field is `.optional()` rather than relied on as a Zod default at the
|
|
1864
|
+
* runtime seam: a Zod default does NOT run on the addon→addon cap path (three
|
|
1865
|
+
* production failures in one day), so the gate reads absent as the constant
|
|
1866
|
+
* above rather than trusting a parse it may never have seen.
|
|
1867
|
+
*/
|
|
1868
|
+
var NcConfirmSchema = /* @__PURE__ */ zod.z.object({
|
|
1869
|
+
/** Off unless asked for. An absent `confirm` and `enabled:false` are the
|
|
1870
|
+
* same thing, and both mean "deliver exactly as before". */
|
|
1871
|
+
enabled: /* @__PURE__ */ zod.z.boolean().default(false),
|
|
1872
|
+
/** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
|
|
1873
|
+
profileId: /* @__PURE__ */ zod.z.string().optional(),
|
|
1874
|
+
/**
|
|
1875
|
+
* The operator's question, in his own words. Absent = a question derived
|
|
1876
|
+
* from the rule (its class and its expectation).
|
|
1877
|
+
*
|
|
1878
|
+
* NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
|
|
1879
|
+
* banners, signage and plates as instructions if you let them reach the
|
|
1880
|
+
* prompt — proven live — so the authoritative contract stays in the system
|
|
1881
|
+
* turn and only rule-authored words land here.
|
|
1882
|
+
*/
|
|
1883
|
+
prompt: /* @__PURE__ */ zod.z.string().max(1e3).optional(),
|
|
1884
|
+
/** Fire only when the model's count satisfies this. Absent = the model's
|
|
1885
|
+
* own boolean verdict decides. */
|
|
1886
|
+
expect: /* @__PURE__ */ NcConfirmExpectSchema.optional(),
|
|
1887
|
+
timeoutMs: /* @__PURE__ */ zod.z.number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
|
|
1888
|
+
/** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
|
|
1889
|
+
onTimeout: /* @__PURE__ */ zod.z.enum(["fire", "suppress"]).default("fire"),
|
|
1890
|
+
/** Longest edge the judged image is downscaled to before it is sent. */
|
|
1891
|
+
maxImagePx: /* @__PURE__ */ zod.z.number().int().min(64).max(2048).default(448)
|
|
1892
|
+
});
|
|
1893
|
+
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
1894
|
+
var NcRuleInputSchema = /* @__PURE__ */ zod.z.object({
|
|
1895
|
+
name: /* @__PURE__ */ zod.z.string().min(1).max(200),
|
|
1896
|
+
enabled: /* @__PURE__ */ zod.z.boolean().default(true),
|
|
1897
|
+
delivery: NcDeliverySchema,
|
|
1898
|
+
conditions: /* @__PURE__ */ NcConditionsSchema.default({}),
|
|
1899
|
+
schedule: /* @__PURE__ */ NcScheduleSchema.optional(),
|
|
1900
|
+
/**
|
|
1901
|
+
* A `device-events` / `system` rule's delivery (D647): absent or `instant`
|
|
1902
|
+
* is a notification per event; `summary` is one state summary per closed
|
|
1903
|
+
* window of its schedule. `.optional()` and never defaulted: absent must
|
|
1904
|
+
* keep meaning what every rule authored before D647 meant, with no
|
|
1905
|
+
* migration. Top-level rather than inside `conditions.systemEvent`, so a
|
|
1906
|
+
* client that does not know it (an older viewer re-sending `conditions`
|
|
1907
|
+
* whole) leaves it standing through the store's patch merge.
|
|
1908
|
+
*/
|
|
1909
|
+
systemEventDelivery: /* @__PURE__ */ NcSystemEventDeliverySchema.optional(),
|
|
1910
|
+
/** May be empty when `targetUsers` addresses at least one user — the
|
|
1911
|
+
* "at least one addressee" invariant is enforced by the provider, because
|
|
1912
|
+
* a cross-field refine here would break `NcRulePatchSchema.partial()`. */
|
|
1913
|
+
targets: /* @__PURE__ */ zod.z.array(NcRuleTargetSchema),
|
|
1914
|
+
/**
|
|
1915
|
+
* USERS this rule addresses in addition to `targets` (Phase 4). At fire
|
|
1916
|
+
* time each user fans out to the personal targets they own
|
|
1917
|
+
* (`config.ownerUserId`), filtered by that user's `allowedDevices` for the
|
|
1918
|
+
* firing camera — a user is never notified about a device they cannot open.
|
|
1919
|
+
* Per-user opt-outs (`disabledTargetIds`) still apply to the fanned-out
|
|
1920
|
+
* targets.
|
|
1921
|
+
*/
|
|
1922
|
+
targetUsers: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).optional(),
|
|
1923
|
+
/**
|
|
1924
|
+
* Per-target settings keyed by target id (#487): texts, schedule, priority.
|
|
1925
|
+
* Absent (and an absent entry) = the rule's own values. A patch that omits
|
|
1926
|
+
* the key keeps the stored map; a patch that names it REPLACES it whole —
|
|
1927
|
+
* `{}` empties it.
|
|
1928
|
+
*/
|
|
1929
|
+
targetOverrides: /* @__PURE__ */ NcTargetOverridesSchema.optional(),
|
|
1930
|
+
/** Absent = the kind's default picture (`resolveNcMediaImage`): the subject crop for a
|
|
1931
|
+
* detection, the clean scene for a sensor or a sound. Set explicitly on save (D897). */
|
|
1932
|
+
media: /* @__PURE__ */ NcMediaPolicySchema.default({}),
|
|
1933
|
+
throttle: /* @__PURE__ */ NcThrottleSchema.default({
|
|
1934
|
+
cooldownSec: 60,
|
|
1935
|
+
scope: "rule-device"
|
|
1936
|
+
}),
|
|
1937
|
+
/** `{{var}}` title/body. The variables are declared in `NC_TEMPLATE_VARS` (@camstack/types) and depend on the rule kind — see `templateVarsFor`. */
|
|
1938
|
+
template: /* @__PURE__ */ zod.z.object({
|
|
1939
|
+
title: /* @__PURE__ */ zod.z.string().max(500).optional(),
|
|
1940
|
+
body: /* @__PURE__ */ zod.z.string().max(2e3).optional()
|
|
1941
|
+
}).optional(),
|
|
1942
|
+
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
1943
|
+
priority: /* @__PURE__ */ zod.z.number().int().min(1).max(5).default(3),
|
|
1944
|
+
/**
|
|
1945
|
+
* Ownership/visibility key. Absent = admin/global rule (unchanged legacy
|
|
1946
|
+
* behaviour, visible to all, read-only in the viewer). Present = personal
|
|
1947
|
+
* rule owned by this userId. Server-stamped; never trusted from a client.
|
|
1948
|
+
*/
|
|
1949
|
+
ownerUserId: /* @__PURE__ */ zod.z.string().optional(),
|
|
1950
|
+
/**
|
|
1951
|
+
* May a non-admin snooze this rule for EVERYONE, not just themselves?
|
|
1952
|
+
*
|
|
1953
|
+
* A snooze is personal by default — it silences the person who set it. This
|
|
1954
|
+
* opts THIS rule into the "the gardener is here all afternoon" case, where
|
|
1955
|
+
* silencing the camera for the whole household is legitimate. It silences
|
|
1956
|
+
* other people, so it is off unless a rule deliberately allows it.
|
|
1957
|
+
*
|
|
1958
|
+
* `.optional()`, deliberately NOT `.default()`: a Zod default does not run on
|
|
1959
|
+
* the addon cap path (three production failures in one day), so absent is
|
|
1960
|
+
* read as `false` by {@link canSetGlobal} in the engine. Admins are not bound
|
|
1961
|
+
* by this flag — see the scope rules on that function.
|
|
1962
|
+
*/
|
|
1963
|
+
snoozeAllowGlobal: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
1964
|
+
/**
|
|
1965
|
+
* The snooze durations THIS rule's notification offers as buttons, in
|
|
1966
|
+
* minutes.
|
|
1967
|
+
*
|
|
1968
|
+
* Three states, and all three are distinct — which is exactly why this is
|
|
1969
|
+
* `.optional()` and never `.default()`. A Zod default does not run on the
|
|
1970
|
+
* addon cap path (three production failures in one day), so a schema default
|
|
1971
|
+
* would collapse the first two:
|
|
1972
|
+
*
|
|
1973
|
+
* | value | meaning |
|
|
1974
|
+
* | --- | --- |
|
|
1975
|
+
* | absent | the operator never said ⇒ {@link NC_DEFAULT_SNOOZE_MINUTES} |
|
|
1976
|
+
* | `[]` | **no snooze buttons on this rule** — the explicit override |
|
|
1977
|
+
* | a list | these choices, de-duplicated and sorted, at most four |
|
|
1978
|
+
*
|
|
1979
|
+
* `.max(4)` because the notifier's own action budget is small (ntfy allows
|
|
1980
|
+
* three buttons in total) and a rule that spent it all on snooze choices
|
|
1981
|
+
* would push its own tap-through actions off the notification.
|
|
1982
|
+
*
|
|
1983
|
+
* An empty list is NOT an alarm exemption: a rule the alarm is about, or
|
|
1984
|
+
* that arms the panel, is exempt automatically and cannot be silenced by a
|
|
1985
|
+
* window from anywhere (D133).
|
|
1986
|
+
*/
|
|
1987
|
+
snoozeOptions: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int().min(1).max(NC_SNOOZE_MAX_MINUTES)).max(4).optional(),
|
|
1988
|
+
/**
|
|
1989
|
+
* Devices this rule ACTUATES — arm the alarm, open a gate, turn on a light.
|
|
1990
|
+
*
|
|
1991
|
+
* This is what makes the rule set the alarm's trigger set without the alarm
|
|
1992
|
+
* being a special case: arming is
|
|
1993
|
+
* `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
|
|
1994
|
+
* shape as every other actuation.
|
|
1995
|
+
*/
|
|
1996
|
+
actions: /* @__PURE__ */ NcRuleActionsSchema.optional(),
|
|
1997
|
+
/**
|
|
1998
|
+
* AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
|
|
1999
|
+
* a rule that predates the gate must keep delivering byte-for-byte as it
|
|
2000
|
+
* did, and absent is the only way to say that without a migration.
|
|
2001
|
+
*/
|
|
2002
|
+
confirm: /* @__PURE__ */ NcConfirmSchema.optional(),
|
|
2003
|
+
/**
|
|
2004
|
+
* IMMEDIATE GROUPED (D692): the first matching subject opens a window of this many
|
|
2005
|
+
* seconds; the rule sends ONE message when the window closes — early, once every
|
|
2006
|
+
* subject in it is final, never before {@link NC_GROUPING_MIN_SEC} — naming everybody
|
|
2007
|
+
* the rule matched, with one mosaic tile per subject.
|
|
2008
|
+
* Absent = plain immediate (one message per track, at the first match).
|
|
2009
|
+
* Only an `immediate` DETECTION rule may carry it (`ruleGroupingApplies`, enforced on
|
|
2010
|
+
* save by the hub's grouping guard). `.optional()`, never `.default()`: the addon cap
|
|
2011
|
+
* path does not run Zod defaults.
|
|
2012
|
+
*/
|
|
2013
|
+
groupingSec: /* @__PURE__ */ zod.z.number().int().min(5).max(60).optional(),
|
|
2014
|
+
/**
|
|
2015
|
+
* Hold deliveries of this rule to one target and, when two or more arrive
|
|
2016
|
+
* before the window ends, send them as one summary. Absent = the kind's
|
|
2017
|
+
* default (`groupWithinSecOf`): 5 s for a system-event rule, 0 for every
|
|
2018
|
+
* other kind. `0` sends each delivery as it does today.
|
|
2019
|
+
*/
|
|
2020
|
+
groupWithinSec: /* @__PURE__ */ zod.z.number().int().min(0).max(300).optional(),
|
|
2021
|
+
/**
|
|
2022
|
+
* ASK ME TO CONFIRM DETECTIONS (#243): a DETECTION notification of this rule
|
|
2023
|
+
* carries "Correct" / "Wrong" buttons (and, where the channel has room, a
|
|
2024
|
+
* "Wrong, it is a <class>" choice). A tap marks the track for retraining, the
|
|
2025
|
+
* same mark the Library writes, and records whose notification it was and
|
|
2026
|
+
* when. A channel with no buttons gets the same two choices as links.
|
|
2027
|
+
*
|
|
2028
|
+
* `.optional()`, never `.default()` (a Zod default does not run on the addon
|
|
2029
|
+
* cap path): absent and `false` both mean off, which is what every rule
|
|
2030
|
+
* authored before this field meant. An editor turns it off by writing
|
|
2031
|
+
* `false`, so it needs no `clear` key.
|
|
2032
|
+
*/
|
|
2033
|
+
askVerdict: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
2034
|
+
/**
|
|
2035
|
+
* An ALERT notification (`alert-critical`, `alert-error`, device attention)
|
|
2036
|
+
* carries the alert's own action — an open-URL button and, for an `invoke`
|
|
2037
|
+
* action, a token-authed button that runs it. Absent and `true` mean ON;
|
|
2038
|
+
* `false` switches it off for this rule. `.optional()`, never `.default()`
|
|
2039
|
+
* (a Zod default does not run on the addon cap path), so a rule authored
|
|
2040
|
+
* before this field keeps the action.
|
|
2041
|
+
*/
|
|
2042
|
+
offerAlertAction: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
2043
|
+
/**
|
|
2044
|
+
* Operator tags (D1054), kept on the rule like a core block's. Absent = no
|
|
2045
|
+
* tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
|
|
2046
|
+
* does not name `tags` keeps the stored ones (the store merges), and an
|
|
2047
|
+
* editor empties them by sending `[]` (the store drops an empty list).
|
|
2048
|
+
* Renamed or removed fleet-wide only through the `tags` cap, which writes
|
|
2049
|
+
* here with `setRuleTags`.
|
|
2050
|
+
*/
|
|
2051
|
+
tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional()
|
|
2052
|
+
});
|
|
2053
|
+
/**
|
|
2054
|
+
* The rule kinds that carry tags (D1054) — each one its own store. Every kind
|
|
2055
|
+
* labels its rules the same way; this names which store a tag write goes to.
|
|
2056
|
+
*/
|
|
2057
|
+
var NcTaggedRuleKindSchema = /* @__PURE__ */ zod.z.enum([
|
|
2058
|
+
"event",
|
|
2059
|
+
"summary",
|
|
2060
|
+
"timelapse",
|
|
2061
|
+
"calendar-events"
|
|
2062
|
+
]);
|
|
2063
|
+
/** One rule's tags, as the `tags` cap reads them across every kind. */
|
|
2064
|
+
var NcRuleTagsEntrySchema = /* @__PURE__ */ zod.z.object({
|
|
2065
|
+
kind: NcTaggedRuleKindSchema,
|
|
2066
|
+
ruleId: /* @__PURE__ */ zod.z.string(),
|
|
2067
|
+
tags: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string())
|
|
2068
|
+
});
|
|
2069
|
+
/**
|
|
2070
|
+
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
2071
|
+
* persisted-only {@link NcRuleSchema} `disabledTargetIds` set. The latter is
|
|
2072
|
+
* NOT a client-authored input field (it lives on the persisted rule, not the
|
|
2073
|
+
* input), so it is added here explicitly to let the store's per-target opt-out
|
|
2074
|
+
* toggle round-trip through the shared `update` path. Viewer opt-out mutations
|
|
2075
|
+
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
2076
|
+
* `updateRule` patch.
|
|
2077
|
+
*/
|
|
2078
|
+
var NcRulePatchSchema = /* @__PURE__ */ NcRuleInputSchema.partial().extend({
|
|
2079
|
+
disabledTargetIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).optional(),
|
|
2080
|
+
/**
|
|
2081
|
+
* `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
|
|
2082
|
+
*
|
|
2083
|
+
* It makes the key optional to SUPPLY; the parse still materialises the
|
|
2084
|
+
* default when the key is absent. And `NcRuleStore.update` merges with
|
|
2085
|
+
* `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
|
|
2086
|
+
* one — which made every partial edit destructive:
|
|
2087
|
+
*
|
|
2088
|
+
* nc.updateRule({ throttle }) → conditions reset to `{}`
|
|
2089
|
+
* nc.setRuleTargetEnabled(...) → conditions reset to `{}`
|
|
2090
|
+
* setEnabled(ruleId, false) → conditions reset to `{}`
|
|
2091
|
+
*
|
|
2092
|
+
* A rule scoped to one camera and one zone silently became a rule that
|
|
2093
|
+
* matches EVERY event on EVERY camera, and lost its `media` policy
|
|
2094
|
+
* (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
|
|
2095
|
+
* live on 2026-08-12: a rule scoped to device 102 fired on 104 and 101
|
|
2096
|
+
* within a minute of a two-field patch.
|
|
2097
|
+
*
|
|
2098
|
+
* So every defaulted field is re-declared here WITHOUT its default. The
|
|
2099
|
+
* inner defaults still apply when the caller DOES send the key — `{}` for
|
|
2100
|
+
* conditions remains a real instruction ("clear them") — and only the
|
|
2101
|
+
* absent key is now genuinely absent.
|
|
2102
|
+
*/
|
|
2103
|
+
enabled: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
2104
|
+
conditions: /* @__PURE__ */ NcConditionsSchema.optional(),
|
|
2105
|
+
media: /* @__PURE__ */ NcMediaPolicySchema.optional(),
|
|
2106
|
+
throttle: /* @__PURE__ */ NcThrottleSchema.optional(),
|
|
2107
|
+
priority: /* @__PURE__ */ zod.z.number().int().min(1).max(5).optional()
|
|
2108
|
+
});
|
|
2109
|
+
var NcRuleClearableKeySchema = /* @__PURE__ */ zod.z.enum([
|
|
2110
|
+
"template",
|
|
2111
|
+
"schedule",
|
|
2112
|
+
"targetUsers",
|
|
2113
|
+
"snoozeOptions",
|
|
2114
|
+
"snoozeAllowGlobal",
|
|
2115
|
+
"actions",
|
|
2116
|
+
"confirm",
|
|
2117
|
+
"groupingSec",
|
|
2118
|
+
"waitForEnhancement",
|
|
2119
|
+
"groupIdleSec"
|
|
2120
|
+
]);
|
|
2121
|
+
var NcRuleUpdateInputSchema = /* @__PURE__ */ zod.z.object({
|
|
2122
|
+
ruleId: /* @__PURE__ */ zod.z.string(),
|
|
2123
|
+
patch: NcRulePatchSchema,
|
|
2124
|
+
clear: /* @__PURE__ */ zod.z.array(NcRuleClearableKeySchema).optional()
|
|
2125
|
+
});
|
|
2126
|
+
/** A persisted rule. */
|
|
2127
|
+
var NcRuleSchema = /* @__PURE__ */ NcRuleInputSchema.extend({
|
|
2128
|
+
id: /* @__PURE__ */ zod.z.string(),
|
|
2129
|
+
/** userId of the admin who created the rule (server-stamped caller). */
|
|
2130
|
+
createdBy: /* @__PURE__ */ zod.z.string(),
|
|
2131
|
+
createdAt: /* @__PURE__ */ zod.z.number(),
|
|
2132
|
+
updatedAt: /* @__PURE__ */ zod.z.number(),
|
|
2133
|
+
/**
|
|
2134
|
+
* Per-target opt-out set. A targetId here is suppressed for THIS rule at
|
|
2135
|
+
* send time. Only a target's OWNER may add/remove its id (server-checked
|
|
2136
|
+
* in `nc.setRuleTargetEnabled`). Defaults to empty.
|
|
2137
|
+
*/
|
|
2138
|
+
disabledTargetIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).default([])
|
|
2139
|
+
});
|
|
2140
|
+
var NcStateSummarySectionIdSchema = /* @__PURE__ */ zod.z.enum([
|
|
2141
|
+
"device-state",
|
|
2142
|
+
"streams",
|
|
2143
|
+
"battery",
|
|
2144
|
+
"consumables",
|
|
2145
|
+
"detection-blind",
|
|
2146
|
+
"nodes",
|
|
2147
|
+
"addons",
|
|
2148
|
+
"addon-updates",
|
|
2149
|
+
"updates"
|
|
2150
|
+
]);
|
|
2151
|
+
/** One section of a previewed state summary. `unavailable` = its state could not be read. */
|
|
2152
|
+
var NcStateSummaryPreviewSectionSchema = /* @__PURE__ */ zod.z.object({
|
|
2153
|
+
id: NcStateSummarySectionIdSchema,
|
|
2154
|
+
status: /* @__PURE__ */ zod.z.enum(["read", "unavailable"]),
|
|
2155
|
+
items: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
2156
|
+
reason: /* @__PURE__ */ zod.z.string().optional()
|
|
2157
|
+
});
|
|
2158
|
+
/**
|
|
2159
|
+
* One notification a previewed summary would send (D698): the whole summary on
|
|
2160
|
+
* a `rule` split (no `section`), one section's on a `section` split.
|
|
2161
|
+
*/
|
|
2162
|
+
var NcStateSummaryPreviewRowSchema = /* @__PURE__ */ zod.z.object({
|
|
2163
|
+
section: /* @__PURE__ */ NcStateSummarySectionIdSchema.optional(),
|
|
2164
|
+
/** The section's name on a per-section row; every reported section's, joined, on a combined one. */
|
|
2165
|
+
title: /* @__PURE__ */ zod.z.string(),
|
|
2166
|
+
text: /* @__PURE__ */ zod.z.string(),
|
|
2167
|
+
count: /* @__PURE__ */ zod.z.number().int().nonnegative()
|
|
2168
|
+
});
|
|
2169
|
+
/**
|
|
2170
|
+
* The summary a rule would send now. `empty` = nothing to report and every
|
|
2171
|
+
* section read: such a summary is NOT sent. `dropped` counts the open states
|
|
2172
|
+
* the rule's own filters (or a camera mute) left out, by reason.
|
|
2173
|
+
* `excludedGroups` names the kind groups selected that have no state to report
|
|
2174
|
+
* (backups & exports). `split` and `rows` (D698) say how it would be sent —
|
|
2175
|
+
* optional, so an older hub's answer still parses.
|
|
2176
|
+
*/
|
|
2177
|
+
var NcStateSummaryPreviewSchema = /* @__PURE__ */ zod.z.object({
|
|
2178
|
+
empty: /* @__PURE__ */ zod.z.boolean(),
|
|
2179
|
+
count: /* @__PURE__ */ zod.z.number().int().nonnegative(),
|
|
2180
|
+
text: /* @__PURE__ */ zod.z.string(),
|
|
2181
|
+
sections: /* @__PURE__ */ zod.z.array(NcStateSummaryPreviewSectionSchema),
|
|
2182
|
+
dropped: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.number().int().nonnegative()),
|
|
2183
|
+
excludedGroups: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()),
|
|
2184
|
+
split: /* @__PURE__ */ NcStateSummarySplitSchema.optional(),
|
|
2185
|
+
rows: /* @__PURE__ */ zod.z.array(NcStateSummaryPreviewRowSchema).optional()
|
|
2186
|
+
});
|
|
2187
|
+
var NcTestResultSchema = /* @__PURE__ */ zod.z.object({
|
|
2188
|
+
recordId: /* @__PURE__ */ zod.z.string(),
|
|
2189
|
+
recordKind: /* @__PURE__ */ zod.z.enum([
|
|
2190
|
+
"object-event",
|
|
2191
|
+
"track",
|
|
2192
|
+
"device-event",
|
|
2193
|
+
"package-event",
|
|
2194
|
+
"system-event"
|
|
2195
|
+
]),
|
|
2196
|
+
deviceId: /* @__PURE__ */ zod.z.number(),
|
|
2197
|
+
timestamp: /* @__PURE__ */ zod.z.number(),
|
|
2198
|
+
wouldFire: /* @__PURE__ */ zod.z.boolean(),
|
|
2199
|
+
/** Condition id that failed (first failing group), when `wouldFire` is false. */
|
|
2200
|
+
failedCondition: /* @__PURE__ */ zod.z.string().optional(),
|
|
2201
|
+
className: /* @__PURE__ */ zod.z.string().optional(),
|
|
2202
|
+
label: /* @__PURE__ */ zod.z.string().optional()
|
|
2203
|
+
});
|
|
2204
|
+
/** The rule kinds, as data. `NcRuleKind` in `notification/rule-kinds.ts` is
|
|
2205
|
+
* `z.infer` of this schema — one shape, no twin. `mixed` is DERIVED
|
|
2206
|
+
* (a stored system rule whose kinds span families, D637) and never authored. */
|
|
2207
|
+
var NcRuleKindSchema = /* @__PURE__ */ zod.z.enum([
|
|
2208
|
+
"detection",
|
|
2209
|
+
"sensor",
|
|
2210
|
+
"occupancy",
|
|
2211
|
+
"sound",
|
|
2212
|
+
"device-events",
|
|
2213
|
+
"system",
|
|
2214
|
+
"alarm",
|
|
2215
|
+
"mixed"
|
|
2216
|
+
]);
|
|
2217
|
+
/**
|
|
2218
|
+
* The kinds a SERVED template-variable descriptor may name: the five that
|
|
2219
|
+
* existed before D637, frozen. `getTemplateCatalog` ships `kinds` to every
|
|
2220
|
+
* installed viewer, and a viewer at `@camstack/types` 1.2.25x parses them with a
|
|
2221
|
+
* strict five-member enum — one `device-events` in one descriptor fails the
|
|
2222
|
+
* whole catalog parse. So the WIRE says `system`, and the MATCH widens it:
|
|
2223
|
+
* `templateVarKindApplies` reads a `system` descriptor as applying to every
|
|
2224
|
+
* system rule kind (`device-events`, `system`, `alarm`, `mixed`).
|
|
2225
|
+
*/
|
|
2226
|
+
var NcTemplateVarKindSchema = /* @__PURE__ */ zod.z.enum([
|
|
2227
|
+
"detection",
|
|
2228
|
+
"sensor",
|
|
2229
|
+
"occupancy",
|
|
2230
|
+
"sound",
|
|
2231
|
+
"system"
|
|
2232
|
+
]);
|
|
2233
|
+
/**
|
|
2234
|
+
* The default title/body a rule of one SITUATION is delivered with when the
|
|
2235
|
+
* operator wrote no template — served so an editor can pre-fill it (and the
|
|
2236
|
+
* operator can rebuild it from placeholders) instead of starting from a blank
|
|
2237
|
+
* box that, once saved, silently replaces it. `id` names the situation inside
|
|
2238
|
+
* a rule `kind`: `appliance-cycle` is a `sensor` rule whose device is an
|
|
2239
|
+
* appliance finishing a cycle. Texts are raw templates (`{{var}}` intact), in
|
|
2240
|
+
* the hub's current language and with its overrides applied.
|
|
2241
|
+
*/
|
|
2242
|
+
var NcTemplateDefaultSchema = /* @__PURE__ */ zod.z.object({
|
|
2243
|
+
id: /* @__PURE__ */ zod.z.enum(["appliance-cycle"]),
|
|
2244
|
+
kind: NcRuleKindSchema,
|
|
2245
|
+
title: /* @__PURE__ */ zod.z.string(),
|
|
2246
|
+
body: /* @__PURE__ */ zod.z.string()
|
|
2247
|
+
});
|
|
2248
|
+
/** Which producer renders a template: an ordinary rule, a timelapse, a digest. */
|
|
2249
|
+
var NcTemplateFamilySchema = /* @__PURE__ */ zod.z.enum([
|
|
2250
|
+
"rule",
|
|
2251
|
+
"timelapse",
|
|
2252
|
+
"summary"
|
|
2253
|
+
]);
|
|
2254
|
+
/** Which text field of that producer. `previewText` is the timelapse frame
|
|
2255
|
+
* caption, `captionText` the digest mosaic caption — both see fewer vars. */
|
|
2256
|
+
var NcTemplateFieldSchema = /* @__PURE__ */ zod.z.enum([
|
|
2257
|
+
"title",
|
|
2258
|
+
"body",
|
|
2259
|
+
"previewText",
|
|
2260
|
+
"captionText"
|
|
2261
|
+
]);
|
|
2262
|
+
var NcTemplateVarGroupSchema = /* @__PURE__ */ zod.z.enum([
|
|
2263
|
+
"subject",
|
|
2264
|
+
"place",
|
|
2265
|
+
"time",
|
|
2266
|
+
"rule",
|
|
2267
|
+
"occupancy",
|
|
2268
|
+
"sound",
|
|
2269
|
+
"sensor",
|
|
2270
|
+
"system",
|
|
2271
|
+
"digest",
|
|
2272
|
+
"ai"
|
|
2273
|
+
]);
|
|
2274
|
+
/**
|
|
2275
|
+
* ONE `{{var}}` a notification template may name.
|
|
2276
|
+
*
|
|
2277
|
+
* `families` / `fields` / `kinds` / `deliveries` / `systemEventKinds` say WHERE
|
|
2278
|
+
* it has a value; absent = no restriction on that axis. `systemEventKinds` is
|
|
2279
|
+
* read only for a system-event rule (any family, or `mixed`). `dynamic` declares a FAMILY of names
|
|
2280
|
+
* (`count_<class>`): the descriptor's `name` is the example member.
|
|
2281
|
+
*/
|
|
2282
|
+
var NcTemplateVarDescriptorSchema = /* @__PURE__ */ zod.z.object({
|
|
2283
|
+
name: /* @__PURE__ */ zod.z.string().regex(/^\w+$/),
|
|
2284
|
+
label: /* @__PURE__ */ zod.z.string(),
|
|
2285
|
+
description: /* @__PURE__ */ zod.z.string().optional(),
|
|
2286
|
+
example: /* @__PURE__ */ zod.z.string(),
|
|
2287
|
+
group: NcTemplateVarGroupSchema,
|
|
2288
|
+
families: /* @__PURE__ */ zod.z.array(NcTemplateFamilySchema).min(1),
|
|
2289
|
+
fields: /* @__PURE__ */ zod.z.array(NcTemplateFieldSchema).optional(),
|
|
2290
|
+
kinds: /* @__PURE__ */ zod.z.array(NcTemplateVarKindSchema).optional(),
|
|
2291
|
+
deliveries: /* @__PURE__ */ zod.z.array(NcDeliverySchema).optional(),
|
|
2292
|
+
systemEventKinds: /* @__PURE__ */ zod.z.array(NcSystemEventKindSchema).optional(),
|
|
2293
|
+
/**
|
|
2294
|
+
* Which system-event DELIVERY has a value for it (D647). Absent = an
|
|
2295
|
+
* instant row only when the descriptor names `systemEventKinds` (a
|
|
2296
|
+
* per-event fact: a summary row has no single device), and both otherwise.
|
|
2297
|
+
* `['summary']` marks the state-summary vocabulary (`{{summaryText}}`, ...).
|
|
2298
|
+
*/
|
|
2299
|
+
systemEventDeliveries: /* @__PURE__ */ zod.z.array(NcSystemEventDeliveryModeSchema).optional(),
|
|
2300
|
+
dynamic: /* @__PURE__ */ zod.z.object({
|
|
2301
|
+
prefix: /* @__PURE__ */ zod.z.literal("count_"),
|
|
2302
|
+
from: /* @__PURE__ */ zod.z.literal("classes")
|
|
2303
|
+
}).optional()
|
|
2304
|
+
});
|
|
2305
|
+
/** What an editor knows about the field being edited. */
|
|
2306
|
+
var NcTemplateVarContextSchema = /* @__PURE__ */ zod.z.object({
|
|
2307
|
+
family: NcTemplateFamilySchema,
|
|
2308
|
+
field: NcTemplateFieldSchema,
|
|
2309
|
+
kind: /* @__PURE__ */ NcRuleKindSchema.optional(),
|
|
2310
|
+
delivery: /* @__PURE__ */ NcDeliverySchema.optional(),
|
|
2311
|
+
systemEventKinds: /* @__PURE__ */ zod.z.array(NcSystemEventKindSchema).optional(),
|
|
2312
|
+
/** The rule's system-event delivery (D647); absent = instant. */
|
|
2313
|
+
systemEventDelivery: /* @__PURE__ */ NcSystemEventDeliveryModeSchema.optional()
|
|
2314
|
+
});
|
|
2315
|
+
/** Input to `previewTemplate` — the editor's own context, plus the draft text. */
|
|
2316
|
+
var NcTemplatePreviewInputSchema = /* @__PURE__ */ zod.z.object({
|
|
2317
|
+
context: NcTemplateVarContextSchema,
|
|
2318
|
+
template: /* @__PURE__ */ zod.z.object({
|
|
2319
|
+
title: /* @__PURE__ */ zod.z.string().max(500).optional(),
|
|
2320
|
+
body: /* @__PURE__ */ zod.z.string().max(2e3).optional()
|
|
2321
|
+
})
|
|
2322
|
+
});
|
|
2323
|
+
var NcTemplatePreviewSchema = /* @__PURE__ */ zod.z.object({
|
|
2324
|
+
title: /* @__PURE__ */ zod.z.string().nullable(),
|
|
2325
|
+
body: /* @__PURE__ */ zod.z.string().nullable(),
|
|
2326
|
+
/** Names the template uses that this context never fills — they render empty. */
|
|
2327
|
+
unknown: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string())
|
|
2328
|
+
});
|
|
2329
|
+
var NcConditionDescriptorSchema = /* @__PURE__ */ zod.z.object({
|
|
2330
|
+
/** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
|
|
2331
|
+
id: /* @__PURE__ */ zod.z.string(),
|
|
2332
|
+
group: /* @__PURE__ */ zod.z.enum([
|
|
2333
|
+
"scope",
|
|
2334
|
+
"class",
|
|
2335
|
+
"zones",
|
|
2336
|
+
"quality",
|
|
2337
|
+
"label",
|
|
2338
|
+
"schedule",
|
|
2339
|
+
"device",
|
|
2340
|
+
"package",
|
|
2341
|
+
"occupancy",
|
|
2342
|
+
"audio",
|
|
2343
|
+
"system"
|
|
2344
|
+
]),
|
|
2345
|
+
label: /* @__PURE__ */ zod.z.string(),
|
|
2346
|
+
/** Editor widget the UI renders — never hardcode per-condition forms. */
|
|
2347
|
+
valueType: /* @__PURE__ */ zod.z.enum([
|
|
2348
|
+
"deviceIdList",
|
|
2349
|
+
"deviceIdExcludeList",
|
|
2350
|
+
"stringList",
|
|
2351
|
+
"number01",
|
|
2352
|
+
"number",
|
|
2353
|
+
"sourceSelect",
|
|
2354
|
+
"zoneSelection",
|
|
2355
|
+
"zoneIdList",
|
|
2356
|
+
"schedule",
|
|
2357
|
+
"plateMatcher",
|
|
2358
|
+
"packagePhase",
|
|
2359
|
+
"crossingSelect",
|
|
2360
|
+
"sensorTransition",
|
|
2361
|
+
"polygonDraw",
|
|
2362
|
+
"occupancy",
|
|
2363
|
+
"audio",
|
|
2364
|
+
"deviceState",
|
|
2365
|
+
"scene",
|
|
2366
|
+
"systemEvent"
|
|
2367
|
+
]),
|
|
2368
|
+
operator: /* @__PURE__ */ zod.z.enum([
|
|
2369
|
+
"in",
|
|
2370
|
+
"notIn",
|
|
2371
|
+
"anyOf",
|
|
2372
|
+
"allOf",
|
|
2373
|
+
"gte",
|
|
2374
|
+
"fuzzyIn",
|
|
2375
|
+
"withinSchedule"
|
|
2376
|
+
]),
|
|
2377
|
+
/** Which delivery kinds the condition applies to. */
|
|
2378
|
+
appliesTo: /* @__PURE__ */ zod.z.array(NcDeliverySchema),
|
|
2379
|
+
phase: /* @__PURE__ */ zod.z.string(),
|
|
2380
|
+
description: /* @__PURE__ */ zod.z.string().optional(),
|
|
2381
|
+
/**
|
|
2382
|
+
* The CHOICES for a single-choice widget (`sourceSelect`, `crossingSelect`,
|
|
2383
|
+
* `packagePhase`, …), served with the descriptor.
|
|
2384
|
+
*
|
|
2385
|
+
* Before this the descriptor said which widget to render and not what to put
|
|
2386
|
+
* in it, so every option list lived in three places: this file's enums, the
|
|
2387
|
+
* admin's `NC_*_OPTIONS` and the viewer's `NC_*_VALUES`. That triple mirror
|
|
2388
|
+
* is the drift that emptied the viewer's rule editor on 2026-08-04 — the app
|
|
2389
|
+
* mirrors the cap by hand, so it is only ever as current as its last build.
|
|
2390
|
+
*
|
|
2391
|
+
* With the options on the wire, a condition of an EXISTING `valueType` costs
|
|
2392
|
+
* zero client changes. Clients keep a local fallback for an older hub that
|
|
2393
|
+
* does not send them; absent here is "use your own list", not "no choices".
|
|
2394
|
+
*/
|
|
2395
|
+
options: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
|
|
2396
|
+
/** Written to the rule verbatim. `''` means the ABSENT state. */
|
|
2397
|
+
value: /* @__PURE__ */ zod.z.string(),
|
|
2398
|
+
label: /* @__PURE__ */ zod.z.string(),
|
|
2399
|
+
/** What THIS choice matches — shown one at a time, under the control. */
|
|
2400
|
+
hint: /* @__PURE__ */ zod.z.string().optional()
|
|
2401
|
+
})).readonly().optional()
|
|
2402
|
+
});
|
|
2403
|
+
/**
|
|
2404
|
+
* The delivery lifecycle status of a history row — a straight read of the
|
|
2405
|
+
* durable outbox row's own status (single source of truth):
|
|
2406
|
+
* - `pending` — enqueued, in-flight or retrying with backoff
|
|
2407
|
+
* - `sent` — delivered (terminal)
|
|
2408
|
+
* - `dead` — dead-lettered after exhausting retries / a permanent
|
|
2409
|
+
* backend rejection / a deleted target (terminal; carries
|
|
2410
|
+
* the failure `error`)
|
|
2411
|
+
*
|
|
2412
|
+
* P1 has no `suppressed-quiet-hours` / `snoozed` states — those ride the P2
|
|
2413
|
+
* user dimension (quiet hours / snooze) and are additive when they land.
|
|
2414
|
+
*/
|
|
2415
|
+
var NcHistoryStatusSchema = /* @__PURE__ */ zod.z.enum([
|
|
2416
|
+
"pending",
|
|
2417
|
+
"sent",
|
|
2418
|
+
"dead"
|
|
2419
|
+
]);
|
|
2420
|
+
/** The evaluated record kind a history row descends from (one per trigger). */
|
|
2421
|
+
var NcHistoryRecordKindSchema = /* @__PURE__ */ zod.z.enum([
|
|
2422
|
+
"object-event",
|
|
2423
|
+
"track-end",
|
|
2424
|
+
"device-event",
|
|
2425
|
+
"package-event",
|
|
2426
|
+
"system-event"
|
|
2427
|
+
]);
|
|
2428
|
+
/** Subject summary frozen on the row at fire time (survives rule/record edits). */
|
|
2429
|
+
var NcHistorySubjectSchema = /* @__PURE__ */ zod.z.object({
|
|
2430
|
+
className: /* @__PURE__ */ zod.z.string(),
|
|
2431
|
+
label: /* @__PURE__ */ zod.z.string().optional(),
|
|
2432
|
+
confidence: /* @__PURE__ */ zod.z.number().optional(),
|
|
2433
|
+
zones: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()),
|
|
2434
|
+
timestamp: /* @__PURE__ */ zod.z.number(),
|
|
2435
|
+
systemEvent: /* @__PURE__ */ zod.z.object({
|
|
2436
|
+
kind: NcSystemEventKindSchema,
|
|
2437
|
+
subject: /* @__PURE__ */ zod.z.string(),
|
|
2438
|
+
title: /* @__PURE__ */ zod.z.string(),
|
|
2439
|
+
body: /* @__PURE__ */ zod.z.string(),
|
|
2440
|
+
data: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown())
|
|
2441
|
+
}).optional()
|
|
2442
|
+
});
|
|
2443
|
+
/**
|
|
2444
|
+
* One delivery-history row. This is a read-only VIEW over the durable
|
|
2445
|
+
* outbox row (single source of truth — the same row the drain loop drives;
|
|
2446
|
+
* NO second write path, so history can never drift from delivery state).
|
|
2447
|
+
* The §3.2 fields map directly: `ruleId`/`targetId`/`deviceId` are columns,
|
|
2448
|
+
* `eventRef` is `recordKind`+`recordId`, `timestamps` are `createdAt`
|
|
2449
|
+
* (fire) / `updatedAt` (last transition), `status` + `error` are the
|
|
2450
|
+
* lifecycle. `ruleName` + `subject` are the intent snapshot frozen at
|
|
2451
|
+
* enqueue. `userId?` (per-recipient history) is P2 — no user dimension in
|
|
2452
|
+
* P1 (admin scope only).
|
|
2453
|
+
*/
|
|
2454
|
+
var NcHistoryEntrySchema = /* @__PURE__ */ zod.z.object({
|
|
2455
|
+
/** Outbox row id — the stable dedup id `ruleId:dedupRef:targetId`. */
|
|
2456
|
+
id: /* @__PURE__ */ zod.z.string(),
|
|
2457
|
+
ruleId: /* @__PURE__ */ zod.z.string(),
|
|
2458
|
+
/** Rule name frozen at fire time (outlives a later rename / delete). */
|
|
2459
|
+
ruleName: /* @__PURE__ */ zod.z.string(),
|
|
2460
|
+
/** The rule urgency/trigger that produced this delivery. */
|
|
2461
|
+
delivery: NcDeliverySchema,
|
|
2462
|
+
targetId: /* @__PURE__ */ zod.z.string(),
|
|
2463
|
+
deviceId: /* @__PURE__ */ zod.z.number(),
|
|
2464
|
+
recordKind: NcHistoryRecordKindSchema,
|
|
2465
|
+
/** Event / track ref of the evaluated record (§3.2 `eventRef`). */
|
|
2466
|
+
recordId: /* @__PURE__ */ zod.z.string(),
|
|
2467
|
+
/** Present for track-scoped deliveries (object-event / track-end). */
|
|
2468
|
+
trackId: /* @__PURE__ */ zod.z.string().optional(),
|
|
2469
|
+
status: NcHistoryStatusSchema,
|
|
2470
|
+
/** Delivery attempts made so far. */
|
|
2471
|
+
attempts: /* @__PURE__ */ zod.z.number().int(),
|
|
2472
|
+
/** Fire time (outbox enqueue). */
|
|
2473
|
+
createdAt: /* @__PURE__ */ zod.z.number(),
|
|
2474
|
+
/** Last transition time (terminal for sent / dead). */
|
|
2475
|
+
updatedAt: /* @__PURE__ */ zod.z.number(),
|
|
2476
|
+
/** Failure detail — present on a `dead` row. */
|
|
2477
|
+
error: /* @__PURE__ */ zod.z.string().optional(),
|
|
2478
|
+
subject: NcHistorySubjectSchema,
|
|
2479
|
+
/**
|
|
2480
|
+
* The title and body actually sent, frozen at delivery. Absent on a row
|
|
2481
|
+
* still pending, a row suppressed before a notification was built, and a
|
|
2482
|
+
* row delivered before this field shipped.
|
|
2483
|
+
*/
|
|
2484
|
+
title: /* @__PURE__ */ zod.z.string().optional(),
|
|
2485
|
+
body: /* @__PURE__ */ zod.z.string().optional(),
|
|
2486
|
+
/**
|
|
2487
|
+
* Ids of the artefacts (still, then gif, then clip) this row's successful
|
|
2488
|
+
* delivery indexed in the artefact library — a REFERENCE, never the bytes
|
|
2489
|
+
* (an artefact is often megabytes; this row is durable JSON rewritten on
|
|
2490
|
+
* every delivery attempt). Absent on a row still pending/dead, a row
|
|
2491
|
+
* delivered before this field shipped, or a wiring with no artefact index.
|
|
2492
|
+
*
|
|
2493
|
+
* Resolve one to a fetchable URL with `resolveArtifactUrl` — an id
|
|
2494
|
+
* outlives any one URL's TTL, so a caller mints a fresh link on demand
|
|
2495
|
+
* rather than trusting one frozen at delivery time. `resolveArtifactUrl`
|
|
2496
|
+
* also answers `null` for an id whose artefact has since expired past the
|
|
2497
|
+
* retained shelf's own age bound — the degrade a caller (the Home
|
|
2498
|
+
* Assistant export) must render as "no image right now", never as a
|
|
2499
|
+
* broken link.
|
|
2500
|
+
*/
|
|
2501
|
+
artifactIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
|
|
2502
|
+
/**
|
|
2503
|
+
* When this row was folded into a group-window summary, the outbox id of
|
|
2504
|
+
* that one notification. Absent on a row that was sent as itself.
|
|
2505
|
+
*/
|
|
2506
|
+
groupedInto: /* @__PURE__ */ zod.z.string().min(1).optional()
|
|
2507
|
+
});
|
|
2508
|
+
/**
|
|
2509
|
+
* Query filter for `getHistory` (spec §4.2). Every field is a narrowing
|
|
2510
|
+
* AND; absent = unbounded on that axis. `since`/`until` bound the fire time
|
|
2511
|
+
* (`createdAt`, epoch ms, inclusive). `limit` is clamped to
|
|
2512
|
+
* {@link NC_HISTORY_LIMIT_MAX}. `userId` (per-recipient filtering) is P2.
|
|
2513
|
+
*/
|
|
2514
|
+
var NcHistoryFilterSchema = /* @__PURE__ */ zod.z.object({
|
|
2515
|
+
ruleId: /* @__PURE__ */ zod.z.string().optional(),
|
|
2516
|
+
deviceId: /* @__PURE__ */ zod.z.number().optional(),
|
|
2517
|
+
status: /* @__PURE__ */ NcHistoryStatusSchema.optional(),
|
|
2518
|
+
since: /* @__PURE__ */ zod.z.number().optional(),
|
|
2519
|
+
until: /* @__PURE__ */ zod.z.number().optional(),
|
|
2520
|
+
limit: /* @__PURE__ */ zod.z.number().int().min(1).max(500).default(100)
|
|
2521
|
+
});
|
|
2522
|
+
/**
|
|
2523
|
+
* The newest delivery row of ONE rule — the "Last run" of a rules table.
|
|
2524
|
+
*
|
|
2525
|
+
* A projection of the same outbox rows `getHistory` returns, so it records
|
|
2526
|
+
* DELIVERIES only: a throttled or unmatched evaluation never produced a row
|
|
2527
|
+
* and is not a run here. When one fire reached several targets (several rows
|
|
2528
|
+
* at the same `lastAt`), `status` is the least successful of them
|
|
2529
|
+
* (`dead` > `pending` > `sent`): "the last run delivered" must be true for
|
|
2530
|
+
* every target it names.
|
|
2531
|
+
*/
|
|
2532
|
+
var NcRuleLastRunSchema = /* @__PURE__ */ zod.z.object({
|
|
2533
|
+
ruleId: /* @__PURE__ */ zod.z.string(),
|
|
2534
|
+
/** Fire time of the newest row (`createdAt`, epoch ms). */
|
|
2535
|
+
lastAt: /* @__PURE__ */ zod.z.number(),
|
|
2536
|
+
status: NcHistoryStatusSchema,
|
|
2537
|
+
/** The camera/device of that row (a digest row files under its first camera). */
|
|
2538
|
+
deviceId: /* @__PURE__ */ zod.z.number()
|
|
2539
|
+
});
|
|
2540
|
+
/**
|
|
2541
|
+
* Every rule's last run, in one answer.
|
|
2542
|
+
*
|
|
2543
|
+
* A rule ABSENT from `runs` produced no delivery inside `horizonMs` — how far
|
|
2544
|
+
* back this answer looked, in ms before the hub's now. It is the outbox prune
|
|
2545
|
+
* window (7 days by default, operator-configurable), NARROWED when the read hit
|
|
2546
|
+
* its row bound: the answer never claims a window it did not read. `null` means
|
|
2547
|
+
* the operator keeps the outbox forever AND the read reached its end, so absent
|
|
2548
|
+
* means "never on record". A UI derives its "not in the last N days" from this
|
|
2549
|
+
* value, never from a constant — and only when the call ANSWERED (D315).
|
|
2550
|
+
*/
|
|
2551
|
+
var NcRuleLastRunsSchema = /* @__PURE__ */ zod.z.object({
|
|
2552
|
+
runs: /* @__PURE__ */ zod.z.array(NcRuleLastRunSchema),
|
|
2553
|
+
horizonMs: /* @__PURE__ */ zod.z.number().nonnegative().nullable()
|
|
2554
|
+
});
|
|
2555
|
+
/**
|
|
2556
|
+
* What a snooze covers. Broader scopes win when several overlap, so one window
|
|
2557
|
+
* leaves ONE digest rather than a rule snooze and a whole-feed snooze both
|
|
2558
|
+
* summarising the same silence.
|
|
2559
|
+
*/
|
|
2560
|
+
var NcSnoozeScopeSchema = /* @__PURE__ */ zod.z.enum([
|
|
2561
|
+
"rule",
|
|
2562
|
+
"device",
|
|
2563
|
+
"all"
|
|
2564
|
+
]);
|
|
2565
|
+
/**
|
|
2566
|
+
* Client-authored snooze. The server stamps `userId`, `startedAt` and
|
|
2567
|
+
* `expiresAt` — a DURATION is sent rather than an instant so a client with a
|
|
2568
|
+
* skewed clock cannot author a window that is already over, or never ends.
|
|
2569
|
+
*/
|
|
2570
|
+
var NcSnoozeInputSchema = /* @__PURE__ */ zod.z.object({
|
|
2571
|
+
scope: NcSnoozeScopeSchema,
|
|
2572
|
+
/** Required when `scope: 'rule'` — a scoped snooze with no id matches
|
|
2573
|
+
* NOTHING rather than degrading to "everything". */
|
|
2574
|
+
ruleId: /* @__PURE__ */ zod.z.string().optional(),
|
|
2575
|
+
/** Required when `scope: 'device'`. */
|
|
2576
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().optional(),
|
|
2577
|
+
/**
|
|
2578
|
+
* Narrow the window to these subject classes — "the cat, not the person".
|
|
2579
|
+
*
|
|
2580
|
+
* ORTHOGONAL to `scope`, deliberately, and absent means EVERY class: that is
|
|
2581
|
+
* what every window authored before this field meant, so no persisted row
|
|
2582
|
+
* changes meaning and no client has to learn anything to keep working.
|
|
2583
|
+
*
|
|
2584
|
+
* It is what makes the window's real key `(deviceId, classes[])` and lets it
|
|
2585
|
+
* cross rules (D133): the operator points at a camera and a kind of thing,
|
|
2586
|
+
* not at whichever of their four rules happened to produce the notification
|
|
2587
|
+
* they are dismissing.
|
|
2588
|
+
*/
|
|
2589
|
+
classes: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).min(1).optional(),
|
|
2590
|
+
durationMinutes: /* @__PURE__ */ zod.z.number().int().min(1).max(NC_SNOOZE_MAX_MINUTES),
|
|
2591
|
+
/**
|
|
2592
|
+
* Silence this for EVERY recipient, not just the caller. Permission is
|
|
2593
|
+
* checked server-side (the rule's `snoozeAllowGlobal`, or admin for the
|
|
2594
|
+
* broader scopes). Absent = personal.
|
|
2595
|
+
*/
|
|
2596
|
+
global: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
2597
|
+
/**
|
|
2598
|
+
* Deliver a summary of what was suppressed when the window ends. Absent =
|
|
2599
|
+
* ON: someone silencing a nuisance camera wants it off, someone silencing a
|
|
2600
|
+
* SECURITY camera wants to know what they missed, and choosing "off" for
|
|
2601
|
+
* everybody is how a snooze becomes an outage. Resolved to a concrete
|
|
2602
|
+
* boolean by the server at create time — never left to a Zod default, which
|
|
2603
|
+
* does not run on the addon cap path.
|
|
2604
|
+
*/
|
|
2605
|
+
summary: /* @__PURE__ */ zod.z.boolean().optional()
|
|
2606
|
+
});
|
|
2607
|
+
/** A persisted snooze window. */
|
|
2608
|
+
var NcSnoozeSchema = /* @__PURE__ */ zod.z.object({
|
|
2609
|
+
id: /* @__PURE__ */ zod.z.string(),
|
|
2610
|
+
/** Who set it. Also who it silences, unless `global`. */
|
|
2611
|
+
userId: /* @__PURE__ */ zod.z.string(),
|
|
2612
|
+
scope: NcSnoozeScopeSchema,
|
|
2613
|
+
ruleId: /* @__PURE__ */ zod.z.string().optional(),
|
|
2614
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().optional(),
|
|
2615
|
+
/** Subject classes this window covers. ABSENT = every class — see
|
|
2616
|
+
* {@link NcSnoozeInputSchema.shape.classes}. Lives in the JSON blob and has
|
|
2617
|
+
* no SQLite column: nothing queries a window by class. */
|
|
2618
|
+
classes: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).min(1).optional(),
|
|
2619
|
+
startedAt: /* @__PURE__ */ zod.z.number(),
|
|
2620
|
+
/** Exclusive: at exactly this instant the snooze is over. Expiry is a
|
|
2621
|
+
* COMPARISON, not a job — no sweeper can leave the operator silenced. */
|
|
2622
|
+
expiresAt: /* @__PURE__ */ zod.z.number(),
|
|
2623
|
+
global: /* @__PURE__ */ zod.z.boolean(),
|
|
2624
|
+
summary: /* @__PURE__ */ zod.z.boolean(),
|
|
2625
|
+
/** When the end-of-window digest went out. Absent = not sent (yet, or the
|
|
2626
|
+
* window has not closed, or `summary` is false). */
|
|
2627
|
+
digestSentAt: /* @__PURE__ */ zod.z.number().optional()
|
|
2628
|
+
});
|
|
2629
|
+
var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
|
|
2630
|
+
var NcAlarmDelaySecSchema = /* @__PURE__ */ zod.z.number().int().min(0).max(600);
|
|
2631
|
+
var NcAlarmTriggeredSecSchema = /* @__PURE__ */ zod.z.number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
|
|
2632
|
+
var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
|
|
2633
|
+
/**
|
|
2634
|
+
* What the panel does when a bounded triggered window ends.
|
|
2635
|
+
* - `rearmAfter` — return to the armed mode
|
|
2636
|
+
* - `disableAfter` — auto-disarm
|
|
2637
|
+
* - `doNothing` — stay triggered until a human disarms
|
|
2638
|
+
*/
|
|
2639
|
+
var NcAlarmPostTriggeredActionSchema = /* @__PURE__ */ zod.z.enum([
|
|
2640
|
+
"rearmAfter",
|
|
2641
|
+
"disableAfter",
|
|
2642
|
+
"doNothing"
|
|
2643
|
+
]);
|
|
2644
|
+
/** One mode's OVERRIDES. An absent field inherits the global value (D697). */
|
|
2645
|
+
var NcAlarmModeDelaysSchema = /* @__PURE__ */ zod.z.object({
|
|
2646
|
+
mode: AlarmArmModeSchema,
|
|
2647
|
+
exitDelaySec: /* @__PURE__ */ NcAlarmDelaySecSchema.optional(),
|
|
2648
|
+
entryDelaySec: /* @__PURE__ */ NcAlarmDelaySecSchema.optional(),
|
|
2649
|
+
/**
|
|
2650
|
+
* Duration of `triggered` before {@link postTriggeredAction}. Kept as the
|
|
2651
|
+
* historical field name so older clients still read/write a number.
|
|
2652
|
+
*/
|
|
2653
|
+
triggeredDurationSec: /* @__PURE__ */ NcAlarmTriggeredSecSchema.optional(),
|
|
2654
|
+
postTriggeredAction: /* @__PURE__ */ NcAlarmPostTriggeredActionSchema.optional(),
|
|
2655
|
+
/**
|
|
2656
|
+
* When this mode may be armed. Absent / null = always allowed (same as a
|
|
2657
|
+
* rule with no `schedule`). Evaluated with {@link isScheduleActive}.
|
|
2658
|
+
*/
|
|
2659
|
+
schedule: /* @__PURE__ */ NcScheduleSchema.optional(),
|
|
2660
|
+
/**
|
|
2661
|
+
* D706: while this mode's ENTRY DELAY runs, do the alarm rules' own pushes go out (as an
|
|
2662
|
+
* intrusion naming the locations)? Absent = false — the entry-delay notification is the
|
|
2663
|
+
* only one, and the matches ride the triggered notification's mosaic (D705).
|
|
2664
|
+
*/
|
|
2665
|
+
notifyDuringEntryDelay: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
2666
|
+
/**
|
|
2667
|
+
* D706: notify "watched again" when a sensor this arm bypassed closes and opens again.
|
|
2668
|
+
* Absent = false (logged, not sent). Even when true it is not sent when that same sensor
|
|
2669
|
+
* is the one that starts the entry delay — the entry-delay notification already names it.
|
|
2670
|
+
*/
|
|
2671
|
+
notifySensorRewatched: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
2672
|
+
/**
|
|
2673
|
+
* D735: notify "ignored" when a sensor this arm bypassed really MOVED while armed (its own
|
|
2674
|
+
* change time is after the arm) and set nothing off. Absent = false (logged, not sent). A
|
|
2675
|
+
* re-sync, a recovery from `unavailable` or a duplicate is never announced, switch or not.
|
|
2676
|
+
*/
|
|
2677
|
+
notifySensorIgnored: /* @__PURE__ */ zod.z.boolean().optional()
|
|
2678
|
+
});
|
|
2679
|
+
var NcAlarmModeDelaysListSchema = /* @__PURE__ */ zod.z.array(NcAlarmModeDelaysSchema).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
|
|
2680
|
+
/**
|
|
2681
|
+
* One mode's EDIT in a patch: a number sets the override, `null` removes it (the mode inherits
|
|
2682
|
+
* again), an absent field leaves it alone. Per field, so two editors changing two different
|
|
2683
|
+
* delays of one mode never undo each other.
|
|
2684
|
+
*/
|
|
2685
|
+
var NcAlarmModeDelaysEditSchema = /* @__PURE__ */ zod.z.object({
|
|
2686
|
+
mode: AlarmArmModeSchema,
|
|
2687
|
+
exitDelaySec: /* @__PURE__ */ NcAlarmDelaySecSchema.nullable().optional(),
|
|
2688
|
+
entryDelaySec: /* @__PURE__ */ NcAlarmDelaySecSchema.nullable().optional(),
|
|
2689
|
+
triggeredDurationSec: /* @__PURE__ */ NcAlarmTriggeredSecSchema.nullable().optional(),
|
|
2690
|
+
postTriggeredAction: /* @__PURE__ */ NcAlarmPostTriggeredActionSchema.nullable().optional(),
|
|
2691
|
+
/** Set a schedule, or `null` to clear (mode always allowed again). */
|
|
2692
|
+
schedule: /* @__PURE__ */ NcScheduleSchema.nullable().optional(),
|
|
2693
|
+
/** D706: set the switch, or `null` to clear it (back to the default, false). */
|
|
2694
|
+
notifyDuringEntryDelay: /* @__PURE__ */ zod.z.boolean().nullable().optional(),
|
|
2695
|
+
/** D706: set the switch, or `null` to clear it (back to the default, false). */
|
|
2696
|
+
notifySensorRewatched: /* @__PURE__ */ zod.z.boolean().nullable().optional(),
|
|
2697
|
+
/** D735: set the switch, or `null` to clear it (back to the default, false). */
|
|
2698
|
+
notifySensorIgnored: /* @__PURE__ */ zod.z.boolean().nullable().optional()
|
|
2699
|
+
});
|
|
2700
|
+
var NcAlarmModeDelaysEditListSchema = /* @__PURE__ */ zod.z.array(NcAlarmModeDelaysEditSchema).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
|
|
2701
|
+
/** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
|
|
2702
|
+
var NcAlarmNonBlockingEditSchema = /* @__PURE__ */ zod.z.object({
|
|
2703
|
+
mode: AlarmArmModeSchema,
|
|
2704
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().positive(),
|
|
2705
|
+
/** true = on the list (may be open, does not block); false = off the list (blocks). */
|
|
2706
|
+
nonBlocking: /* @__PURE__ */ zod.z.boolean()
|
|
2707
|
+
});
|
|
2708
|
+
/**
|
|
2709
|
+
* Controllable openings: opt IN to blocking (default is do not block). Contacts
|
|
2710
|
+
* keep using {@link NcAlarmNonBlockingEditSchema}.
|
|
2711
|
+
*/
|
|
2712
|
+
var NcAlarmBlockingEditSchema = /* @__PURE__ */ zod.z.object({
|
|
2713
|
+
mode: AlarmArmModeSchema,
|
|
2714
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().positive(),
|
|
2715
|
+
/** true = on the list (blocks when open); false = off the list (default). */
|
|
2716
|
+
blocking: /* @__PURE__ */ zod.z.boolean()
|
|
2717
|
+
});
|
|
2718
|
+
/**
|
|
2719
|
+
* Controllable openings: opt OUT of secure-on-arm (default is secure ON —
|
|
2720
|
+
* close / lock / turn off when this mode arms).
|
|
2721
|
+
*/
|
|
2722
|
+
var NcAlarmSecureOnArmEditSchema = /* @__PURE__ */ zod.z.object({
|
|
2723
|
+
mode: AlarmArmModeSchema,
|
|
2724
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().positive(),
|
|
2725
|
+
/** true = secure on arm (default); false = do not actuate on arm. */
|
|
2726
|
+
secureOnArm: /* @__PURE__ */ zod.z.boolean()
|
|
2727
|
+
});
|
|
2728
|
+
/**
|
|
2729
|
+
* One arm mode's device-id list (non-blocking, blocking, or secure-on-arm-off).
|
|
2730
|
+
*/
|
|
2731
|
+
var NcAlarmModeDeviceListSchema = /* @__PURE__ */ zod.z.object({
|
|
2732
|
+
mode: AlarmArmModeSchema,
|
|
2733
|
+
deviceIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int()).max(200)
|
|
2734
|
+
});
|
|
2735
|
+
/**
|
|
2736
|
+
* One arm mode's non-blocking list: devices that may be open when that mode
|
|
2737
|
+
* arms, without the arm being refused.
|
|
2738
|
+
*/
|
|
2739
|
+
var NcAlarmNonBlockingSchema = NcAlarmModeDeviceListSchema;
|
|
2740
|
+
/** Controllable devices that DO block when open (opt-in; default empty). */
|
|
2741
|
+
var NcAlarmBlockingSchema = NcAlarmModeDeviceListSchema;
|
|
2742
|
+
/**
|
|
2743
|
+
* Controllable devices that do NOT secure on arm (opt-out; default empty =
|
|
2744
|
+
* every controllable secures).
|
|
2745
|
+
*/
|
|
2746
|
+
var NcAlarmSecureOnArmOffSchema = NcAlarmModeDeviceListSchema;
|
|
2747
|
+
/**
|
|
2748
|
+
* The per-mode lists, at most one per mode. Two lists for one mode have no
|
|
2749
|
+
* meaning a reader could agree on (union? the last one?), so they are refused
|
|
2750
|
+
* at the boundary rather than interpreted.
|
|
2751
|
+
*/
|
|
2752
|
+
var NcAlarmNonBlockingListSchema = /* @__PURE__ */ zod.z.array(NcAlarmNonBlockingSchema).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
|
|
2753
|
+
var NcAlarmBlockingListSchema = /* @__PURE__ */ zod.z.array(NcAlarmBlockingSchema).max(8).refine(uniqueModes, { message: "blocking: at most one list per arm mode" });
|
|
2754
|
+
var NcAlarmSecureOnArmOffListSchema = /* @__PURE__ */ zod.z.array(NcAlarmSecureOnArmOffSchema).max(8).refine(uniqueModes, { message: "secureOnArmOff: at most one list per arm mode" });
|
|
2755
|
+
/**
|
|
2756
|
+
* The three durations — global, and per mode since D697 — the panel's state
|
|
2757
|
+
* machine runs on, who hears about its transitions, and which openings each mode tolerates.
|
|
2758
|
+
*
|
|
2759
|
+
* They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
|
|
2760
|
+
* `alarm-panel` is `deviceNative` and its other provider mirrors somebody
|
|
2761
|
+
* else's panel, which has its own delays and no way to be told these. This is
|
|
2762
|
+
* configuration of the panel CamStack owns, and the Notification Center owns
|
|
2763
|
+
* that panel.
|
|
2764
|
+
*/
|
|
2765
|
+
var NcAlarmSettingsSchema = /* @__PURE__ */ zod.z.object({
|
|
2766
|
+
/** Grace period between arming and the mode taking effect. 0 = immediate. */
|
|
2767
|
+
exitDelaySec: NcAlarmDelaySecSchema,
|
|
2768
|
+
/** Grace period between a trigger and the alarm firing. 0 = immediate. */
|
|
2769
|
+
entryDelaySec: NcAlarmDelaySecSchema,
|
|
2770
|
+
/**
|
|
2771
|
+
* How long `triggered` lasts before {@link postTriggeredAction} runs.
|
|
2772
|
+
* Ignored when the action is `doNothing`. Historical name kept so older
|
|
2773
|
+
* clients still round-trip a number.
|
|
2774
|
+
*/
|
|
2775
|
+
triggeredDurationSec: NcAlarmTriggeredSecSchema,
|
|
2776
|
+
/**
|
|
2777
|
+
* What happens when the triggered window ends. Absent on a blob older than
|
|
2778
|
+
* this field → derived from {@link triggeredDurationSec} (`>0` ⇒ rearmAfter,
|
|
2779
|
+
* else doNothing).
|
|
2780
|
+
*/
|
|
2781
|
+
postTriggeredAction: /* @__PURE__ */ NcAlarmPostTriggeredActionSchema.optional(),
|
|
2782
|
+
/**
|
|
2783
|
+
* Deprecated by D630 — every transition is announced. Parsed, never read;
|
|
2784
|
+
* remove after one release. Optional so an older admin's patch (which still
|
|
2785
|
+
* sends it) parses rather than failing the whole save.
|
|
2786
|
+
*/
|
|
2787
|
+
announceArm: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
2788
|
+
/**
|
|
2789
|
+
* Target ids from `notification-output`: every alarm transition goes here.
|
|
2790
|
+
*
|
|
2791
|
+
* Explicit rather than "everyone": an alarm announcement is a household
|
|
2792
|
+
* message, and broadcasting it to every configured endpoint (including a
|
|
2793
|
+
* webhook wired to something else) is not a default anybody would choose.
|
|
2794
|
+
* Empty sends nothing, and the server logs that — silence must be
|
|
2795
|
+
* attributable.
|
|
2796
|
+
*/
|
|
2797
|
+
announceTargets: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).max(16),
|
|
2798
|
+
/**
|
|
2799
|
+
* Per arm mode, the covered devices whose being OPEN does not refuse the
|
|
2800
|
+
* arm (a window left ajar for the cat under `home`, say). At most one entry
|
|
2801
|
+
* per mode is meaningful. Defaulted to `[]` so a blob stored before D630
|
|
2802
|
+
* parses as "every opening blocks" — the behaviour it was written under.
|
|
2803
|
+
* Contacts use this list; controllable openings use {@link blocking} instead
|
|
2804
|
+
* (default: do not block).
|
|
2805
|
+
*/
|
|
2806
|
+
nonBlocking: /* @__PURE__ */ NcAlarmNonBlockingListSchema.default([]),
|
|
2807
|
+
/**
|
|
2808
|
+
* Per arm mode, controllable openings that DO refuse the arm when open.
|
|
2809
|
+
* Default `[]` = none block (secure-on-arm closes them instead). Absent on a
|
|
2810
|
+
* blob older than this field — read as empty.
|
|
2811
|
+
*/
|
|
2812
|
+
blocking: /* @__PURE__ */ NcAlarmBlockingListSchema.default([]),
|
|
2813
|
+
/**
|
|
2814
|
+
* Per arm mode, controllable openings that must NOT be actuated on arm.
|
|
2815
|
+
* Default `[]` = every controllable secures (close / lock / off). Absent on
|
|
2816
|
+
* an older blob — read as empty (secure ON).
|
|
2817
|
+
*/
|
|
2818
|
+
secureOnArmOff: /* @__PURE__ */ NcAlarmSecureOnArmOffListSchema.default([]),
|
|
2819
|
+
/**
|
|
2820
|
+
* Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
|
|
2821
|
+
* without a field, uses the global value above — so `[]`, the default, is exactly the
|
|
2822
|
+
* behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
|
|
2823
|
+
*/
|
|
2824
|
+
modeDelays: /* @__PURE__ */ NcAlarmModeDelaysListSchema.default([])
|
|
2825
|
+
});
|
|
2826
|
+
/**
|
|
2827
|
+
* One named alarm configuration profile — a full {@link NcAlarmSettings} blob
|
|
2828
|
+
* (memberships including secure-on-arm, delays, announce targets). The id is
|
|
2829
|
+
* assigned by the server; clients show the name.
|
|
2830
|
+
*/
|
|
2831
|
+
var NcAlarmProfileMetaSchema = /* @__PURE__ */ zod.z.object({
|
|
2832
|
+
id: /* @__PURE__ */ zod.z.string().min(1).max(64),
|
|
2833
|
+
name: /* @__PURE__ */ zod.z.string().min(1).max(64),
|
|
2834
|
+
/** The seeded Default profile — cannot be deleted. */
|
|
2835
|
+
isDefault: /* @__PURE__ */ zod.z.boolean()
|
|
2836
|
+
});
|
|
2837
|
+
/**
|
|
2838
|
+
* Profiles ride on {@link NcAlarmConfig}: one globally active profile, whose
|
|
2839
|
+
* settings are what arm decisions and `settings` already expose. Switching
|
|
2840
|
+
* active applies that profile's blob onto the panel.
|
|
2841
|
+
*/
|
|
2842
|
+
var NcAlarmProfilesViewSchema = /* @__PURE__ */ zod.z.object({
|
|
2843
|
+
activeId: /* @__PURE__ */ zod.z.string().min(1),
|
|
2844
|
+
items: /* @__PURE__ */ zod.z.array(NcAlarmProfileMetaSchema).min(1)
|
|
2845
|
+
});
|
|
2846
|
+
var NcAlarmCreateProfileInputSchema = /* @__PURE__ */ zod.z.object({
|
|
2847
|
+
name: /* @__PURE__ */ zod.z.string().min(1).max(64),
|
|
2848
|
+
/**
|
|
2849
|
+
* Omit / undefined → system defaults (empty memberships, stock delays).
|
|
2850
|
+
* Set → clone that profile's settings.
|
|
2851
|
+
*/
|
|
2852
|
+
cloneFromId: /* @__PURE__ */ zod.z.string().min(1).max(64).optional()
|
|
2853
|
+
});
|
|
2854
|
+
var NcAlarmRenameProfileInputSchema = /* @__PURE__ */ zod.z.object({
|
|
2855
|
+
id: /* @__PURE__ */ zod.z.string().min(1).max(64),
|
|
2856
|
+
name: /* @__PURE__ */ zod.z.string().min(1).max(64)
|
|
2857
|
+
});
|
|
2858
|
+
var NcAlarmProfileIdInputSchema = /* @__PURE__ */ zod.z.object({ id: /* @__PURE__ */ zod.z.string().min(1).max(64) });
|
|
2859
|
+
/**
|
|
2860
|
+
* Every field optional — a tab edits one control at a time.
|
|
2861
|
+
*
|
|
2862
|
+
* List fields and `modeDelays` are re-declared WITHOUT their defaults:
|
|
2863
|
+
* `.partial()` does not remove an inner `.default()`, so a patch that never
|
|
2864
|
+
* named the field would parse to `[]` and wipe every mode's list on an
|
|
2865
|
+
* unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
|
|
2866
|
+
* `modeDelays` means EDITS, not the stored overrides.
|
|
2867
|
+
*/
|
|
2868
|
+
var NcAlarmSettingsPatchSchema = /* @__PURE__ */ NcAlarmSettingsSchema.extend({
|
|
2869
|
+
nonBlocking: NcAlarmNonBlockingListSchema,
|
|
2870
|
+
blocking: NcAlarmBlockingListSchema,
|
|
2871
|
+
secureOnArmOff: NcAlarmSecureOnArmOffListSchema,
|
|
2872
|
+
/** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
|
|
2873
|
+
modeDelays: NcAlarmModeDelaysEditListSchema,
|
|
2874
|
+
/** ONE membership change; the panel applies it to the list it holds at its turn. */
|
|
2875
|
+
nonBlockingEdit: NcAlarmNonBlockingEditSchema,
|
|
2876
|
+
blockingEdit: NcAlarmBlockingEditSchema,
|
|
2877
|
+
secureOnArmEdit: NcAlarmSecureOnArmEditSchema
|
|
2878
|
+
}).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" }).refine((p) => p.blocking === void 0 || p.blockingEdit === void 0, { message: "blocking and blockingEdit are exclusive — send the whole lists or one edit" }).refine((p) => p.secureOnArmOff === void 0 || p.secureOnArmEdit === void 0, { message: "secureOnArmOff and secureOnArmEdit are exclusive — send the whole lists or one edit" });
|
|
2879
|
+
/**
|
|
2880
|
+
* What one arm mode actually arms, DERIVED from the enabled rules gated on it.
|
|
2881
|
+
* Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
|
|
2882
|
+
* copy would lie the first time a rule is disabled.
|
|
2883
|
+
*/
|
|
2884
|
+
/**
|
|
2885
|
+
* Why a device a mode NAMES is nonetheless not armed by it.
|
|
2886
|
+
*
|
|
2887
|
+
* Each value is an existing authority, never a new flag (D62): `muted` is the
|
|
2888
|
+
* per-camera notification switch the Notification Center already owns,
|
|
2889
|
+
* `detection-off` is the device's own detection binding being inactive, and
|
|
2890
|
+
* `offline` is the device manager's liveness. A fourth reason would mean a
|
|
2891
|
+
* fourth authority, and inventing one here is how a panel starts disagreeing
|
|
2892
|
+
* with the switches the operator actually used.
|
|
2893
|
+
*/
|
|
2894
|
+
var NcAlarmSkipReasonSchema = /* @__PURE__ */ zod.z.enum([
|
|
2895
|
+
"muted",
|
|
2896
|
+
"detection-off",
|
|
2897
|
+
"offline"
|
|
2898
|
+
]);
|
|
2899
|
+
var NcAlarmSkippedDeviceSchema = /* @__PURE__ */ zod.z.object({
|
|
2900
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
2901
|
+
reason: NcAlarmSkipReasonSchema
|
|
2902
|
+
});
|
|
2903
|
+
var NcAlarmModeCoverageSchema = /* @__PURE__ */ zod.z.object({
|
|
2904
|
+
mode: AlarmArmModeSchema,
|
|
2905
|
+
/** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
|
|
2906
|
+
ruleCount: /* @__PURE__ */ zod.z.number().int().min(0),
|
|
2907
|
+
/** At least one covering rule has no device scope, so the mode covers all. */
|
|
2908
|
+
allDevices: /* @__PURE__ */ zod.z.boolean(),
|
|
2909
|
+
/** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
|
|
2910
|
+
deviceIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int()),
|
|
2911
|
+
/**
|
|
2912
|
+
* D641: the ids NOT covered although `allDevices` is true — every unscoped
|
|
2913
|
+
* covering rule EXCLUDES them (`conditions.devicesExclude`) and no named rule
|
|
2914
|
+
* covers them. Always `[]` when `allDevices` is false. Excluded by the rules,
|
|
2915
|
+
* which is not the same as skipped by a switch: never in `skippedDevices`.
|
|
2916
|
+
* Defaulted so an answer computed before this field parses as "none".
|
|
2917
|
+
*/
|
|
2918
|
+
allDevicesExcept: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int()).default([]),
|
|
2919
|
+
/**
|
|
2920
|
+
* Devices this mode NAMES but cannot actually arm, each with the switch that
|
|
2921
|
+
* excludes it.
|
|
2922
|
+
*
|
|
2923
|
+
* "Away armed — 12 cameras" is a promise, and a muted camera among those
|
|
2924
|
+
* twelve makes it false in exactly the way nobody notices until an incident.
|
|
2925
|
+
* Defaulted to `[]` so a coverage answer computed before this field existed
|
|
2926
|
+
* still parses as "nothing known to be skipped" rather than failing the whole
|
|
2927
|
+
* alarm tab.
|
|
2928
|
+
*/
|
|
2929
|
+
skippedDevices: /* @__PURE__ */ zod.z.array(NcAlarmSkippedDeviceSchema).default([])
|
|
2930
|
+
});
|
|
2931
|
+
/** One covered device that reads open, and whether that refuses the arm. */
|
|
2932
|
+
var NcAlarmOpeningSchema = /* @__PURE__ */ zod.z.object({
|
|
2933
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
2934
|
+
name: /* @__PURE__ */ zod.z.string(),
|
|
2935
|
+
/** The device's state word as read (`open`, `unlocked`, …). */
|
|
2936
|
+
state: /* @__PURE__ */ zod.z.string(),
|
|
2937
|
+
/** False when the mode's non-blocking list names this device. */
|
|
2938
|
+
blocking: /* @__PURE__ */ zod.z.boolean()
|
|
2939
|
+
});
|
|
2940
|
+
/** A device the panel is currently ignoring, and which side of it it is on. */
|
|
2941
|
+
var NcAlarmExclusionViewSchema = /* @__PURE__ */ zod.z.object({
|
|
2942
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
2943
|
+
name: /* @__PURE__ */ zod.z.string(),
|
|
2944
|
+
phase: /* @__PURE__ */ zod.z.enum(["open", "closed"])
|
|
2945
|
+
});
|
|
2946
|
+
/** One mode's openings: devices read open, plus those whose state is unknown. */
|
|
2947
|
+
var NcAlarmModeOpeningsSchema = /* @__PURE__ */ zod.z.object({
|
|
2948
|
+
mode: AlarmArmModeSchema,
|
|
2949
|
+
devices: /* @__PURE__ */ zod.z.array(NcAlarmOpeningSchema),
|
|
2950
|
+
/** Covered devices whose state could not be read (D49): neither open nor closed. */
|
|
2951
|
+
unknown: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int())
|
|
2952
|
+
});
|
|
2953
|
+
/**
|
|
2954
|
+
* One alarm INPUT — a (rule, device) pair — the operator bypassed until the
|
|
2955
|
+
* next disarm ("Bypass this input until disarm" on a trigger notification, or
|
|
2956
|
+
* `nc.bypassAlarmInput`). Reported so an armed alarm with a silenced input
|
|
2957
|
+
* never looks fully armed (D62: off must never look like broken).
|
|
2958
|
+
*/
|
|
2959
|
+
var NcAlarmInputBypassViewSchema = /* @__PURE__ */ zod.z.object({
|
|
2960
|
+
ruleId: /* @__PURE__ */ zod.z.string(),
|
|
2961
|
+
/** The rule's current name (its frozen name when the rule is gone). */
|
|
2962
|
+
ruleName: /* @__PURE__ */ zod.z.string(),
|
|
2963
|
+
/** The input: the sensor of the match, else its camera. */
|
|
2964
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
2965
|
+
/** The input's current name. */
|
|
2966
|
+
name: /* @__PURE__ */ zod.z.string(),
|
|
2967
|
+
/** When it was bypassed (ms epoch). */
|
|
2968
|
+
since: /* @__PURE__ */ zod.z.number(),
|
|
2969
|
+
/** Triggers from this input dropped since. */
|
|
2970
|
+
dropped: /* @__PURE__ */ zod.z.number().int().min(0)
|
|
2971
|
+
});
|
|
2972
|
+
var NcAlarmLiveSchema = /* @__PURE__ */ zod.z.object({
|
|
2973
|
+
state: AlarmStateSchema,
|
|
2974
|
+
/** The mode being armed into (exit delay) or held; null when disarmed. */
|
|
2975
|
+
targetMode: /* @__PURE__ */ AlarmArmModeSchema.nullable(),
|
|
2976
|
+
availableModes: /* @__PURE__ */ zod.z.array(AlarmArmModeSchema),
|
|
2977
|
+
openings: /* @__PURE__ */ zod.z.array(NcAlarmModeOpeningsSchema),
|
|
2978
|
+
exclusions: /* @__PURE__ */ zod.z.array(NcAlarmExclusionViewSchema),
|
|
2979
|
+
/**
|
|
2980
|
+
* Inputs bypassed for the rest of this arm session; cleared on disarm.
|
|
2981
|
+
* Defaulted so an older hub answer still parses (as "none known").
|
|
2982
|
+
*/
|
|
2983
|
+
bypassedInputs: /* @__PURE__ */ zod.z.array(NcAlarmInputBypassViewSchema).default([])
|
|
2984
|
+
});
|
|
2985
|
+
var NcAlarmConfigSchema = /* @__PURE__ */ zod.z.object({
|
|
2986
|
+
/**
|
|
2987
|
+
* The panel's device id, or null when this install has no panel (the ensure
|
|
2988
|
+
* step failed, or this is not the hub). Null is the honest answer: an editor
|
|
2989
|
+
* that rendered delays for a panel that does not exist would be a form whose
|
|
2990
|
+
* Save does nothing.
|
|
2991
|
+
*/
|
|
2992
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().nullable(),
|
|
2993
|
+
settings: NcAlarmSettingsSchema,
|
|
2994
|
+
/**
|
|
2995
|
+
* Named configuration profiles. Optional so an older hub answer still parses;
|
|
2996
|
+
* a client without this field shows no picker (single implicit Default).
|
|
2997
|
+
*/
|
|
2998
|
+
profiles: /* @__PURE__ */ NcAlarmProfilesViewSchema.optional(),
|
|
2999
|
+
coverage: /* @__PURE__ */ zod.z.array(NcAlarmModeCoverageSchema),
|
|
3000
|
+
/**
|
|
3001
|
+
* The panel as it is NOW — state, what each mode would find open, what is
|
|
3002
|
+
* excluded. Optional: a panel-less hub answers without it, and a client
|
|
3003
|
+
* must not read its absence as "nothing is open".
|
|
3004
|
+
*/
|
|
3005
|
+
live: /* @__PURE__ */ NcAlarmLiveSchema.optional()
|
|
3006
|
+
});
|
|
3007
|
+
var NcAlarmSensorReadingSchema = /* @__PURE__ */ zod.z.enum([
|
|
3008
|
+
"open",
|
|
3009
|
+
"closed",
|
|
3010
|
+
"unknown",
|
|
3011
|
+
"not-opening"
|
|
3012
|
+
]);
|
|
3013
|
+
/** One device's state as the alarm reads it — the classifier the arm check uses. */
|
|
3014
|
+
var NcAlarmSensorStateSchema = /* @__PURE__ */ zod.z.object({
|
|
3015
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().positive(),
|
|
3016
|
+
reading: NcAlarmSensorReadingSchema,
|
|
3017
|
+
/** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
|
|
3018
|
+
state: /* @__PURE__ */ zod.z.string().nullable(),
|
|
3019
|
+
/** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
|
|
3020
|
+
unknownWhy: /* @__PURE__ */ zod.z.enum(["read-failed", "unknown-word"]).nullable(),
|
|
3021
|
+
/** The device manager's liveness as the centre mirrors it; null = not known. */
|
|
3022
|
+
online: /* @__PURE__ */ zod.z.boolean().nullable(),
|
|
3023
|
+
/**
|
|
3024
|
+
* True when the opening is a cover / lock / switch — the table shows the
|
|
3025
|
+
* Secure-on-arm switch and uses the controllable defaults. False for contacts
|
|
3026
|
+
* and for non-openings. Defaulted so an older hub answer still parses.
|
|
3027
|
+
*/
|
|
3028
|
+
controllable: /* @__PURE__ */ zod.z.boolean().default(false)
|
|
3029
|
+
});
|
|
3030
|
+
var NcAlarmSensorsInputSchema = /* @__PURE__ */ zod.z.object({ deviceIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int().positive()).max(500) });
|
|
3031
|
+
var NcAlarmSensorsSchema = /* @__PURE__ */ zod.z.object({
|
|
3032
|
+
sensors: /* @__PURE__ */ zod.z.array(NcAlarmSensorStateSchema),
|
|
3033
|
+
readAt: /* @__PURE__ */ zod.z.number().int().nonnegative()
|
|
3034
|
+
});
|
|
3035
|
+
/**
|
|
3036
|
+
* ONE rule's demand on ONE camera's clip ring.
|
|
3037
|
+
*
|
|
3038
|
+
* A rule, not a camera: the broker takes the MAX over the asks that reach a
|
|
3039
|
+
* camera, so the answer stays a faithful description of the rules and the
|
|
3040
|
+
* bounding (the byte budget, the broker's own ceiling) stays where the cost
|
|
3041
|
+
* lives. A camera that appears in no ask is being told **nothing** — which is
|
|
3042
|
+
* a different thing from never having been told, and only the envelope
|
|
3043
|
+
* (`rulesLoaded`) can tell those apart.
|
|
3044
|
+
*/
|
|
3045
|
+
var NcClipRetentionAskSchema = /* @__PURE__ */ zod.z.object({
|
|
3046
|
+
/**
|
|
3047
|
+
* The camera this ask is about. **Absent = every camera**, which is what a
|
|
3048
|
+
* rule with no `conditions.devices` means: it can fire anywhere, so it is
|
|
3049
|
+
* asking everywhere.
|
|
3050
|
+
*/
|
|
3051
|
+
deviceId: /* @__PURE__ */ zod.z.number().int().nonnegative().optional(),
|
|
3052
|
+
/** Seconds of history the rule needs held for it. Never zero — a rule that
|
|
3053
|
+
* needs nothing produces no ask at all. */
|
|
3054
|
+
seconds: /* @__PURE__ */ zod.z.number().min(0).max(60),
|
|
3055
|
+
/** The profile the rule cuts from, when it named one. Absent = the cheapest
|
|
3056
|
+
* assigned, which is what the cut defaults to. */
|
|
3057
|
+
profile: /* @__PURE__ */ require_streaming_shared.CamProfileSchema.optional(),
|
|
3058
|
+
/** Who is asking — so a retention the operator did not expect names a rule. */
|
|
3059
|
+
ruleId: /* @__PURE__ */ zod.z.string(),
|
|
3060
|
+
ruleName: /* @__PURE__ */ zod.z.string(),
|
|
3061
|
+
/** Why this many seconds: the rule's own window, or the occupancy ceiling. */
|
|
3062
|
+
reason: /* @__PURE__ */ zod.z.enum(["window", "occupancy"])
|
|
3063
|
+
});
|
|
3064
|
+
/**
|
|
3065
|
+
* The whole answer, with the one bit that keeps absence from reading as zero.
|
|
3066
|
+
*
|
|
3067
|
+
* `rulesLoaded` is false until the rule ledger has completed a load at least
|
|
3068
|
+
* once. A centre that is up but has not read its rules yet answers with an
|
|
3069
|
+
* empty ask list that means nothing at all — applying it would drop every
|
|
3070
|
+
* camera's ring to zero for the first events after a restart, which is the
|
|
3071
|
+
* footage this mechanism exists to keep.
|
|
3072
|
+
*/
|
|
3073
|
+
var NcClipRetentionPlanSchema = /* @__PURE__ */ zod.z.object({
|
|
3074
|
+
rulesLoaded: /* @__PURE__ */ zod.z.boolean(),
|
|
3075
|
+
asks: /* @__PURE__ */ zod.z.array(NcClipRetentionAskSchema).readonly()
|
|
3076
|
+
});
|
|
3077
|
+
var notificationRulesCapability = {
|
|
3078
|
+
name: "notification-rules",
|
|
3079
|
+
scope: "system",
|
|
3080
|
+
mode: "singleton",
|
|
3081
|
+
methods: {
|
|
3082
|
+
listRules: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({ rules: /* @__PURE__ */ zod.z.array(NcRuleSchema) }), { auth: "admin" }),
|
|
3083
|
+
getRule: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ ruleId: /* @__PURE__ */ zod.z.string() }), /* @__PURE__ */ zod.z.object({ rule: /* @__PURE__ */ NcRuleSchema.nullable() }), { auth: "admin" }),
|
|
3084
|
+
createRule: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ rule: NcRuleInputSchema }), /* @__PURE__ */ zod.z.object({ rule: NcRuleSchema }), {
|
|
3085
|
+
kind: "mutation",
|
|
3086
|
+
auth: "admin",
|
|
3087
|
+
caller: "required"
|
|
3088
|
+
}),
|
|
3089
|
+
updateRule: /* @__PURE__ */ require_capability_definition.method(NcRuleUpdateInputSchema, /* @__PURE__ */ zod.z.object({ rule: NcRuleSchema }), {
|
|
3090
|
+
kind: "mutation",
|
|
3091
|
+
auth: "admin",
|
|
3092
|
+
caller: "required"
|
|
3093
|
+
}),
|
|
3094
|
+
deleteRule: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ ruleId: /* @__PURE__ */ zod.z.string() }), /* @__PURE__ */ zod.z.object({ success: /* @__PURE__ */ zod.z.literal(true) }), {
|
|
3095
|
+
kind: "mutation",
|
|
3096
|
+
auth: "admin"
|
|
3097
|
+
}),
|
|
3098
|
+
setRuleEnabled: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
3099
|
+
ruleId: /* @__PURE__ */ zod.z.string(),
|
|
3100
|
+
enabled: /* @__PURE__ */ zod.z.boolean()
|
|
3101
|
+
}), /* @__PURE__ */ zod.z.object({ success: /* @__PURE__ */ zod.z.literal(true) }), {
|
|
3102
|
+
kind: "mutation",
|
|
3103
|
+
auth: "admin"
|
|
3104
|
+
}),
|
|
3105
|
+
/**
|
|
3106
|
+
* Every rule of every kind with its tags (D1054) — event rules, summaries,
|
|
3107
|
+
* timelapses and calendar-events rules. The `tags` cap counts and rewrites
|
|
3108
|
+
* from this one read; a rule without tags is listed with `[]`.
|
|
3109
|
+
*/
|
|
3110
|
+
listRuleTags: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({ rules: /* @__PURE__ */ zod.z.array(NcRuleTagsEntrySchema) }), {
|
|
3111
|
+
kind: "query",
|
|
3112
|
+
auth: "admin"
|
|
3113
|
+
}),
|
|
3114
|
+
/**
|
|
3115
|
+
* Replace ONE rule's tags (D1054) and nothing else — the `tags` cap's rename
|
|
3116
|
+
* and remove write through this. `kind` names the store the rule lives in.
|
|
3117
|
+
* Normalised on write (trimmed, deduplicated case-insensitively); `[]`
|
|
3118
|
+
* clears them.
|
|
3119
|
+
*/
|
|
3120
|
+
setRuleTags: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
3121
|
+
kind: NcTaggedRuleKindSchema,
|
|
3122
|
+
ruleId: /* @__PURE__ */ zod.z.string(),
|
|
3123
|
+
tags: require_tag.TagsFieldSchema
|
|
3124
|
+
}), /* @__PURE__ */ zod.z.object({ success: /* @__PURE__ */ zod.z.literal(true) }), {
|
|
3125
|
+
kind: "mutation",
|
|
3126
|
+
auth: "admin"
|
|
3127
|
+
}),
|
|
3128
|
+
/**
|
|
3129
|
+
* WHAT THE RULES ACTUALLY ASK the stream broker to retain, per camera.
|
|
3130
|
+
*
|
|
3131
|
+
* The notification centre owns the rules, so it is the only thing that can
|
|
3132
|
+
* say how much history a camera's notifications will ever reach back for.
|
|
3133
|
+
* Before this the broker guessed — a flat minute on every camera — and
|
|
3134
|
+
* learned the PROFILE reactively, after the first clip had already been cut
|
|
3135
|
+
* from the wrong one. This is the same ask stated once, in front.
|
|
3136
|
+
*
|
|
3137
|
+
* A QUERY, pulled by each node's broker, not a push: brokers are per node
|
|
3138
|
+
* (a camera's ring lives wherever its stream is ingested) while this cap is
|
|
3139
|
+
* a singleton, so a push would have to enumerate the cluster. The pull also
|
|
3140
|
+
* makes the failure mode right — a broker that cannot reach the centre
|
|
3141
|
+
* keeps the plan it has, and a plan that has never arrived is UNKNOWN
|
|
3142
|
+
* rather than empty (D49: a read that fails changes nothing).
|
|
3143
|
+
*/
|
|
3144
|
+
getClipRetentionAsks: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), NcClipRetentionPlanSchema, { auth: "admin" }),
|
|
3145
|
+
/**
|
|
3146
|
+
* PERMANENT per-camera mute — the notifications half of the per-camera
|
|
3147
|
+
* function switch group ([D61](../../../../docs/decisions/adr-0067.md)).
|
|
3148
|
+
*
|
|
3149
|
+
* Deliberately NOT a snooze. A snooze is bounded at
|
|
3150
|
+
* {@link NC_SNOOZE_MAX_MINUTES} on purpose — "a snooze that could not
|
|
3151
|
+
* expire would be an outage the operator asked for once and forgot" — and
|
|
3152
|
+
* widening it to express "this camera never notifies" would destroy that
|
|
3153
|
+
* property for every snooze. A mute is the other thing: an explicit,
|
|
3154
|
+
* indefinite, admin-only decision, visible in the switch group next to the
|
|
3155
|
+
* other four, and reported on `CameraStatus.switchedOff` so a silent
|
|
3156
|
+
* camera never reads as a working one.
|
|
3157
|
+
*
|
|
3158
|
+
* Returned as ONE list rather than a per-camera query: the group's reader
|
|
3159
|
+
* needs every camera's state, and a per-camera fan-out over the viewer's
|
|
3160
|
+
* single WebSocket is N frames serialised on one socket.
|
|
3161
|
+
*/
|
|
3162
|
+
listDeviceMutes: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({ mutedDeviceIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int()).readonly() }), { auth: "admin" }),
|
|
3163
|
+
/**
|
|
3164
|
+
* Mute or unmute one camera. Idempotent; an unmute of a camera that was
|
|
3165
|
+
* never muted succeeds.
|
|
3166
|
+
*/
|
|
3167
|
+
setDeviceMuted: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
3168
|
+
deviceId: /* @__PURE__ */ zod.z.number().int(),
|
|
3169
|
+
muted: /* @__PURE__ */ zod.z.boolean()
|
|
3170
|
+
}), /* @__PURE__ */ zod.z.object({ success: /* @__PURE__ */ zod.z.literal(true) }), {
|
|
3171
|
+
kind: "mutation",
|
|
3172
|
+
auth: "admin"
|
|
3173
|
+
}),
|
|
3174
|
+
/**
|
|
3175
|
+
* Dry-run a rule against recently persisted records (object events for
|
|
3176
|
+
* `immediate`, closed tracks for `track-end`). Mutation kind only to
|
|
3177
|
+
* carry the full rule object safely; no side effects.
|
|
3178
|
+
*/
|
|
3179
|
+
testRule: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
3180
|
+
rule: NcRuleInputSchema,
|
|
3181
|
+
lookbackMinutes: /* @__PURE__ */ zod.z.number().int().min(1).max(1440).default(60)
|
|
3182
|
+
}), /* @__PURE__ */ zod.z.object({ results: /* @__PURE__ */ zod.z.array(NcTestResultSchema) }), {
|
|
3183
|
+
kind: "mutation",
|
|
3184
|
+
auth: "admin"
|
|
3185
|
+
}),
|
|
3186
|
+
/**
|
|
3187
|
+
* The STATE SUMMARY a system rule would send now (D647) — for a saved rule
|
|
3188
|
+
* or an unsaved draft. Pure: sends nothing, stamps nothing. A MUTATION
|
|
3189
|
+
* only for transport (a whole rule does not belong in a GET URL). Admin,
|
|
3190
|
+
* like `testRule`: it names devices and nodes across the installation.
|
|
3191
|
+
*/
|
|
3192
|
+
previewStateSummary: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ rule: NcRuleInputSchema }), NcStateSummaryPreviewSchema, {
|
|
3193
|
+
kind: "mutation",
|
|
3194
|
+
auth: "admin",
|
|
3195
|
+
access: "view"
|
|
3196
|
+
}),
|
|
3197
|
+
/**
|
|
3198
|
+
* The machine-readable condition surface a rule editor renders from, plus
|
|
3199
|
+
* the picker VOCABULARY those conditions draw on.
|
|
3200
|
+
*
|
|
3201
|
+
* `taxonomy` is optional so an older provider that only returns `catalog`
|
|
3202
|
+
* still validates; a client that receives none keeps free-text inputs.
|
|
3203
|
+
* It was previously served ONLY on the `nc.getConditionCatalog` bridge
|
|
3204
|
+
* action, which is why the viewer had grouped pickers and the admin UI —
|
|
3205
|
+
* which reaches this cap — was stuck typing `person` from memory.
|
|
3206
|
+
*/
|
|
3207
|
+
getConditionCatalog: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({
|
|
3208
|
+
catalog: /* @__PURE__ */ zod.z.array(NcConditionDescriptorSchema),
|
|
3209
|
+
taxonomy: /* @__PURE__ */ NcTaxonomySchema.optional()
|
|
3210
|
+
})),
|
|
3211
|
+
/** The declared `{{var}}` vocabulary; editors filter it with `templateVarsFor`. */
|
|
3212
|
+
getTemplateCatalog: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({
|
|
3213
|
+
vars: /* @__PURE__ */ zod.z.array(NcTemplateVarDescriptorSchema),
|
|
3214
|
+
/** Per-situation default texts; absent on a hub that predates them. */
|
|
3215
|
+
defaults: /* @__PURE__ */ zod.z.array(NcTemplateDefaultSchema)
|
|
3216
|
+
})),
|
|
3217
|
+
/**
|
|
3218
|
+
* Render a template with example values, through the hub's text catalog.
|
|
3219
|
+
* Pure: sends nothing. A MUTATION only for transport — a 2.5k-char draft in
|
|
3220
|
+
* a batched GET URL risks length limits — so access stays `view`, the same
|
|
3221
|
+
* as `getTemplateCatalog`.
|
|
3222
|
+
*/
|
|
3223
|
+
previewTemplate: /* @__PURE__ */ require_capability_definition.method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
|
|
3224
|
+
kind: "mutation",
|
|
3225
|
+
access: "view"
|
|
3226
|
+
}),
|
|
3227
|
+
/**
|
|
3228
|
+
* Queryable delivery history — a read-only view over the durable outbox
|
|
3229
|
+
* (fired rule, subject summary, target, status, timestamps, error on a
|
|
3230
|
+
* dead row). Newest-first, bounded by `filter.limit`. Retention follows
|
|
3231
|
+
* the outbox's own terminal-row prune horizon (no separate history
|
|
3232
|
+
* horizon — single collection, single source of truth). Admin-only in
|
|
3233
|
+
* P1 (no user dimension); the P2 viewer History screen adds per-caller
|
|
3234
|
+
* scoping on the same method.
|
|
3235
|
+
*/
|
|
3236
|
+
getHistory: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ filter: /* @__PURE__ */ NcHistoryFilterSchema.default({ limit: 100 }) }), /* @__PURE__ */ zod.z.object({ entries: /* @__PURE__ */ zod.z.array(NcHistoryEntrySchema) }), { auth: "admin" }),
|
|
3237
|
+
/**
|
|
3238
|
+
* The newest delivery of every rule, in ONE bounded read of the outbox —
|
|
3239
|
+
* the "Last run" column. Never a `getHistory` per rule. A rule with no
|
|
3240
|
+
* delivery inside `horizonMs` is absent from `runs`; see
|
|
3241
|
+
* {@link NcRuleLastRunsSchema} for what absent means. A store that cannot
|
|
3242
|
+
* answer FAILS the call rather than answering "nothing ran". Admin-only,
|
|
3243
|
+
* like `getHistory`, of which it is a projection.
|
|
3244
|
+
*/
|
|
3245
|
+
getRuleLastRuns: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), NcRuleLastRunsSchema, { auth: "admin" }),
|
|
3246
|
+
/**
|
|
3247
|
+
* Mint a fresh, externally-reachable URL for one artefact a history row
|
|
3248
|
+
* named in {@link NcHistoryEntrySchema.shape.artifactIds} — the SAME
|
|
3249
|
+
* signed-link mechanism the dispatcher uses to attach media to an
|
|
3250
|
+
* outgoing notification (one derivation; this never re-implements it).
|
|
3251
|
+
*
|
|
3252
|
+
* `url: null` on THREE causes a caller must treat identically ("no image
|
|
3253
|
+
* right now", never a broken link): the id is unknown, its artefact has
|
|
3254
|
+
* expired past the retained shelf's own age bound, or this install has no
|
|
3255
|
+
* externally-reachable base URL. A caller that received a URL on a
|
|
3256
|
+
* previous call and now gets `null` must stop showing it — a link that
|
|
3257
|
+
* worked five minutes ago is not proof it works now.
|
|
3258
|
+
*/
|
|
3259
|
+
resolveArtifactUrl: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ artifactId: /* @__PURE__ */ zod.z.string().min(1) }), /* @__PURE__ */ zod.z.object({ url: /* @__PURE__ */ zod.z.string().nullable() }), { auth: "admin" }),
|
|
3260
|
+
/**
|
|
3261
|
+
* Snooze windows currently in effect, plus any whose digest has not yet
|
|
3262
|
+
* gone out. `caller: 'required'`: a user sees their OWN windows and the
|
|
3263
|
+
* global ones that silence them, never another person's private silence.
|
|
3264
|
+
* An admin sees every window — a household-wide silence is exactly the
|
|
3265
|
+
* thing an operator has to be able to find and cancel.
|
|
3266
|
+
*/
|
|
3267
|
+
listSnoozes: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({ snoozes: /* @__PURE__ */ zod.z.array(NcSnoozeSchema) }), { caller: "required" }),
|
|
3268
|
+
/**
|
|
3269
|
+
* Open a window. `userId` is stamped from the caller; a GLOBAL window is
|
|
3270
|
+
* permission-checked server-side (the rule's `snoozeAllowGlobal` for a
|
|
3271
|
+
* rule-scoped one, admin for a camera or the whole feed) — a client asking
|
|
3272
|
+
* for one it may not have is rejected, never silently downgraded, because
|
|
3273
|
+
* a snooze the operator believes is in effect and is not is the same
|
|
3274
|
+
* failure as one they cannot end.
|
|
3275
|
+
*/
|
|
3276
|
+
createSnooze: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ snooze: NcSnoozeInputSchema }), /* @__PURE__ */ zod.z.object({ snooze: NcSnoozeSchema }), {
|
|
3277
|
+
kind: "mutation",
|
|
3278
|
+
caller: "required"
|
|
3279
|
+
}),
|
|
3280
|
+
/**
|
|
3281
|
+
* End a window NOW. The digest still goes out (what was hidden while it
|
|
3282
|
+
* was open is still what the operator missed); only the silence stops.
|
|
3283
|
+
* A user may cancel their own; an admin may cancel any.
|
|
3284
|
+
*/
|
|
3285
|
+
cancelSnooze: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ snoozeId: /* @__PURE__ */ zod.z.string() }), /* @__PURE__ */ zod.z.object({ success: /* @__PURE__ */ zod.z.literal(true) }), {
|
|
3286
|
+
kind: "mutation",
|
|
3287
|
+
caller: "required"
|
|
3288
|
+
}),
|
|
3289
|
+
/**
|
|
3290
|
+
* The alarm panel's settings, what each mode ACTUALLY arms, and — when a
|
|
3291
|
+
* panel exists — its `live` state: current state and target mode, what
|
|
3292
|
+
* each mode would find open (blocking or not, and what is unknown), and
|
|
3293
|
+
* the devices currently excluded.
|
|
3294
|
+
*
|
|
3295
|
+
* Coverage is returned by the same call as the settings on purpose: they
|
|
3296
|
+
* are read together or not at all. An editor that showed the delays
|
|
3297
|
+
* without the coverage would let an operator tune an exit delay for a mode
|
|
3298
|
+
* that arms nothing, which is the failure this whole surface exists to
|
|
3299
|
+
* make visible.
|
|
3300
|
+
*/
|
|
3301
|
+
getAlarmConfig: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), NcAlarmConfigSchema, { auth: "admin" }),
|
|
3302
|
+
/**
|
|
3303
|
+
* Patch the settings (durations — global and per mode —, recipients,
|
|
3304
|
+
* per-mode non-blocking lists or one membership edit; `announceArm` is
|
|
3305
|
+
* accepted and ignored — D630). Returns the WHOLE config,
|
|
3306
|
+
* coverage and `live` included, so a
|
|
3307
|
+
* client never has to guess what the server settled on — the panel clamps
|
|
3308
|
+
* and normalises, and a form that re-rendered from its own input would
|
|
3309
|
+
* show a value the alarm is not using.
|
|
3310
|
+
*/
|
|
3311
|
+
setAlarmConfig: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
|
|
3312
|
+
kind: "mutation",
|
|
3313
|
+
auth: "admin"
|
|
3314
|
+
}),
|
|
3315
|
+
/**
|
|
3316
|
+
* Create a named profile. Without `cloneFromId` the new profile starts at
|
|
3317
|
+
* system defaults (empty memberships); with it, a copy of that profile.
|
|
3318
|
+
* Does not activate — the operator switches explicitly.
|
|
3319
|
+
*/
|
|
3320
|
+
createAlarmProfile: /* @__PURE__ */ require_capability_definition.method(NcAlarmCreateProfileInputSchema, NcAlarmConfigSchema, {
|
|
3321
|
+
kind: "mutation",
|
|
3322
|
+
auth: "admin"
|
|
3323
|
+
}),
|
|
3324
|
+
/** Rename a profile (Default included — only the name, never the id). */
|
|
3325
|
+
renameAlarmProfile: /* @__PURE__ */ require_capability_definition.method(NcAlarmRenameProfileInputSchema, NcAlarmConfigSchema, {
|
|
3326
|
+
kind: "mutation",
|
|
3327
|
+
auth: "admin"
|
|
3328
|
+
}),
|
|
3329
|
+
/**
|
|
3330
|
+
* Delete a non-default profile. If it was active, Default becomes active
|
|
3331
|
+
* and its settings are applied for arm decisions.
|
|
3332
|
+
*/
|
|
3333
|
+
deleteAlarmProfile: /* @__PURE__ */ require_capability_definition.method(NcAlarmProfileIdInputSchema, NcAlarmConfigSchema, {
|
|
3334
|
+
kind: "mutation",
|
|
3335
|
+
auth: "admin"
|
|
3336
|
+
}),
|
|
3337
|
+
/**
|
|
3338
|
+
* Make this profile active: its membership/delays blob is applied to the
|
|
3339
|
+
* panel so the next arm uses it.
|
|
3340
|
+
*/
|
|
3341
|
+
activateAlarmProfile: /* @__PURE__ */ require_capability_definition.method(NcAlarmProfileIdInputSchema, NcAlarmConfigSchema, {
|
|
3342
|
+
kind: "mutation",
|
|
3343
|
+
auth: "admin"
|
|
3344
|
+
}),
|
|
3345
|
+
/**
|
|
3346
|
+
* The CURRENT state of each asked device as the alarm reads it (D697) — open, closed,
|
|
3347
|
+
* unknown (why) or not an opening, plus liveness. Classified by the same table the arm
|
|
3348
|
+
* check uses (`alarm-openings.ts`), so the editor and the arm can never disagree. The
|
|
3349
|
+
* caller names the ids (the household openings it already holds); at most
|
|
3350
|
+
* `NC_ALARM_SENSORS_MAX`.
|
|
3351
|
+
*/
|
|
3352
|
+
getAlarmSensors: /* @__PURE__ */ require_capability_definition.method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" })
|
|
3353
|
+
},
|
|
3354
|
+
vocabulary: { notOperatorFacing: "notification rules — authored on their own page" }
|
|
3355
|
+
};
|
|
3356
|
+
//#endregion
|
|
3357
|
+
Object.defineProperty(exports, "AlarmPanelStatusSchema", {
|
|
3358
|
+
enumerable: true,
|
|
3359
|
+
get: function() {
|
|
3360
|
+
return AlarmPanelStatusSchema;
|
|
3361
|
+
}
|
|
3362
|
+
});
|
|
3363
|
+
Object.defineProperty(exports, "AlarmStateSchema", {
|
|
3364
|
+
enumerable: true,
|
|
3365
|
+
get: function() {
|
|
3366
|
+
return AlarmStateSchema;
|
|
3367
|
+
}
|
|
3368
|
+
});
|
|
3369
|
+
Object.defineProperty(exports, "NcConditionDescriptorSchema", {
|
|
3370
|
+
enumerable: true,
|
|
3371
|
+
get: function() {
|
|
3372
|
+
return NcConditionDescriptorSchema;
|
|
3373
|
+
}
|
|
3374
|
+
});
|
|
3375
|
+
Object.defineProperty(exports, "NcConditionsSchema", {
|
|
3376
|
+
enumerable: true,
|
|
3377
|
+
get: function() {
|
|
3378
|
+
return NcConditionsSchema;
|
|
3379
|
+
}
|
|
3380
|
+
});
|
|
3381
|
+
Object.defineProperty(exports, "NcScheduleSchema", {
|
|
3382
|
+
enumerable: true,
|
|
3383
|
+
get: function() {
|
|
3384
|
+
return NcScheduleSchema;
|
|
3385
|
+
}
|
|
3386
|
+
});
|
|
3387
|
+
Object.defineProperty(exports, "NcTaggedRuleKindSchema", {
|
|
3388
|
+
enumerable: true,
|
|
3389
|
+
get: function() {
|
|
3390
|
+
return NcTaggedRuleKindSchema;
|
|
3391
|
+
}
|
|
3392
|
+
});
|
|
3393
|
+
Object.defineProperty(exports, "NotificationFieldSchema", {
|
|
3394
|
+
enumerable: true,
|
|
3395
|
+
get: function() {
|
|
3396
|
+
return NotificationFieldSchema;
|
|
3397
|
+
}
|
|
3398
|
+
});
|
|
3399
|
+
Object.defineProperty(exports, "TargetSchema", {
|
|
3400
|
+
enumerable: true,
|
|
3401
|
+
get: function() {
|
|
3402
|
+
return TargetSchema;
|
|
3403
|
+
}
|
|
3404
|
+
});
|
|
3405
|
+
Object.defineProperty(exports, "alarmPanelCapability", {
|
|
3406
|
+
enumerable: true,
|
|
3407
|
+
get: function() {
|
|
3408
|
+
return alarmPanelCapability;
|
|
3409
|
+
}
|
|
3410
|
+
});
|
|
3411
|
+
Object.defineProperty(exports, "notificationOutputCapability", {
|
|
3412
|
+
enumerable: true,
|
|
3413
|
+
get: function() {
|
|
3414
|
+
return notificationOutputCapability;
|
|
3415
|
+
}
|
|
3416
|
+
});
|
|
3417
|
+
Object.defineProperty(exports, "notificationRulesCapability", {
|
|
3418
|
+
enumerable: true,
|
|
3419
|
+
get: function() {
|
|
3420
|
+
return notificationRulesCapability;
|
|
3421
|
+
}
|
|
3422
|
+
});
|