@camstack/addon-provider-homeassistant 1.2.150 → 1.2.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +1 -1
- package/dist/addon.mjs +1 -1
- package/dist/{dist-BwAVAaOH.mjs → dist-BITMr6s5.mjs} +357 -249
- package/dist/{dist-B-PoT2TH.js → dist-nbfaHTXG.js} +357 -249
- package/dist/ha-export/ha-export.addon.js +16 -16
- package/dist/ha-export/ha-export.addon.mjs +16 -16
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("node:crypto");
|
|
2
|
-
//#region ../types/dist/event-category-
|
|
2
|
+
//#region ../types/dist/event-category-BGmz_oxW.mjs
|
|
3
3
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4
4
|
EventCategory["SystemBoot"] = "system.boot";
|
|
5
5
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -532,6 +532,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
532
532
|
*/
|
|
533
533
|
EventCategory["PipelineAudioInferenceResult"] = "pipeline.audio-inference-result";
|
|
534
534
|
EventCategory["DetectionPhaseTransition"] = "detection.phase-transition";
|
|
535
|
+
/**
|
|
536
|
+
* A camera provider's RAW onboard motion push (D673): the `MotionOnMotionChanged`
|
|
537
|
+
* data shape without `triggeredBy`, built by `providerMotionEvent`. Its one
|
|
538
|
+
* consumer is the orchestrator's camera-sensors bridge, which re-emits the
|
|
539
|
+
* camera's EFFECTIVE onboard motion as `MotionOnMotionChanged` (a pass-through
|
|
540
|
+
* for a camera with no attached sensor). Providers must not emit
|
|
541
|
+
* `MotionOnMotionChanged` themselves; `scripts/check-onboard-motion-emitters.ts`
|
|
542
|
+
* keeps it so (camera-grid is a named, deferred exception).
|
|
543
|
+
*/
|
|
535
544
|
EventCategory["ProviderMotion"] = "provider.motion";
|
|
536
545
|
EventCategory["ProviderDetection"] = "provider.detection";
|
|
537
546
|
EventCategory["EnrichmentEmbeddingStored"] = "enrichment.embedding.stored";
|
|
@@ -5370,7 +5379,7 @@ var ZodIssueCode = {
|
|
|
5370
5379
|
var ZodFirstPartyTypeKind;
|
|
5371
5380
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5372
5381
|
//#endregion
|
|
5373
|
-
//#region ../types/dist/sleep-
|
|
5382
|
+
//#region ../types/dist/sleep-CDCONfkt.mjs
|
|
5374
5383
|
/**
|
|
5375
5384
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5376
5385
|
* window to float samples (D455).
|
|
@@ -7472,7 +7481,7 @@ function errMsg(err) {
|
|
|
7472
7481
|
return String(err);
|
|
7473
7482
|
}
|
|
7474
7483
|
//#endregion
|
|
7475
|
-
//#region ../types/dist/composition-
|
|
7484
|
+
//#region ../types/dist/composition-D7ULvLdD.mjs
|
|
7476
7485
|
/**
|
|
7477
7486
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
7478
7487
|
*
|
|
@@ -7526,21 +7535,20 @@ function portable(target) {
|
|
|
7526
7535
|
}
|
|
7527
7536
|
portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64");
|
|
7528
7537
|
/**
|
|
7529
|
-
*
|
|
7530
|
-
*
|
|
7538
|
+
* THE table "which boolean of this device type counts as HIGH", and the
|
|
7539
|
+
* pure evaluator of its EDGE.
|
|
7531
7540
|
*
|
|
7532
|
-
*
|
|
7533
|
-
*
|
|
7534
|
-
*
|
|
7535
|
-
*
|
|
7536
|
-
*
|
|
7537
|
-
*
|
|
7538
|
-
* SPOSTA qui e il doorbell la ri-esporta.
|
|
7541
|
+
* ONE table for everyone who asks "is this device HIGH?": the
|
|
7542
|
+
* recorder's `RecordingTriggers.sensorDeviceIds` trigger, the post-analysis
|
|
7543
|
+
* sensor markers, the orchestrator's camera-sensors bridge and
|
|
7544
|
+
* the sources of a composite doorbell (`doorbellFeatureSources`, D671).
|
|
7545
|
+
* A second copy would diverge at the first cap added, and the symptom — "the
|
|
7546
|
+
* sensor rings the doorbell but does not record" — is exactly D62.
|
|
7539
7547
|
*
|
|
7540
|
-
* ⚠
|
|
7541
|
-
*
|
|
7542
|
-
*
|
|
7543
|
-
*
|
|
7548
|
+
* ⚠ NOT `DEVICE_STATE_READERS` (`catalogs/device-state-vocabulary.ts`), and the
|
|
7549
|
+
* two must not be unified: that one answers "what is the state WORD for a
|
|
7550
|
+
* rule" (and includes `presence`, `cover`, `alarm-panel`), this one "which
|
|
7551
|
+
* boolean's EDGE counts". Deliberately different vocabularies.
|
|
7544
7552
|
*/
|
|
7545
7553
|
/**
|
|
7546
7554
|
* Known binary / switch source caps → the boolean slice field whose
|
|
@@ -7561,8 +7569,6 @@ var SOURCE_CAP_ACTIVE_FIELD = {
|
|
|
7561
7569
|
vibration: "detected",
|
|
7562
7570
|
tamper: "tampered"
|
|
7563
7571
|
};
|
|
7564
|
-
/** Cap names whose presence in a device's bindings qualify it as a source. */
|
|
7565
|
-
var SOURCE_CAPS = Object.keys(SOURCE_CAP_ACTIVE_FIELD);
|
|
7566
7572
|
/**
|
|
7567
7573
|
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7568
7574
|
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
@@ -9293,22 +9299,22 @@ var CLASS_MAP_MACRO_TARGETS = [
|
|
|
9293
9299
|
"package"
|
|
9294
9300
|
];
|
|
9295
9301
|
/**
|
|
9296
|
-
*
|
|
9297
|
-
*
|
|
9302
|
+
* The FIRST-LEVEL macro classes: those an object detector emits and that
|
|
9303
|
+
* an operator can select.
|
|
9298
9304
|
*
|
|
9299
|
-
*
|
|
9305
|
+
* They are the three offered by the `object-detection` step
|
|
9300
9306
|
* (`addon-pipeline/src/detection-pipeline/registry/step-definitions.ts`,
|
|
9301
|
-
* `enabledMacroClasses`). `package`
|
|
9302
|
-
* `MACRO_LABELS` —
|
|
9303
|
-
* `package-detection`,
|
|
9304
|
-
*
|
|
9307
|
+
* `enabledMacroClasses`). `package` is in {@link CLASS_MAP_MACRO_TARGETS} and in
|
|
9308
|
+
* `MACRO_LABELS` — it is a true macro — but NOT here: it belongs to the step
|
|
9309
|
+
* `package-detection`, whose enablement is driven by zones, and offering the
|
|
9310
|
+
* same word twice has already made an operator turn on the COCO proxy
|
|
9305
9311
|
* (suitcase/backpack/handbag) lasciando spento il detector dedicato.
|
|
9306
9312
|
*
|
|
9307
|
-
*
|
|
9308
|
-
*
|
|
9309
|
-
* (`types/detection.ts`);
|
|
9310
|
-
* (`RecordingTriggers.objectClasses`)
|
|
9311
|
-
*
|
|
9313
|
+
* ONE list. Before today the same three were hand-written in the step's offer
|
|
9314
|
+
* and a second time as the union `FirstLevelMacro`
|
|
9315
|
+
* (`types/detection.ts`); a third copy for the recording trigger
|
|
9316
|
+
* (`RecordingTriggers.objectClasses`) would have made the later divergence
|
|
9317
|
+
* invisible.
|
|
9312
9318
|
*/
|
|
9313
9319
|
var FIRST_LEVEL_MACRO_CLASSES = [
|
|
9314
9320
|
"person",
|
|
@@ -9373,17 +9379,17 @@ var RecordingStorageModeSchema = _enum([
|
|
|
9373
9379
|
"on-device-decision"
|
|
9374
9380
|
]);
|
|
9375
9381
|
/**
|
|
9376
|
-
*
|
|
9377
|
-
*
|
|
9382
|
+
* The macro classes that can open a recording window — the same
|
|
9383
|
+
* three offered by the `object-detection` step, from ONE list
|
|
9378
9384
|
* ({@link FIRST_LEVEL_MACRO_CLASSES}).
|
|
9379
9385
|
*/
|
|
9380
9386
|
var RecordingObjectTriggerClassSchema = _enum(FIRST_LEVEL_MACRO_CLASSES);
|
|
9381
9387
|
/**
|
|
9382
|
-
* True
|
|
9388
|
+
* True when `values` does not repeat an element.
|
|
9383
9389
|
*
|
|
9384
|
-
*
|
|
9385
|
-
*
|
|
9386
|
-
*
|
|
9390
|
+
* A duplicate is not harmless: every entry of `objectClasses` / `sensorDeviceIds`
|
|
9391
|
+
* becomes a SOURCE in `bandTriggerSources`, and the same source twice
|
|
9392
|
+
* would count its windows twice in `segmentMissedByMs`.
|
|
9387
9393
|
*/
|
|
9388
9394
|
var noDuplicates = (values) => new Set(values).size === values.length;
|
|
9389
9395
|
/** Which detectors trigger an `events`-mode band. */
|
|
@@ -9391,34 +9397,34 @@ var RecordingTriggersSchema = object({
|
|
|
9391
9397
|
motion: boolean().optional(),
|
|
9392
9398
|
audioThresholdDbfs: number().optional(),
|
|
9393
9399
|
/**
|
|
9394
|
-
*
|
|
9395
|
-
*
|
|
9396
|
-
*
|
|
9397
|
-
*
|
|
9400
|
+
* The macro classes whose detection opens a window. ABSENT = the source
|
|
9401
|
+
* is not listened to; an EMPTY array is rejected, because "events band, object
|
|
9402
|
+
* trigger on, no class" is the same shape "enabled and records
|
|
9403
|
+
* nothing, forever" that `eventsBandCanEverDemand` is written against.
|
|
9398
9404
|
*
|
|
9399
|
-
*
|
|
9400
|
-
*
|
|
9401
|
-
* `minConfidence<Macro>`
|
|
9402
|
-
* (`source: 'onboard'`)
|
|
9403
|
-
*
|
|
9405
|
+
* The signal read is ALREADY FILTERED: only `source: 'pipeline'` detections, i.e.
|
|
9406
|
+
* those that went through `enabledMacroClasses`, the
|
|
9407
|
+
* `minConfidence<Macro>` and the full-frame guard. The camera's onboard AI
|
|
9408
|
+
* (`source: 'onboard'`) goes through none of those gates and does NOT open
|
|
9409
|
+
* windows — see `recorder/object-trigger.ts`.
|
|
9404
9410
|
*/
|
|
9405
9411
|
objectClasses: array(RecordingObjectTriggerClassSchema).min(1).refine(noDuplicates, { message: "objectClasses must not repeat a class" }).optional(),
|
|
9406
9412
|
/**
|
|
9407
|
-
*
|
|
9408
|
-
*
|
|
9413
|
+
* The LINKED devices whose RISING EDGE opens a window. Absent = the source
|
|
9414
|
+
* is not listened to; an empty array is rejected for the same reason as
|
|
9409
9415
|
* `objectClasses`.
|
|
9410
9416
|
*
|
|
9411
|
-
*
|
|
9412
|
-
*
|
|
9413
|
-
*
|
|
9414
|
-
*
|
|
9415
|
-
* device (D12) —
|
|
9417
|
+
* These are SOURCE device ids, not cameras: the band names them, so the
|
|
9418
|
+
* hot path (`DeviceStateChanged`, at bus rate across the whole fleet)
|
|
9419
|
+
* does no RPC. The OFFER from which the operator picks them is another question, and
|
|
9420
|
+
* is resolved with `deviceManager.getLinkedDevices` + `getBindingsBatch` per
|
|
9421
|
+
* device (D12) — never a global list of caps.
|
|
9416
9422
|
*
|
|
9417
|
-
*
|
|
9418
|
-
* `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`)
|
|
9419
|
-
*
|
|
9420
|
-
*
|
|
9421
|
-
*
|
|
9423
|
+
* What "high" means depends on the device TYPE and is not decided here:
|
|
9424
|
+
* `SOURCE_CAP_ACTIVE_FIELD` (`catalogs/sensor-active-state.ts`) is THE table,
|
|
9425
|
+
* the same one as the composite doorbell (D671). And it is the EDGE, not
|
|
9426
|
+
* the level: a contact found already open at runner restart does not
|
|
9427
|
+
* record.
|
|
9422
9428
|
*/
|
|
9423
9429
|
sensorDeviceIds: array(number().int().positive()).min(1).max(16).refine(noDuplicates, { message: "sensorDeviceIds must not repeat a device" }).optional()
|
|
9424
9430
|
});
|
|
@@ -10495,7 +10501,7 @@ var DecoderSessionConfigSchema = object({
|
|
|
10495
10501
|
* - **VALUE** — at which level, for which scope, until when. That stays ONE
|
|
10496
10502
|
* thing: the logging settings document on the `system` cap. Two authorities
|
|
10497
10503
|
* over the values is the exact defect
|
|
10498
|
-
* `docs/design/plans/2026-08-26-
|
|
10504
|
+
* `docs/design/plans/2026-08-26-per-component-logging.md` was written to
|
|
10499
10505
|
* remove; re-introducing it from the cure side would be grotesque.
|
|
10500
10506
|
*
|
|
10501
10507
|
* Nothing in this file reads a clock, an env var or a store. The registry is
|
|
@@ -14118,7 +14124,7 @@ method(_void(), EngineInfoSchema, { auth: "admin" }), method(object({
|
|
|
14118
14124
|
*
|
|
14119
14125
|
* ⚠ An earlier version of this comment blamed Zod stripping, and that
|
|
14120
14126
|
* was wrong — corrected 2026-08-26 after the hop map
|
|
14121
|
-
* (`docs/design/2026-08-26-
|
|
14127
|
+
* (`docs/design/2026-08-26-topic-hop-map.md`) traced the path.
|
|
14122
14128
|
* There is **no Zod parse at all** between the door and the engine: the
|
|
14123
14129
|
* dispatcher forwards the payload verbatim and UDS carries it whole. A
|
|
14124
14130
|
* field declared here reaches `SqliteSettingsBackend` either way.
|
|
@@ -15215,7 +15221,17 @@ var SiteZoneSchema = object({
|
|
|
15215
15221
|
var ProviderStatusSchema = object({
|
|
15216
15222
|
connected: boolean(),
|
|
15217
15223
|
deviceCount: number(),
|
|
15218
|
-
error: string().optional()
|
|
15224
|
+
error: string().optional(),
|
|
15225
|
+
/**
|
|
15226
|
+
* `'orchestrator'`: this provider writes NO camera's `motion` runtime slice
|
|
15227
|
+
* — the orchestrator is its only writer (D696). Set by `BaseDeviceProvider`,
|
|
15228
|
+
* which every provider bundles, so only a provider BUILT from D696-amended
|
|
15229
|
+
* code says it. ABSENT means an older provider that may still write it (raw
|
|
15230
|
+
* VMD writes, a boot seed), and the orchestrator's provider gate keeps that
|
|
15231
|
+
* provider's cameras unwritten (`camera-sensors/motion-slice-provider-gate.ts`)
|
|
15232
|
+
* — the provider twin of the runner's `getLocalLoad().motionSliceWriter`.
|
|
15233
|
+
*/
|
|
15234
|
+
motionSliceWriter: literal("orchestrator").optional()
|
|
15219
15235
|
});
|
|
15220
15236
|
object({
|
|
15221
15237
|
externalId: string(),
|
|
@@ -16094,109 +16110,10 @@ method(object({
|
|
|
16094
16110
|
deviceIds: array(number()).readonly(),
|
|
16095
16111
|
caps: array(string()).readonly().optional()
|
|
16096
16112
|
}), record(string(), record(string(), unknown().nullable())));
|
|
16097
|
-
|
|
16098
|
-
|
|
16099
|
-
* name (same pattern as `snapshot`):
|
|
16100
|
-
*
|
|
16101
|
-
* - **Native** providers: registered per-device by device-driver
|
|
16102
|
-
* addons via `ctx.registerNativeCap` — either on a
|
|
16103
|
-
* `DeviceType.Button` accessory with `role: DeviceRole.Doorbell`,
|
|
16104
|
-
* or directly on the camera (Reolink registers at camera level).
|
|
16105
|
-
* Emits an `onPressed` event every time the firmware pushes a
|
|
16106
|
-
* ring; status tracks the last press and a pressCount since start
|
|
16107
|
-
* (diagnostic).
|
|
16108
|
-
*
|
|
16109
|
-
* - **Wrapper** provider: the `virtual-doorbell` system builtin
|
|
16110
|
-
* (`@camstack/system/builtins/doorbell`). Turns ANY binary-ish
|
|
16111
|
-
* device (contact / switch / event-emitter …) into a doorbell for
|
|
16112
|
-
* a camera. `defaultActive: false` — the operator explicitly binds
|
|
16113
|
-
* it per camera in the device-bindings UI, then picks the source
|
|
16114
|
-
* device + trigger in the per-device settings.
|
|
16115
|
-
*
|
|
16116
|
-
* The DeviceEventPropagator re-emits `onPressed` on the camera parent
|
|
16117
|
-
* — subscribers listening at the camera level receive ring events
|
|
16118
|
-
* with `via[]` populated. No code on the parent needed.
|
|
16119
|
-
*/
|
|
16120
|
-
var DoorbellStatusSchema = object({
|
|
16121
|
-
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
16122
|
-
lastPressedAt: number().nullable(),
|
|
16123
|
-
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
16124
|
-
pressCountSinceStart: number()
|
|
16125
|
-
});
|
|
16126
|
-
var DoorbellPressEventSchema = object({
|
|
16127
|
-
deviceId: number(),
|
|
16128
|
-
timestamp: number()
|
|
16129
|
-
});
|
|
16130
|
-
/**
|
|
16131
|
-
* The `doorbell-source` extension slot's editable value (D648): the camera's
|
|
16132
|
-
* virtual-doorbell trigger devices, exactly what the wrapper's
|
|
16133
|
-
* `doorbellSources` persists (as `{ deviceId }` records).
|
|
16134
|
-
*/
|
|
16135
|
-
var DoorbellSourceSlotValueSchema = object({ deviceIds: array(number().int().positive()) });
|
|
16136
|
-
/**
|
|
16137
|
-
* The `doorbell-source` slot — which devices ring this camera's VIRTUAL
|
|
16138
|
-
* doorbell, owned by the `virtual-doorbell` wrapper over its
|
|
16139
|
-
* `doorbellSources` store (D648). A source rings when one of its
|
|
16140
|
-
* `SOURCE_CAPS` rises. Whether the wrapper is bound to the camera at all is a
|
|
16141
|
-
* different authority (`deviceManager.setWrapperActive`, D62) — the slot
|
|
16142
|
-
* reports it, it never writes it.
|
|
16143
|
-
*/
|
|
16144
|
-
var DOORBELL_SOURCE_SLOT = {
|
|
16145
|
-
id: "doorbell-source",
|
|
16146
|
-
label: "Doorbell trigger devices",
|
|
16147
|
-
description: "Any of these becoming active rings this camera's virtual doorbell: a binary sensor when it goes active, a switch when it turns on.",
|
|
16148
|
-
shape: "association",
|
|
16149
|
-
hostDeviceTypes: [DeviceType.Camera],
|
|
16150
|
-
sourceCaps: SOURCE_CAPS,
|
|
16151
|
-
cardinality: "many",
|
|
16152
|
-
value: DoorbellSourceSlotValueSchema
|
|
16153
|
-
};
|
|
16154
|
-
var doorbellCapability = {
|
|
16155
|
-
name: "doorbell",
|
|
16156
|
-
scope: "device",
|
|
16157
|
-
deviceNative: true,
|
|
16158
|
-
mode: "singleton",
|
|
16159
|
-
kind: "wrapper",
|
|
16160
|
-
defaultActive: false,
|
|
16161
|
-
deviceTypes: [DeviceType.Button, DeviceType.Camera],
|
|
16162
|
-
extensionSlots: [DOORBELL_SOURCE_SLOT],
|
|
16163
|
-
methods: {},
|
|
16164
|
-
events: {
|
|
16165
|
-
/**
|
|
16166
|
-
* Fires once per physical press. Reolink delivers via Baichuan
|
|
16167
|
-
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
16168
|
-
* release/duration — it's a pulse.
|
|
16169
|
-
*/
|
|
16170
|
-
onPressed: {
|
|
16171
|
-
data: DoorbellPressEventSchema,
|
|
16172
|
-
fromState: {
|
|
16173
|
-
field: "lastPressedAt",
|
|
16174
|
-
on: "advance"
|
|
16175
|
-
}
|
|
16176
|
-
} },
|
|
16177
|
-
status: {
|
|
16178
|
-
schema: DoorbellStatusSchema,
|
|
16179
|
-
kind: "push"
|
|
16180
|
-
},
|
|
16181
|
-
/**
|
|
16182
|
-
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
16183
|
-
* Mirrored by the kernel and readable via
|
|
16184
|
-
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
16185
|
-
* without subscribing.
|
|
16186
|
-
*/
|
|
16187
|
-
runtimeState: DoorbellStatusSchema,
|
|
16188
|
-
/**
|
|
16189
|
-
* Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
|
|
16190
|
-
*
|
|
16191
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
16192
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
16193
|
-
*/
|
|
16194
|
-
durability: "restored"
|
|
16195
|
-
};
|
|
16196
|
-
var ExtensionSlotIdSchema = _enum(["doorbell-source", "linked-devices"]);
|
|
16197
|
-
DeviceType.Camera, DeviceType.Camera;
|
|
16113
|
+
var ExtensionSlotIdSchema = _enum(["linked-devices"]);
|
|
16114
|
+
DeviceType.Camera;
|
|
16198
16115
|
/** A slot's editable value, discriminated on `slot`. */
|
|
16199
|
-
var ExtensionSlotValueSchema = discriminatedUnion("slot", [
|
|
16116
|
+
var ExtensionSlotValueSchema = discriminatedUnion("slot", [LinkedDevicesSlotValueSchema.extend({ slot: literal("linked-devices") })]);
|
|
16200
16117
|
DeviceType.Camera;
|
|
16201
16118
|
var ExtensionSourceAvailabilitySchema = discriminatedUnion("state", [object({ state: literal("ok") }), object({
|
|
16202
16119
|
state: literal("unreachable"),
|
|
@@ -16233,10 +16150,11 @@ var ExtensionSlotSourceSchema = object({
|
|
|
16233
16150
|
});
|
|
16234
16151
|
/**
|
|
16235
16152
|
* A DIFFERENT authority that gates whether the slot's sources do anything —
|
|
16236
|
-
* reported read-only, named, never written through this contract (D62).
|
|
16237
|
-
*
|
|
16238
|
-
*
|
|
16239
|
-
* `unknown` means the gate could
|
|
16153
|
+
* reported read-only, named, never written through this contract (D62) — e.g.
|
|
16154
|
+
* a slot whose sources act only while a wrapper is bound to the host, a
|
|
16155
|
+
* binding that belongs to `deviceManager.setWrapperActive`. No slot reports
|
|
16156
|
+
* one today (`linked-devices` answers `null`). `unknown` means the gate could
|
|
16157
|
+
* not be read; it is not "inactive" (D315).
|
|
16240
16158
|
*/
|
|
16241
16159
|
var ExtensionSlotActivationSchema = object({
|
|
16242
16160
|
state: _enum([
|
|
@@ -16252,7 +16170,7 @@ var ExtensionSlotRowSchema = discriminatedUnion("state", [object({
|
|
|
16252
16170
|
/** `<source>:<slotId>` — the routing key for `listCandidates` / `setSlot`. */
|
|
16253
16171
|
slotRef: string(),
|
|
16254
16172
|
slot: ExtensionSlotIdSchema,
|
|
16255
|
-
/** Names the store written (D62), e.g. `
|
|
16173
|
+
/** Names the store written (D62), e.g. `device-manager:_linkedDeviceIds`. */
|
|
16256
16174
|
authority: string(),
|
|
16257
16175
|
activation: ExtensionSlotActivationSchema.nullable(),
|
|
16258
16176
|
value: ExtensionSlotValueSchema,
|
|
@@ -16530,7 +16448,7 @@ method(object({
|
|
|
16530
16448
|
* per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
|
|
16531
16449
|
* ends in a log line, and a log line is the thing the operator asked to stop
|
|
16532
16450
|
* needing: *"possiamo armare questi errori intanto? Così al prossimo giro
|
|
16533
|
-
* ricontrolliamo tutti questi punti"
|
|
16451
|
+
* ricontrolliamo tutti questi punti"* [can we instrument these errors in the meantime? That way next round we recheck all these points]. Reading them meant grepping Loki and
|
|
16534
16452
|
* hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
|
|
16535
16453
|
* media blackout were both diagnosed. The counters stay; this is where they can
|
|
16536
16454
|
* be READ.
|
|
@@ -20789,6 +20707,29 @@ object({
|
|
|
20789
20707
|
firstAt: number(),
|
|
20790
20708
|
lastAt: number()
|
|
20791
20709
|
});
|
|
20710
|
+
var NC_ALARM_TRIGGERED_MAX_SEC = 3600;
|
|
20711
|
+
var NcAlarmDelaySecSchema = number().int().min(0).max(600);
|
|
20712
|
+
var NcAlarmTriggeredSecSchema = number().int().min(0).max(NC_ALARM_TRIGGERED_MAX_SEC);
|
|
20713
|
+
var uniqueModes = (entries) => new Set(entries.map((e) => e.mode)).size === entries.length;
|
|
20714
|
+
var NcAlarmModeDelaysListSchema = array(object({
|
|
20715
|
+
mode: AlarmArmModeSchema,
|
|
20716
|
+
exitDelaySec: NcAlarmDelaySecSchema.optional(),
|
|
20717
|
+
entryDelaySec: NcAlarmDelaySecSchema.optional(),
|
|
20718
|
+
triggeredDurationSec: NcAlarmTriggeredSecSchema.optional()
|
|
20719
|
+
})).max(8).refine(uniqueModes, { message: "modeDelays: at most one entry per arm mode" });
|
|
20720
|
+
var NcAlarmModeDelaysEditListSchema = array(object({
|
|
20721
|
+
mode: AlarmArmModeSchema,
|
|
20722
|
+
exitDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
|
|
20723
|
+
entryDelaySec: NcAlarmDelaySecSchema.nullable().optional(),
|
|
20724
|
+
triggeredDurationSec: NcAlarmTriggeredSecSchema.nullable().optional()
|
|
20725
|
+
})).max(8).refine(uniqueModes, { message: "modeDelays: at most one edit per arm mode" });
|
|
20726
|
+
/** One switch of the alarm table: put ONE device on, or take it off, ONE mode's list. */
|
|
20727
|
+
var NcAlarmNonBlockingEditSchema = object({
|
|
20728
|
+
mode: AlarmArmModeSchema,
|
|
20729
|
+
deviceId: number().int().positive(),
|
|
20730
|
+
/** true = on the list (may be open, does not block); false = off the list (blocks). */
|
|
20731
|
+
nonBlocking: boolean()
|
|
20732
|
+
});
|
|
20792
20733
|
/**
|
|
20793
20734
|
* The per-mode lists, at most one per mode. Two lists for one mode have no
|
|
20794
20735
|
* meaning a reader could agree on (union? the last one?), so they are refused
|
|
@@ -20797,10 +20738,10 @@ object({
|
|
|
20797
20738
|
var NcAlarmNonBlockingListSchema = array(object({
|
|
20798
20739
|
mode: AlarmArmModeSchema,
|
|
20799
20740
|
deviceIds: array(number().int()).max(200)
|
|
20800
|
-
})).max(8).refine(
|
|
20741
|
+
})).max(8).refine(uniqueModes, { message: "nonBlocking: at most one list per arm mode" });
|
|
20801
20742
|
/**
|
|
20802
|
-
* The three durations
|
|
20803
|
-
* transitions, and which openings each mode tolerates.
|
|
20743
|
+
* The three durations — global, and per mode since D697 — the panel's state
|
|
20744
|
+
* machine runs on, who hears about its transitions, and which openings each mode tolerates.
|
|
20804
20745
|
*
|
|
20805
20746
|
* They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
|
|
20806
20747
|
* `alarm-panel` is `deviceNative` and its other provider mirrors somebody
|
|
@@ -20810,15 +20751,15 @@ var NcAlarmNonBlockingListSchema = array(object({
|
|
|
20810
20751
|
*/
|
|
20811
20752
|
var NcAlarmSettingsSchema = object({
|
|
20812
20753
|
/** Grace period between arming and the mode taking effect. 0 = immediate. */
|
|
20813
|
-
exitDelaySec:
|
|
20754
|
+
exitDelaySec: NcAlarmDelaySecSchema,
|
|
20814
20755
|
/** Grace period between a trigger and the alarm firing. 0 = immediate. */
|
|
20815
|
-
entryDelaySec:
|
|
20756
|
+
entryDelaySec: NcAlarmDelaySecSchema,
|
|
20816
20757
|
/**
|
|
20817
20758
|
* How long `triggered` lasts before the panel re-arms itself.
|
|
20818
20759
|
* **0 = until an operator disarms it** — the behaviour before this field
|
|
20819
20760
|
* existed, and therefore what an untouched install keeps doing.
|
|
20820
20761
|
*/
|
|
20821
|
-
triggeredDurationSec:
|
|
20762
|
+
triggeredDurationSec: NcAlarmTriggeredSecSchema,
|
|
20822
20763
|
/**
|
|
20823
20764
|
* Deprecated by D630 — every transition is announced. Parsed, never read;
|
|
20824
20765
|
* remove after one release. Optional so an older admin's patch (which still
|
|
@@ -20841,17 +20782,30 @@ var NcAlarmSettingsSchema = object({
|
|
|
20841
20782
|
* per mode is meaningful. Defaulted to `[]` so a blob stored before D630
|
|
20842
20783
|
* parses as "every opening blocks" — the behaviour it was written under.
|
|
20843
20784
|
*/
|
|
20844
|
-
nonBlocking: NcAlarmNonBlockingListSchema.default([])
|
|
20785
|
+
nonBlocking: NcAlarmNonBlockingListSchema.default([]),
|
|
20786
|
+
/**
|
|
20787
|
+
* Per arm mode, the delays that mode OVERRIDES (D697). A mode with no entry, or an entry
|
|
20788
|
+
* without a field, uses the global value above — so `[]`, the default, is exactly the
|
|
20789
|
+
* behaviour of a blob stored before this field existed. Read through `resolveModeDelays`.
|
|
20790
|
+
*/
|
|
20791
|
+
modeDelays: NcAlarmModeDelaysListSchema.default([])
|
|
20845
20792
|
});
|
|
20846
20793
|
/**
|
|
20847
20794
|
* Every field optional — a tab edits one control at a time.
|
|
20848
20795
|
*
|
|
20849
|
-
* `nonBlocking`
|
|
20850
|
-
* remove an inner `.default()`, so a patch that never
|
|
20851
|
-
* parse to `
|
|
20852
|
-
* (the same trap {@link NcRulePatchSchema} documents).
|
|
20796
|
+
* `nonBlocking` and `modeDelays` are re-declared WITHOUT their defaults:
|
|
20797
|
+
* `.partial()` does not remove an inner `.default()`, so a patch that never
|
|
20798
|
+
* named the field would parse to `[]` and wipe every mode's list on an
|
|
20799
|
+
* unrelated edit (the same trap {@link NcRulePatchSchema} documents). Here
|
|
20800
|
+
* `modeDelays` means EDITS, not the stored overrides.
|
|
20853
20801
|
*/
|
|
20854
|
-
var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
|
|
20802
|
+
var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({
|
|
20803
|
+
nonBlocking: NcAlarmNonBlockingListSchema,
|
|
20804
|
+
/** Per-mode, per-field edits — NOT the whole list (see NcAlarmModeDelaysEditSchema). */
|
|
20805
|
+
modeDelays: NcAlarmModeDelaysEditListSchema,
|
|
20806
|
+
/** ONE membership change; the panel applies it to the list it holds at its turn. */
|
|
20807
|
+
nonBlockingEdit: NcAlarmNonBlockingEditSchema
|
|
20808
|
+
}).partial().refine((p) => p.nonBlocking === void 0 || p.nonBlockingEdit === void 0, { message: "nonBlocking and nonBlockingEdit are exclusive — send the whole lists or one edit" });
|
|
20855
20809
|
/**
|
|
20856
20810
|
* What one arm mode actually arms, DERIVED from the enabled rules gated on it.
|
|
20857
20811
|
* Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
|
|
@@ -20951,6 +20905,28 @@ var NcAlarmConfigSchema = object({
|
|
|
20951
20905
|
*/
|
|
20952
20906
|
live: NcAlarmLiveSchema.optional()
|
|
20953
20907
|
});
|
|
20908
|
+
var NcAlarmSensorReadingSchema = _enum([
|
|
20909
|
+
"open",
|
|
20910
|
+
"closed",
|
|
20911
|
+
"unknown",
|
|
20912
|
+
"not-opening"
|
|
20913
|
+
]);
|
|
20914
|
+
/** One device's state as the alarm reads it — the classifier the arm check uses. */
|
|
20915
|
+
var NcAlarmSensorStateSchema = object({
|
|
20916
|
+
deviceId: number().int().positive(),
|
|
20917
|
+
reading: NcAlarmSensorReadingSchema,
|
|
20918
|
+
/** The word as read (`open`, `closed`, `unlocked`, `stopped`, …); null when unknown / not an opening. */
|
|
20919
|
+
state: string().nullable(),
|
|
20920
|
+
/** Why `unknown`: the read failed, or the slice holds no word its cap defines (a placeholder included). */
|
|
20921
|
+
unknownWhy: _enum(["read-failed", "unknown-word"]).nullable(),
|
|
20922
|
+
/** The device manager's liveness as the centre mirrors it; null = not known. */
|
|
20923
|
+
online: boolean().nullable()
|
|
20924
|
+
});
|
|
20925
|
+
var NcAlarmSensorsInputSchema = object({ deviceIds: array(number().int().positive()).max(500) });
|
|
20926
|
+
var NcAlarmSensorsSchema = object({
|
|
20927
|
+
sensors: array(NcAlarmSensorStateSchema),
|
|
20928
|
+
readAt: number().int().nonnegative()
|
|
20929
|
+
});
|
|
20954
20930
|
/**
|
|
20955
20931
|
* ONE rule's demand on ONE camera's clip ring.
|
|
20956
20932
|
*
|
|
@@ -21041,7 +21017,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
|
|
|
21041
21017
|
}), method(object({}), NcAlarmConfigSchema, { auth: "admin" }), method(object({ patch: NcAlarmSettingsPatchSchema }), NcAlarmConfigSchema, {
|
|
21042
21018
|
kind: "mutation",
|
|
21043
21019
|
auth: "admin"
|
|
21044
|
-
});
|
|
21020
|
+
}), method(NcAlarmSensorsInputSchema, NcAlarmSensorsSchema, { auth: "admin" });
|
|
21045
21021
|
/**
|
|
21046
21022
|
* Zod schemas for persisted record types.
|
|
21047
21023
|
*
|
|
@@ -21404,12 +21380,26 @@ var CameraSensorRefSchema = object({
|
|
|
21404
21380
|
function cameraSensorRefKey(ref) {
|
|
21405
21381
|
return `${ref.addonId}/${ref.stableId}`;
|
|
21406
21382
|
}
|
|
21407
|
-
/**
|
|
21408
|
-
|
|
21409
|
-
|
|
21410
|
-
|
|
21411
|
-
|
|
21412
|
-
|
|
21383
|
+
/**
|
|
21384
|
+
* A sensor's mode (D673). `in-addition`: its motion is the camera's motion too.
|
|
21385
|
+
* `replace`: its motion is the camera's, and while one is READY the camera's
|
|
21386
|
+
* own motion no longer counts on its own. `confirm`: while one is READY the
|
|
21387
|
+
* camera's own motion counts only while a confirm sensor is active — with or
|
|
21388
|
+
* without a replace sensor (spec C2, the controller's ruling on Q1).
|
|
21389
|
+
*/
|
|
21390
|
+
var CameraSensorModeSchema = _enum([
|
|
21391
|
+
"in-addition",
|
|
21392
|
+
"confirm",
|
|
21393
|
+
"replace"
|
|
21394
|
+
]);
|
|
21395
|
+
/** A stored sensor with no mode — every CS-1 row — is in addition. */
|
|
21396
|
+
var DEFAULT_CAMERA_SENSOR_MODE = "in-addition";
|
|
21397
|
+
/**
|
|
21398
|
+
* A camera's attached sensors. A CS-1 row carried an envelope
|
|
21399
|
+
* `mode: 'in-addition'`: `z.object` drops it on parse, and the PARSED value is
|
|
21400
|
+
* what the write stores (D672 rule 3), so it is never written again.
|
|
21401
|
+
*/
|
|
21402
|
+
var CameraSensorsConfigSchema = object({ sensors: array(CameraSensorRefSchema.extend({ mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE) })).min(1).max(8) }).superRefine((value, ctx) => {
|
|
21413
21403
|
const seen = /* @__PURE__ */ new Set();
|
|
21414
21404
|
value.sensors.forEach((ref, index) => {
|
|
21415
21405
|
const key = cameraSensorRefKey(ref);
|
|
@@ -21421,39 +21411,41 @@ var CameraSensorsConfigSchema = object({
|
|
|
21421
21411
|
seen.add(key);
|
|
21422
21412
|
});
|
|
21423
21413
|
});
|
|
21424
|
-
|
|
21414
|
+
/** Every attachment names its mode; an older orchestrator that does not is in addition. */
|
|
21415
|
+
var AttachmentFields = {
|
|
21425
21416
|
addonId: string(),
|
|
21426
|
-
stableId: string()
|
|
21417
|
+
stableId: string(),
|
|
21418
|
+
mode: CameraSensorModeSchema.default(DEFAULT_CAMERA_SENSOR_MODE)
|
|
21427
21419
|
};
|
|
21428
21420
|
var CameraSensorAttachmentSchema = discriminatedUnion("state", [
|
|
21429
21421
|
object({
|
|
21430
|
-
...
|
|
21422
|
+
...AttachmentFields,
|
|
21431
21423
|
state: literal("ready"),
|
|
21432
21424
|
deviceId: number(),
|
|
21433
21425
|
name: string(),
|
|
21434
21426
|
caps: array(string()).readonly()
|
|
21435
21427
|
}),
|
|
21436
21428
|
object({
|
|
21437
|
-
...
|
|
21429
|
+
...AttachmentFields,
|
|
21438
21430
|
state: literal("offline"),
|
|
21439
21431
|
deviceId: number(),
|
|
21440
21432
|
name: string(),
|
|
21441
21433
|
reason: _enum(["offline", "disabled"])
|
|
21442
21434
|
}),
|
|
21443
21435
|
object({
|
|
21444
|
-
...
|
|
21436
|
+
...AttachmentFields,
|
|
21445
21437
|
state: literal("missing"),
|
|
21446
21438
|
reason: string()
|
|
21447
21439
|
}),
|
|
21448
21440
|
object({
|
|
21449
|
-
...
|
|
21441
|
+
...AttachmentFields,
|
|
21450
21442
|
state: literal("unsupported"),
|
|
21451
21443
|
deviceId: number(),
|
|
21452
21444
|
name: string(),
|
|
21453
21445
|
reason: string()
|
|
21454
21446
|
}),
|
|
21455
21447
|
object({
|
|
21456
|
-
...
|
|
21448
|
+
...AttachmentFields,
|
|
21457
21449
|
state: literal("unreadable"),
|
|
21458
21450
|
reason: string()
|
|
21459
21451
|
})
|
|
@@ -21466,17 +21458,49 @@ var CameraSensorAttachmentSchema = discriminatedUnion("state", [
|
|
|
21466
21458
|
* say.
|
|
21467
21459
|
*/
|
|
21468
21460
|
var CameraSensorsNotForwardedSchema = _enum(["onboard-not-listed", "no-active-detection"]);
|
|
21461
|
+
/** Whether the camera's OWN motion counts on its own (D673 C2), from its READY sensors (C3). */
|
|
21462
|
+
var CameraOwnMotionSchema = _enum([
|
|
21463
|
+
"always",
|
|
21464
|
+
"when-confirmed",
|
|
21465
|
+
"never"
|
|
21466
|
+
]);
|
|
21467
|
+
/** Confirm / Replace cannot suppress this camera's motion: its provider still emits it directly (D673 C13). */
|
|
21468
|
+
var CameraSensorsNotEnforcedSchema = _enum(["provider-not-split"]);
|
|
21469
|
+
/**
|
|
21470
|
+
* The camera's OWN onboard motion (D696): the raw input the bridge combines,
|
|
21471
|
+
* never the effective value. The camera's `motion` slice is the effective one,
|
|
21472
|
+
* so a view of the camera's own row reads this.
|
|
21473
|
+
* - `atMs`: when the bridge received the camera's last own edge.
|
|
21474
|
+
* - `detected`: evaluated WHEN THE STATUS IS ASKED — the last edge said `true`
|
|
21475
|
+
* AND it is younger than the window the bridge counts the camera's own motion
|
|
21476
|
+
* for (`motionCooldownMs`, floored at two sustain ticks). A camera that never
|
|
21477
|
+
* sends a clear (heartbeats only) therefore reads `false` once no push came
|
|
21478
|
+
* within the window; a status read is a snapshot, so a live view re-asks.
|
|
21479
|
+
* Absent = this orchestrator has not received the camera's own motion since it
|
|
21480
|
+
* started (unknown, never "quiet"), or an orchestrator older than D696.
|
|
21481
|
+
*/
|
|
21482
|
+
var CameraRawLevelSchema = object({
|
|
21483
|
+
detected: boolean(),
|
|
21484
|
+
atMs: number()
|
|
21485
|
+
});
|
|
21469
21486
|
var CameraSensorsStatusSchema = discriminatedUnion("state", [
|
|
21470
|
-
object({
|
|
21487
|
+
object({
|
|
21488
|
+
state: literal("not-configured"),
|
|
21489
|
+
cameraLevel: CameraRawLevelSchema.optional()
|
|
21490
|
+
}),
|
|
21471
21491
|
object({
|
|
21472
21492
|
state: literal("unreadable"),
|
|
21473
|
-
reason: string()
|
|
21493
|
+
reason: string(),
|
|
21494
|
+
cameraLevel: CameraRawLevelSchema.optional()
|
|
21474
21495
|
}),
|
|
21475
21496
|
object({
|
|
21476
21497
|
state: literal("configured"),
|
|
21477
|
-
|
|
21498
|
+
cameraLevel: CameraRawLevelSchema.optional(),
|
|
21478
21499
|
sensors: array(CameraSensorAttachmentSchema).readonly(),
|
|
21479
|
-
|
|
21500
|
+
/** Absent = an orchestrator older than CS-2: it does not say (D315). */
|
|
21501
|
+
cameraMotion: CameraOwnMotionSchema.optional(),
|
|
21502
|
+
notForwarded: CameraSensorsNotForwardedSchema.optional(),
|
|
21503
|
+
notEnforced: CameraSensorsNotEnforcedSchema.optional()
|
|
21480
21504
|
})
|
|
21481
21505
|
]);
|
|
21482
21506
|
Object.freeze({
|
|
@@ -22161,14 +22185,14 @@ var TrackSchema = object({
|
|
|
22161
22185
|
* `derive-returned-null tile=standin`,
|
|
22162
22186
|
* `native-tile tile=native no-key-frame-at-close`, …) written at close and
|
|
22163
22187
|
* CLEARED by the late-keyFrame upgrade when a native tile lands after all.
|
|
22164
|
-
* The operator-facing answer to "perché manca l'immagine?" on a track whose
|
|
22188
|
+
* The operator-facing answer to "perché manca l'immagine?" [why is the image missing?] on a track whose
|
|
22165
22189
|
* tile is a face/plate stand-in, a raster crop, or an icon.
|
|
22166
22190
|
*
|
|
22167
22191
|
* **`no-key-frame-at-close` (D400).** The line used to be written ONLY when
|
|
22168
22192
|
* the TILE ranked below native, so a track whose thumbnail landed natively
|
|
22169
22193
|
* while its key frame missed carried no reason at all — three of the four
|
|
22170
22194
|
* `MISSING_KEYFRAME` tracks in the 2026-09-07 operator audit were exactly
|
|
22171
|
-
* that shape, and their "niente ultimo" had no cause anywhere on the row.
|
|
22195
|
+
* that shape, and their "niente ultimo" [no last frame] had no cause anywhere on the row.
|
|
22172
22196
|
* The key frame is the head of a cascade (`keyFrame ⇒ keyFrameSmall ⇒ the
|
|
22173
22197
|
* lastFrame copy source`), so its absence is now on this line whatever the
|
|
22174
22198
|
* tile ended up being.
|
|
@@ -22255,7 +22279,7 @@ var MotionEventSchema = object({
|
|
|
22255
22279
|
/**
|
|
22256
22280
|
* Ms offsets from `timestamp` (the episode's own first rising edge, so the
|
|
22257
22281
|
* first entry is always `0`) of every genuine off→on transition the
|
|
22258
|
-
* episode saw — "ogni evento on si deve salvare" (D475). NOT one entry per
|
|
22282
|
+
* episode saw — "ogni evento on si deve salvare" [every ON event must be saved] (D475). NOT one entry per
|
|
22259
22283
|
* push: a firmware source that keepalives at ~1 Hz for the whole burst
|
|
22260
22284
|
* (Reolink, Hikvision) produces exactly one edge; a source that reports an
|
|
22261
22285
|
* explicit `false` mid-episode and then resumes before the quiet window
|
|
@@ -24707,8 +24731,10 @@ var RunnerCameraConfigSchema = object({
|
|
|
24707
24731
|
* - `analyzer`: ML/frame-diff motion detection (motion-wasm or other
|
|
24708
24732
|
* analyzer providers) running on decoded frames in this runner.
|
|
24709
24733
|
* - `onboard`: camera-native motion pushes (Reolink Baichuan, ONVIF
|
|
24710
|
-
* analytics). The provider emits ProviderMotion
|
|
24711
|
-
*
|
|
24734
|
+
* analytics). The provider emits its raw push as `ProviderMotion`
|
|
24735
|
+
* (D673); the orchestrator's camera-sensors bridge re-emits the camera's
|
|
24736
|
+
* effective motion as `MotionOnMotionChanged`, which is what reaches
|
|
24737
|
+
* `reportMotion`.
|
|
24712
24738
|
*/
|
|
24713
24739
|
motionSources: MotionSourcesSchema.default(["analyzer"]),
|
|
24714
24740
|
/**
|
|
@@ -24885,7 +24911,15 @@ var RunnerLocalLoadSchema = object({
|
|
|
24885
24911
|
hasGpu: boolean(),
|
|
24886
24912
|
inferenceBackend: string().optional(),
|
|
24887
24913
|
cpuCores: number().optional()
|
|
24888
|
-
})
|
|
24914
|
+
}),
|
|
24915
|
+
/**
|
|
24916
|
+
* Who writes a camera's `motion` runtime slice (D696). `'orchestrator'`: this
|
|
24917
|
+
* runner never writes it. ABSENT = a runner older than D696, which still
|
|
24918
|
+
* writes the slice from its phase machine; the orchestrator does not write
|
|
24919
|
+
* while any runner node is absent-or-unanswered, so one slice never has two
|
|
24920
|
+
* writers.
|
|
24921
|
+
*/
|
|
24922
|
+
motionSliceWriter: literal("orchestrator").optional()
|
|
24889
24923
|
});
|
|
24890
24924
|
/**
|
|
24891
24925
|
* Aggregate runtime metrics for the runner's whole local pool. Mirrors the
|
|
@@ -27550,7 +27584,7 @@ var ClipPlaybackSchema = object({
|
|
|
27550
27584
|
* **One authorised yes is one wake.** `next-natural` — take the clip the next
|
|
27551
27585
|
* time the camera is awake for its own reasons — is deliberately not a member:
|
|
27552
27586
|
* it was proposed, it is free on the battery, and the operator declined it on
|
|
27553
|
-
* 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."
|
|
27587
|
+
* 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."* [When an export is requested the camera wakes up],
|
|
27554
27588
|
* D558 "Considered and not taken").
|
|
27555
27589
|
*/
|
|
27556
27590
|
var ClipWakeSchema = _enum(["authorised"]);
|
|
@@ -27811,7 +27845,7 @@ DeviceType.Camera, method(object({
|
|
|
27811
27845
|
* It replaced `sources?: string[]`, a VIEW filter over source ids that
|
|
27812
27846
|
* assumed the answer was a fan-out over everything a camera has. The
|
|
27813
27847
|
* operator settled otherwise on 2026-09-20 — *"l'utilizzatore è uno
|
|
27814
|
-
* solo"* — so the list is asked of one provider at a time and there is
|
|
27848
|
+
* solo"* [there is only one user] — so the list is asked of one provider at a time and there is
|
|
27815
27849
|
* nothing to filter out of it.
|
|
27816
27850
|
*/
|
|
27817
27851
|
provider: string().min(1)
|
|
@@ -30495,6 +30529,70 @@ onStatusChanged: { data: object({
|
|
|
30495
30529
|
* whether persisting is worth a SQLite commit. */
|
|
30496
30530
|
volatileStateFields: ["lastChangedAt"]
|
|
30497
30531
|
};
|
|
30532
|
+
var DoorbellStatusSchema = object({
|
|
30533
|
+
/** Ms epoch of the last press. null = never observed since this provider started. */
|
|
30534
|
+
lastPressedAt: number().nullable(),
|
|
30535
|
+
/** Counter since provider start. Resets on reboot. Useful for metrics/debug. */
|
|
30536
|
+
pressCountSinceStart: number()
|
|
30537
|
+
});
|
|
30538
|
+
var DoorbellPressEventSchema = object({
|
|
30539
|
+
deviceId: number(),
|
|
30540
|
+
timestamp: number()
|
|
30541
|
+
});
|
|
30542
|
+
/**
|
|
30543
|
+
* Doorbell button cap. Two kinds of provider serve it, and to every consumer
|
|
30544
|
+
* they are the same cap:
|
|
30545
|
+
*
|
|
30546
|
+
* - **Native** providers, registered per device by a driver addon through
|
|
30547
|
+
* `ctx.registerNativeCap` — a `DeviceType.Button` accessory with
|
|
30548
|
+
* `role: DeviceRole.Doorbell`, or the camera itself (Reolink registers at
|
|
30549
|
+
* camera level). They emit `onPressed` on every firmware ring.
|
|
30550
|
+
* - **A composed doorbell** (D670, D671): a camera's customization gives it
|
|
30551
|
+
* the cap, its `lastPressedAt` rising from the sources the operator
|
|
30552
|
+
* assigned in Customize → Doorbell, and the composer emits `onPressed`
|
|
30553
|
+
* from that field's advance (`fromState`).
|
|
30554
|
+
*
|
|
30555
|
+
* The DeviceEventPropagator re-emits `onPressed` on the camera parent.
|
|
30556
|
+
*/
|
|
30557
|
+
var doorbellCapability = {
|
|
30558
|
+
name: "doorbell",
|
|
30559
|
+
scope: "device",
|
|
30560
|
+
deviceNative: true,
|
|
30561
|
+
mode: "singleton",
|
|
30562
|
+
deviceTypes: [DeviceType.Button, DeviceType.Camera],
|
|
30563
|
+
methods: {},
|
|
30564
|
+
events: {
|
|
30565
|
+
/**
|
|
30566
|
+
* Fires once per physical press. Reolink delivers via Baichuan
|
|
30567
|
+
* push (`ReolinkSimpleEvent.type === 'doorbell'`). There is no
|
|
30568
|
+
* release/duration — it's a pulse.
|
|
30569
|
+
*/
|
|
30570
|
+
onPressed: {
|
|
30571
|
+
data: DoorbellPressEventSchema,
|
|
30572
|
+
fromState: {
|
|
30573
|
+
field: "lastPressedAt",
|
|
30574
|
+
on: "advance"
|
|
30575
|
+
}
|
|
30576
|
+
} },
|
|
30577
|
+
status: {
|
|
30578
|
+
schema: DoorbellStatusSchema,
|
|
30579
|
+
kind: "push"
|
|
30580
|
+
},
|
|
30581
|
+
/**
|
|
30582
|
+
* Runtime-state slice — last press timestamp + lifetime press count.
|
|
30583
|
+
* Mirrored by the kernel and readable via
|
|
30584
|
+
* `device.state.doorbell.value`. UIs can show "last ring 5m ago"
|
|
30585
|
+
* without subscribing.
|
|
30586
|
+
*/
|
|
30587
|
+
runtimeState: DoorbellStatusSchema,
|
|
30588
|
+
/**
|
|
30589
|
+
* Runtime-state durability: **restored** — a monotonic accumulator: the slice IS the record. `lastPressedAt` is content here, not a clock, so it is deliberately NOT volatile.
|
|
30590
|
+
*
|
|
30591
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
30592
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
30593
|
+
*/
|
|
30594
|
+
durability: "restored"
|
|
30595
|
+
};
|
|
30498
30596
|
/**
|
|
30499
30597
|
* Enum-state sensor — a string value picked from a finite option set.
|
|
30500
30598
|
* Drives HA `sensor` entries with `state_class: enum` (HVAC action
|
|
@@ -32639,9 +32737,9 @@ var MotionStatusSchema = object({
|
|
|
32639
32737
|
/** Ms epoch of the last detected-true observation. Null if never detected. */
|
|
32640
32738
|
lastDetectedAt: number().nullable(),
|
|
32641
32739
|
/**
|
|
32642
|
-
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device
|
|
32643
|
-
* `null` while false and on every `Sensor`
|
|
32644
|
-
* constant's doc for the one-authority rule.
|
|
32740
|
+
* `MOTION_CLOSE_AFTER_MS` while `detected: true` on a `Camera` device (the
|
|
32741
|
+
* orchestrator writes it, D696), `null` while false and on every `Sensor`
|
|
32742
|
+
* device (D475) — see that constant's doc for the one-authority rule.
|
|
32645
32743
|
*
|
|
32646
32744
|
* ## Reading this field still arms nothing
|
|
32647
32745
|
*
|
|
@@ -32659,34 +32757,31 @@ var MotionStatusSchema = object({
|
|
|
32659
32757
|
* `addon-export-alexa/src/motion-clear-hold.ts` and
|
|
32660
32758
|
* `addon-export-hap`'s `RESET_DEBOUNCE_MS` both do.
|
|
32661
32759
|
*
|
|
32662
|
-
* ## Who writes it
|
|
32663
|
-
*
|
|
32664
|
-
* - **Cameras** — the
|
|
32665
|
-
*
|
|
32666
|
-
* `
|
|
32667
|
-
* `
|
|
32668
|
-
*
|
|
32669
|
-
*
|
|
32670
|
-
* a
|
|
32671
|
-
*
|
|
32672
|
-
*
|
|
32673
|
-
*
|
|
32674
|
-
*
|
|
32675
|
-
*
|
|
32676
|
-
*
|
|
32677
|
-
*
|
|
32678
|
-
*
|
|
32679
|
-
*
|
|
32680
|
-
* `
|
|
32681
|
-
*
|
|
32682
|
-
*
|
|
32683
|
-
*
|
|
32684
|
-
*
|
|
32685
|
-
*
|
|
32686
|
-
*
|
|
32687
|
-
* This predates D475 and is not fixed there: the fix touches every
|
|
32688
|
-
* camera provider. Recorded in D475's Consequences. Do not restore the
|
|
32689
|
-
* "sole writer" wording without also removing the other writers.
|
|
32760
|
+
* ## Who writes it (D696)
|
|
32761
|
+
*
|
|
32762
|
+
* - **Cameras** — the orchestrator, and nothing else. It writes the camera's
|
|
32763
|
+
* EFFECTIVE motion (`addon-pipeline-orchestrator`
|
|
32764
|
+
* `camera-sensors/motion-slice.ts`), alongside the effective
|
|
32765
|
+
* `MotionOnMotionChanged` it emits or receives: the camera-sensors bridge
|
|
32766
|
+
* for a split camera, an unsplit emitter's direct event, the analyzer and
|
|
32767
|
+
* device activity, as the camera's `motionSources` counts them. A source
|
|
32768
|
+
* that never sends a clear falls one window after its last `true`.
|
|
32769
|
+
* `lastDetectedAt` moves only on an effective rise. No camera provider
|
|
32770
|
+
* writes this slice (not even a boot seed), and neither does the runner's
|
|
32771
|
+
* phase machine: its phase is "a session is attached" for every on-motion
|
|
32772
|
+
* session, not motion, and it now has its own `DetectionPhaseTransition`.
|
|
32773
|
+
* A provider's `isDetected` answers from the hub's slice.
|
|
32774
|
+
* - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
|
|
32775
|
+
* imports) — the provider pushes both edges itself, from the upstream
|
|
32776
|
+
* system's own state change. That is the sensor's own fact.
|
|
32777
|
+
*
|
|
32778
|
+
* `scripts/check-onboard-motion-emitters.ts` refuses any other writer of a
|
|
32779
|
+
* `motion` slice; each sensor writer is a named exemption.
|
|
32780
|
+
*
|
|
32781
|
+
* This replaces the D475 §4 rule ("the phase machine is the sole writer").
|
|
32782
|
+
* That rule was never true: Hikvision and Amcrest wrote the slice raw beside
|
|
32783
|
+
* it, every provider seeded it at boot, and every session left it
|
|
32784
|
+
* `detected: true` after its detach.
|
|
32690
32785
|
*/
|
|
32691
32786
|
autoClearAfterMs: number().nullable()
|
|
32692
32787
|
});
|
|
@@ -32758,11 +32853,12 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
|
|
|
32758
32853
|
*/
|
|
32759
32854
|
runtimeState: MotionStatusSchema,
|
|
32760
32855
|
/**
|
|
32761
|
-
* Runtime-state durability: **session** —
|
|
32856
|
+
* Runtime-state durability: **session** — the writer of this slice
|
|
32762
32857
|
* writes only on an EDGE, so a restored `detected: true` would stay
|
|
32763
32858
|
* frozen until the next one instead of being corrected. The next edge
|
|
32764
|
-
* re-publishes the real state
|
|
32765
|
-
*
|
|
32859
|
+
* re-publishes the real state, and the orchestrator re-publishes every
|
|
32860
|
+
* camera when it starts writing (D696; on who writes it, see
|
|
32861
|
+
* `autoClearAfterMs` above).
|
|
32766
32862
|
*
|
|
32767
32863
|
* See `RuntimeStateDurability`. Enforced by
|
|
32768
32864
|
* `scripts/check-runtime-state-durability.ts`.
|
|
@@ -35145,8 +35241,7 @@ var ptzAutotrackCapability = {
|
|
|
35145
35241
|
deviceNative: true,
|
|
35146
35242
|
mode: "singleton",
|
|
35147
35243
|
/**
|
|
35148
|
-
* Two kinds of provider behind one name, the same shape `snapshot`
|
|
35149
|
-
* `doorbell` use:
|
|
35244
|
+
* Two kinds of provider behind one name, the same shape `snapshot` uses:
|
|
35150
35245
|
*
|
|
35151
35246
|
* - **Native**: the camera's own firmware autotrack, registered per device by
|
|
35152
35247
|
* the driver when the probe says it exists (Reolink: yes; Hikvision:
|
|
@@ -35154,7 +35249,7 @@ var ptzAutotrackCapability = {
|
|
|
35154
35249
|
* - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
|
|
35155
35250
|
* which follows a subject with `ptz.move` pulses driven by the detection
|
|
35156
35251
|
* pipeline. `defaultActive: false` — the operator binds it per camera in
|
|
35157
|
-
* the bindings UI
|
|
35252
|
+
* the bindings UI.
|
|
35158
35253
|
*
|
|
35159
35254
|
* The binding chooses WHICH implementation answers; `setEnabled` stays the
|
|
35160
35255
|
* one switch for the function either way. A camera never has both driving its
|
|
@@ -35829,7 +35924,7 @@ var ReadGopBytesResultSchema = object({
|
|
|
35829
35924
|
/**
|
|
35830
35925
|
* A time WINDOW of one finalized segment, cut by byte range — the multi-GOP
|
|
35831
35926
|
* twin of {@link ReadGopBytesResultSchema}'s single instant. Built for the
|
|
35832
|
-
* replay clip's `recording` source (`docs/design/plans/2026-08-26-replay-
|
|
35927
|
+
* replay clip's `recording` source (`docs/design/plans/2026-08-26-clip-replay-on-pipeline.md`):
|
|
35833
35928
|
* a replay needs several seconds of native pixels, not one frame.
|
|
35834
35929
|
*
|
|
35835
35930
|
* `ok.data` is standalone-demuxable, same as a GOP read. `ok.reachesRequestedEnd`
|
|
@@ -40252,13 +40347,14 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
40252
40347
|
async getStatus() {
|
|
40253
40348
|
const all = await this.ctx.kernel.devices?.getAll() ?? [];
|
|
40254
40349
|
const summary = this.restoreFailureSummary();
|
|
40255
|
-
|
|
40350
|
+
const base = {
|
|
40256
40351
|
connected: true,
|
|
40257
|
-
deviceCount: all.length
|
|
40352
|
+
deviceCount: all.length,
|
|
40353
|
+
motionSliceWriter: "orchestrator"
|
|
40258
40354
|
};
|
|
40355
|
+
if (summary === null) return base;
|
|
40259
40356
|
return {
|
|
40260
|
-
|
|
40261
|
-
deviceCount: all.length,
|
|
40357
|
+
...base,
|
|
40262
40358
|
error: summary
|
|
40263
40359
|
};
|
|
40264
40360
|
}
|
|
@@ -45694,6 +45790,12 @@ Object.freeze({
|
|
|
45694
45790
|
addonId: null,
|
|
45695
45791
|
access: "view"
|
|
45696
45792
|
},
|
|
45793
|
+
"notificationRules.getAlarmSensors": {
|
|
45794
|
+
capName: "notification-rules",
|
|
45795
|
+
capScope: "system",
|
|
45796
|
+
addonId: null,
|
|
45797
|
+
access: "view"
|
|
45798
|
+
},
|
|
45697
45799
|
"notificationRules.getClipRetentionAsks": {
|
|
45698
45800
|
capName: "notification-rules",
|
|
45699
45801
|
capScope: "system",
|
|
@@ -50177,6 +50279,11 @@ Object.freeze({
|
|
|
50177
50279
|
form: "single",
|
|
50178
50280
|
optional: false
|
|
50179
50281
|
}],
|
|
50282
|
+
"notificationRules.getAlarmSensors": [{
|
|
50283
|
+
name: "deviceIds",
|
|
50284
|
+
form: "array",
|
|
50285
|
+
optional: false
|
|
50286
|
+
}],
|
|
50180
50287
|
"notificationRules.setDeviceMuted": [{
|
|
50181
50288
|
name: "deviceId",
|
|
50182
50289
|
form: "single",
|
|
@@ -52181,7 +52288,7 @@ var PreviewTextField = string().max(200);
|
|
|
52181
52288
|
* Whether the notification's preview is a STILL or a short animation.
|
|
52182
52289
|
*
|
|
52183
52290
|
* The operator's ask, verbatim: *"inviato come gif o video (come per le altre
|
|
52184
|
-
* rule)"* — the other rules already offer an animated preview, and a ten-hour
|
|
52291
|
+
* rule)"* [sent as a gif or video (as for the other rules)] — the other rules already offer an animated preview, and a ten-hour
|
|
52185
52292
|
* night reads better as three seconds of motion than as one frame of it. Both
|
|
52186
52293
|
* modes get the SAME treatment (blurred frame, large centred title); `'gif'`
|
|
52187
52294
|
* simply applies it to a dozen frames sampled across the render and assembles
|
|
@@ -52319,6 +52426,7 @@ TimelapseRuleInputSchema.extend({
|
|
|
52319
52426
|
createdAt: number(),
|
|
52320
52427
|
updatedAt: number()
|
|
52321
52428
|
});
|
|
52429
|
+
MotionOnMotionChangedDataSchema.omit({ triggeredBy: true });
|
|
52322
52430
|
object({
|
|
52323
52431
|
/**
|
|
52324
52432
|
* Fraction of the box's own size added on EACH side before cutting.
|