@camstack/addon-mqtt-broker 1.2.13 → 1.2.14
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/mqtt-broker.addon.js +625 -22
- package/dist/mqtt-broker.addon.mjs +625 -22
- package/package.json +1 -1
|
@@ -7234,8 +7234,31 @@ var AdoptionJobSchema = object({
|
|
|
7234
7234
|
error: string().nullable()
|
|
7235
7235
|
});
|
|
7236
7236
|
/**
|
|
7237
|
-
* Per-camera FUNCTION SWITCHES
|
|
7238
|
-
*
|
|
7237
|
+
* Per-camera FUNCTION SWITCHES.
|
|
7238
|
+
*
|
|
7239
|
+
* ## The aggregate group is being withdrawn — the BADGE is not (D113)
|
|
7240
|
+
*
|
|
7241
|
+
* This file shipped as "the one coherent on/off surface over the pipeline
|
|
7242
|
+
* functions an operator thinks in terms of". The operator's verdict on
|
|
7243
|
+
* 2026-08-12 was that the coherent surface bought complexity and no clarity:
|
|
7244
|
+
* every function already had a settings page of its own, and a second place to
|
|
7245
|
+
* turn it off is a second place to look. Each switch is going back to its own
|
|
7246
|
+
* component's original options — detection to the detection-pipeline wrapper
|
|
7247
|
+
* binding, audio analysis to its own, recording to `RecordingConfig.enabled`
|
|
7248
|
+
* (which was always first-class; the switch was a veneer over
|
|
7249
|
+
* `recording.setDeviceConfig`), notifications to a notification-center
|
|
7250
|
+
* per-device setting, the two camera planes to their own components.
|
|
7251
|
+
*
|
|
7252
|
+
* What survives is {@link composeSwitchedOff}: `CameraStatus.switchedOff`, the
|
|
7253
|
+
* thing that lets a status surface say DISABLED instead of BROKEN, recomposed
|
|
7254
|
+
* straight from the authorities with no group in the middle. That rule was
|
|
7255
|
+
* never about a control panel.
|
|
7256
|
+
*
|
|
7257
|
+
* Everything else here — {@link CAMERA_SWITCH_CATALOG}, {@link CameraSwitch},
|
|
7258
|
+
* {@link deriveCameraSwitches}, the `pipelineOrchestrator.getCameraSwitches` /
|
|
7259
|
+
* `setCameraSwitch` pair — is a COMPATIBILITY surface for as long as deployed
|
|
7260
|
+
* viewers (v1.0.305) and the admin UI still call it. It is deleted when they
|
|
7261
|
+
* stop; nothing new may be built on it.
|
|
7239
7262
|
*
|
|
7240
7263
|
* ## This file adds no state
|
|
7241
7264
|
*
|
|
@@ -7586,7 +7609,15 @@ var RecordingConfigSchema = object({
|
|
|
7586
7609
|
* Each completed/failed run also lands one durable ops-log row on its owning
|
|
7587
7610
|
* addon surface.
|
|
7588
7611
|
*/
|
|
7612
|
+
/**
|
|
7613
|
+
* `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
|
|
7614
|
+
* rebalance enqueues one job per (camera, profile). Refusing the second job —
|
|
7615
|
+
* what the engine did before — turned a fifteen-camera rebalance into fifteen
|
|
7616
|
+
* manual retries. Queued jobs run FIFO; a queued job that is cancelled never
|
|
7617
|
+
* runs at all.
|
|
7618
|
+
*/
|
|
7589
7619
|
var RelocateJobStateSchema = _enum([
|
|
7620
|
+
"queued",
|
|
7590
7621
|
"running",
|
|
7591
7622
|
"done",
|
|
7592
7623
|
"failed",
|
|
@@ -7621,6 +7652,15 @@ var RelocateFootageInputSchema = object({
|
|
|
7621
7652
|
/** Limits relocation to the logical profile class. Omit only for the
|
|
7622
7653
|
* pre-orchestration compatibility path. */
|
|
7623
7654
|
footageClass: RelocateFootageClassSchema.optional(),
|
|
7655
|
+
/** Scope the move to ONE camera. Absent = every camera on the source, which
|
|
7656
|
+
* is what a whole-disk drain means. The rebalance path always sets it: its
|
|
7657
|
+
* unit is a (camera, profile) pile, not a disk. */
|
|
7658
|
+
deviceId: number().int().optional(),
|
|
7659
|
+
/** Scope the move to specific segment profiles (`high` / `mid` / `low`).
|
|
7660
|
+
* Finer than `footageClass`, which cannot separate high from mid — and the
|
|
7661
|
+
* placement plan assigns those two independently, so a rebalance that could
|
|
7662
|
+
* only say "recordings" would move footage the plan never asked to move. */
|
|
7663
|
+
profiles: array(string()).optional(),
|
|
7624
7664
|
/** Copy throttle in MB/s (default 40) — the drain is a background chore,
|
|
7625
7665
|
* never allowed to starve live writers. */
|
|
7626
7666
|
throttleMbps: number().min(1).max(1e3).optional()
|
|
@@ -7756,6 +7796,21 @@ var StorageLocationSchema = object({
|
|
|
7756
7796
|
nodeId: string().optional(),
|
|
7757
7797
|
isDefault: boolean().default(false),
|
|
7758
7798
|
isSystem: boolean().default(false),
|
|
7799
|
+
/**
|
|
7800
|
+
* Operator opt-in: whether consumers that BALANCE across several locations
|
|
7801
|
+
* of a type may write here. Recordings reads it today; event media and
|
|
7802
|
+
* backups are the next consumers, which is why the flag lives on the
|
|
7803
|
+
* location rather than in any one addon's store — nothing has to be
|
|
7804
|
+
* extended to add the next consumer.
|
|
7805
|
+
*
|
|
7806
|
+
* OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
|
|
7807
|
+
* flag existed reads back with no flag and keeps working exactly as before;
|
|
7808
|
+
* that is the whole compat story, and it is why no migration ships with it.
|
|
7809
|
+
* A newly CREATED sibling is stamped `false` by the orchestrator (creating a
|
|
7810
|
+
* disk must not silently start writing to it); the default of a type is
|
|
7811
|
+
* always stamped `true`.
|
|
7812
|
+
*/
|
|
7813
|
+
enabled: boolean().optional(),
|
|
7759
7814
|
/** COMPUTED at read time by the orchestrator (statfs of the backing volume
|
|
7760
7815
|
* for node-local locations it can reach) — never persisted, absent when the
|
|
7761
7816
|
* volume is remote/unreachable. The single capacity truth every UI reads. */
|
|
@@ -12107,7 +12162,8 @@ method(object({
|
|
|
12107
12162
|
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
12108
12163
|
/**
|
|
12109
12164
|
* filesystem-browse — per-node capability for browsing the node's local
|
|
12110
|
-
* filesystem
|
|
12165
|
+
* filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
|
|
12166
|
+
* are sandboxed to operator-configured allowed roots (D115). Used by the
|
|
12111
12167
|
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
12112
12168
|
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
12113
12169
|
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
@@ -13939,6 +13995,13 @@ var MaskGridDimsSchema = object({
|
|
|
13939
13995
|
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
13940
13996
|
* this one field keeps the schema additive — a rule still declares exactly
|
|
13941
13997
|
* one trigger.
|
|
13998
|
+
*
|
|
13999
|
+
* AUDIO rules add no member here, for the reason occupancy added none: the
|
|
14000
|
+
* enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
|
|
14001
|
+
* mirror.ts` fails the build on a member the app cannot render) and every
|
|
14002
|
+
* member costs a release train. A sustained-sound rule is therefore an
|
|
14003
|
+
* `immediate` rule carrying {@link NcConditions.audio} — the condition is the
|
|
14004
|
+
* trigger discriminator, exactly as `occupancy` is on `device-event`.
|
|
13942
14005
|
*/
|
|
13943
14006
|
var NcDeliverySchema = _enum([
|
|
13944
14007
|
"immediate",
|
|
@@ -13953,15 +14016,32 @@ var NcDeliverySchema = _enum([
|
|
|
13953
14016
|
* depend on a provider's raw event name or payload shape.
|
|
13954
14017
|
*/
|
|
13955
14018
|
var NcSystemEventKindSchema = _enum([
|
|
13956
|
-
"
|
|
13957
|
-
"
|
|
14019
|
+
"device-online",
|
|
14020
|
+
"device-offline",
|
|
14021
|
+
"device-disabled",
|
|
14022
|
+
"device-enabled",
|
|
13958
14023
|
"stream-online",
|
|
13959
14024
|
"stream-offline",
|
|
13960
14025
|
"node-online",
|
|
13961
14026
|
"node-offline",
|
|
13962
14027
|
"addon-update-available",
|
|
13963
|
-
"server-update-available"
|
|
14028
|
+
"server-update-available",
|
|
14029
|
+
"alarm-triggered",
|
|
14030
|
+
"alarm-armed",
|
|
14031
|
+
"alarm-disarmed",
|
|
14032
|
+
"camera-online",
|
|
14033
|
+
"camera-offline",
|
|
14034
|
+
"camera-disabled",
|
|
14035
|
+
"camera-enabled"
|
|
14036
|
+
]);
|
|
14037
|
+
/** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
|
|
14038
|
+
var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
|
|
14039
|
+
"camera-online",
|
|
14040
|
+
"camera-offline",
|
|
14041
|
+
"camera-disabled",
|
|
14042
|
+
"camera-enabled"
|
|
13964
14043
|
]);
|
|
14044
|
+
NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
|
|
13965
14045
|
/**
|
|
13966
14046
|
* One coherent system-event condition. `kinds` is the required opt-in safety
|
|
13967
14047
|
* gate; the remaining lists are optional narrowing filters relevant to the
|
|
@@ -13970,6 +14050,18 @@ var NcSystemEventKindSchema = _enum([
|
|
|
13970
14050
|
var NcSystemEventConditionSchema = object({
|
|
13971
14051
|
kinds: array(NcSystemEventKindSchema).min(1),
|
|
13972
14052
|
deviceIds: array(number().int()).min(1).optional(),
|
|
14053
|
+
/**
|
|
14054
|
+
* Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
|
|
14055
|
+
* `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
|
|
14056
|
+
* is what a liveness rule means when nobody said otherwise.
|
|
14057
|
+
*
|
|
14058
|
+
* This is where "only my cameras" is expressed, and it lives on the rule for
|
|
14059
|
+
* one reason: the intake cannot know which devices this household cares
|
|
14060
|
+
* about, and a producer-side filter is one no operator can change. Fails
|
|
14061
|
+
* CLOSED — a subject whose device type is unknown (an id the device mirror
|
|
14062
|
+
* does not carry) matches no `deviceTypes` list.
|
|
14063
|
+
*/
|
|
14064
|
+
deviceTypes: array(string().min(1)).min(1).optional(),
|
|
13973
14065
|
nodeIds: array(string().min(1)).min(1).optional(),
|
|
13974
14066
|
packageNames: array(string().min(1)).min(1).optional()
|
|
13975
14067
|
});
|
|
@@ -14020,6 +14112,47 @@ var NcOccupancyConditionSchema = object({
|
|
|
14020
14112
|
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
14021
14113
|
});
|
|
14022
14114
|
/**
|
|
14115
|
+
* Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
|
|
14116
|
+
*
|
|
14117
|
+
* Operator-approved vocabulary (2026-08-12, option A — the same one the
|
|
14118
|
+
* reference notifier uses, so an operator moving between them re-uses what
|
|
14119
|
+
* they already know): a rule matches when, over a sampling window of
|
|
14120
|
+
* `samplingSeconds`, at least `hitPercent`% of the audio samples in that
|
|
14121
|
+
* window are HITS. A sample is a hit when it satisfies BOTH present filters:
|
|
14122
|
+
*
|
|
14123
|
+
* - `dbThreshold` — its level is at or above this many dBFS (see
|
|
14124
|
+
* {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
|
|
14125
|
+
* - `labels` — the classifier put at least one of these labels on it.
|
|
14126
|
+
*
|
|
14127
|
+
* Both are OPTIONAL and independent, which is the point of the shape: a
|
|
14128
|
+
* loudness rule ("something loud at 3am") needs no model to be right, and a
|
|
14129
|
+
* label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
|
|
14130
|
+
* is given** — a window in which every sample is trivially a hit would fire on
|
|
14131
|
+
* silence, so the engine refuses such a condition rather than notifying on
|
|
14132
|
+
* nothing (the schema cannot express "at least one of" without becoming a
|
|
14133
|
+
* ZodEffects the cap path would have to special-case).
|
|
14134
|
+
*
|
|
14135
|
+
* `hitPercent` is over the samples the window actually HOLDS, and the window
|
|
14136
|
+
* must be FULL before it can match — a window that has been open for two
|
|
14137
|
+
* seconds of its ten is 100% of nothing, and firing on it would make
|
|
14138
|
+
* `samplingSeconds` decorative.
|
|
14139
|
+
*
|
|
14140
|
+
* Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
|
|
14141
|
+
* `audio-*` ids). Both spellings are accepted — the matcher normalizes the
|
|
14142
|
+
* `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
|
|
14143
|
+
* an operator who typed `dog` mean the same thing.
|
|
14144
|
+
*/
|
|
14145
|
+
var NcAudioConditionSchema = object({
|
|
14146
|
+
/** Audio macro labels; absent = any sound (level-only rule). */
|
|
14147
|
+
labels: array(string().min(1)).min(1).optional(),
|
|
14148
|
+
/** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
|
|
14149
|
+
dbThreshold: number().min(-96).max(0).optional(),
|
|
14150
|
+
/** Percentage of the window's samples that must be hits (1–100). */
|
|
14151
|
+
hitPercent: number().int().min(1).max(100).default(60),
|
|
14152
|
+
/** Length of the sampling window in seconds. */
|
|
14153
|
+
samplingSeconds: number().int().min(1).max(300).default(10)
|
|
14154
|
+
});
|
|
14155
|
+
/**
|
|
14023
14156
|
* Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
|
|
14024
14157
|
*
|
|
14025
14158
|
* The values are not symmetric, and deliberately so — the absent value has to
|
|
@@ -14292,7 +14425,33 @@ var NcConditionsSchema = object({
|
|
|
14292
14425
|
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
14293
14426
|
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
14294
14427
|
*/
|
|
14295
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
14428
|
+
occupancy: NcOccupancyConditionSchema.optional(),
|
|
14429
|
+
/**
|
|
14430
|
+
* IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
|
|
14431
|
+
* `samplingSeconds` window clear the optional `dbThreshold` and carry one of
|
|
14432
|
+
* the optional `labels`. Fail-closed on missing substrate (no audio samples,
|
|
14433
|
+
* a window that is not full yet, neither filter given). See
|
|
14434
|
+
* {@link NcAudioCondition}.
|
|
14435
|
+
*
|
|
14436
|
+
* Presence of this key is what makes a rule an AUDIO rule: the engine fires
|
|
14437
|
+
* it ONLY on a confirmed audio window, and a rule carrying it never fires on
|
|
14438
|
+
* a detection, a track or a device event (the same fail-closed pairing
|
|
14439
|
+
* `occupancy` has with the `device-event` trigger). That is how audio labels
|
|
14440
|
+
* leave `classes`: an audio rule names its sounds HERE, and the legacy path
|
|
14441
|
+
* (an `immediate` rule naming an `audio-*` class, one notification per
|
|
14442
|
+
* classified sample) stays exactly as it was for rules that already use it.
|
|
14443
|
+
*
|
|
14444
|
+
* NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
|
|
14445
|
+
* rather than an oversight: the viewer mirrors the descriptor enums BY HAND
|
|
14446
|
+
* (`camstack/src/data/notification-center.ts`, guarded by
|
|
14447
|
+
* `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
|
|
14448
|
+
* condition fields it does not know when a rule is saved from the phone.
|
|
14449
|
+
* Publishing an editor for a condition the app cannot round-trip is how an
|
|
14450
|
+
* operator loses a rule's conditions by opening it — so the descriptor, the
|
|
14451
|
+
* admin widget and the viewer mirror land together (P2 + P3), and only then
|
|
14452
|
+
* does an audio rule become authorable.
|
|
14453
|
+
*/
|
|
14454
|
+
audio: NcAudioConditionSchema.optional()
|
|
14296
14455
|
});
|
|
14297
14456
|
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
14298
14457
|
var NcRuleTargetSchema = object({
|
|
@@ -14406,6 +14565,73 @@ var NcThrottleSchema = object({
|
|
|
14406
14565
|
*/
|
|
14407
14566
|
granularity: NcThrottleGranularitySchema.optional()
|
|
14408
14567
|
});
|
|
14568
|
+
/**
|
|
14569
|
+
* How long the confirm gate may hold ONE notification, and how big the picture
|
|
14570
|
+
* it judges may be.
|
|
14571
|
+
*
|
|
14572
|
+
* The clamp is the product decision, not a coincidence of the model: p50 was
|
|
14573
|
+
* 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
|
|
14574
|
+
* arrives after the visitor has gone is not a notification. 448 px was enough
|
|
14575
|
+
* to score 16/16 on the operator's parking scenario — bigger costs latency and
|
|
14576
|
+
* tokens for pixels the model pools away.
|
|
14577
|
+
*/
|
|
14578
|
+
var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
|
|
14579
|
+
var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
|
|
14580
|
+
var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
|
|
14581
|
+
/** Comparison the model's COUNT must satisfy for the notification to fire. */
|
|
14582
|
+
var NcConfirmExpectSchema = object({
|
|
14583
|
+
op: _enum([
|
|
14584
|
+
">=",
|
|
14585
|
+
">",
|
|
14586
|
+
"<=",
|
|
14587
|
+
"<",
|
|
14588
|
+
"=="
|
|
14589
|
+
]),
|
|
14590
|
+
count: number().int().min(0).max(1e3)
|
|
14591
|
+
});
|
|
14592
|
+
/**
|
|
14593
|
+
* AI CONFIRM — a vision model looks at the picture this notification is about
|
|
14594
|
+
* to ship and says whether it agrees with the rule.
|
|
14595
|
+
*
|
|
14596
|
+
* It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
|
|
14597
|
+
* crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
|
|
14598
|
+
* on the operator's phone is not a verdict about this notification.
|
|
14599
|
+
*
|
|
14600
|
+
* FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
|
|
14601
|
+
* whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
|
|
14602
|
+
* the default and every fail-open is COUNTED, because a gate that always fails
|
|
14603
|
+
* open looks in the log exactly like a gate that works.
|
|
14604
|
+
*
|
|
14605
|
+
* Every field is `.optional()` rather than relied on as a Zod default at the
|
|
14606
|
+
* runtime seam: a Zod default does NOT run on the addon→addon cap path (three
|
|
14607
|
+
* production failures in one day), so the gate reads absent as the constant
|
|
14608
|
+
* above rather than trusting a parse it may never have seen.
|
|
14609
|
+
*/
|
|
14610
|
+
var NcConfirmSchema = object({
|
|
14611
|
+
/** Off unless asked for. An absent `confirm` and `enabled:false` are the
|
|
14612
|
+
* same thing, and both mean "deliver exactly as before". */
|
|
14613
|
+
enabled: boolean().default(false),
|
|
14614
|
+
/** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
|
|
14615
|
+
profileId: string().optional(),
|
|
14616
|
+
/**
|
|
14617
|
+
* The operator's question, in his own words. Absent = a question derived
|
|
14618
|
+
* from the rule (its class and its expectation).
|
|
14619
|
+
*
|
|
14620
|
+
* NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
|
|
14621
|
+
* banners, signage and plates as instructions if you let them reach the
|
|
14622
|
+
* prompt — proven live — so the authoritative contract stays in the system
|
|
14623
|
+
* turn and only rule-authored words land here.
|
|
14624
|
+
*/
|
|
14625
|
+
prompt: string().max(1e3).optional(),
|
|
14626
|
+
/** Fire only when the model's count satisfies this. Absent = the model's
|
|
14627
|
+
* own boolean verdict decides. */
|
|
14628
|
+
expect: NcConfirmExpectSchema.optional(),
|
|
14629
|
+
timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
|
|
14630
|
+
/** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
|
|
14631
|
+
onTimeout: _enum(["fire", "suppress"]).default("fire"),
|
|
14632
|
+
/** Longest edge the judged image is downscaled to before it is sent. */
|
|
14633
|
+
maxImagePx: number().int().min(64).max(2048).default(448)
|
|
14634
|
+
});
|
|
14409
14635
|
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
14410
14636
|
var NcRuleInputSchema = object({
|
|
14411
14637
|
name: string().min(1).max(200),
|
|
@@ -14466,7 +14692,13 @@ var NcRuleInputSchema = object({
|
|
|
14466
14692
|
* `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
|
|
14467
14693
|
* shape as every other actuation.
|
|
14468
14694
|
*/
|
|
14469
|
-
actions: NcRuleActionsSchema.optional()
|
|
14695
|
+
actions: NcRuleActionsSchema.optional(),
|
|
14696
|
+
/**
|
|
14697
|
+
* AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
|
|
14698
|
+
* a rule that predates the gate must keep delivering byte-for-byte as it
|
|
14699
|
+
* did, and absent is the only way to say that without a migration.
|
|
14700
|
+
*/
|
|
14701
|
+
confirm: NcConfirmSchema.optional()
|
|
14470
14702
|
});
|
|
14471
14703
|
/**
|
|
14472
14704
|
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
@@ -14477,7 +14709,37 @@ var NcRuleInputSchema = object({
|
|
|
14477
14709
|
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
14478
14710
|
* `updateRule` patch.
|
|
14479
14711
|
*/
|
|
14480
|
-
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
|
|
14712
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
|
|
14713
|
+
disabledTargetIds: array(string()).optional(),
|
|
14714
|
+
/**
|
|
14715
|
+
* `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
|
|
14716
|
+
*
|
|
14717
|
+
* It makes the key optional to SUPPLY; the parse still materialises the
|
|
14718
|
+
* default when the key is absent. And `NcRuleStore.update` merges with
|
|
14719
|
+
* `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
|
|
14720
|
+
* one — which made every partial edit destructive:
|
|
14721
|
+
*
|
|
14722
|
+
* nc.updateRule({ throttle }) → conditions reset to `{}`
|
|
14723
|
+
* nc.setRuleTargetEnabled(...) → conditions reset to `{}`
|
|
14724
|
+
* setEnabled(ruleId, false) → conditions reset to `{}`
|
|
14725
|
+
*
|
|
14726
|
+
* A rule scoped to one camera and one zone silently became a rule that
|
|
14727
|
+
* matches EVERY event on EVERY camera, and lost its `media` policy
|
|
14728
|
+
* (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
|
|
14729
|
+
* live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
|
|
14730
|
+
* within a minute of a two-field patch.
|
|
14731
|
+
*
|
|
14732
|
+
* So every defaulted field is re-declared here WITHOUT its default. The
|
|
14733
|
+
* inner defaults still apply when the caller DOES send the key — `{}` for
|
|
14734
|
+
* conditions remains a real instruction ("clear them") — and only the
|
|
14735
|
+
* absent key is now genuinely absent.
|
|
14736
|
+
*/
|
|
14737
|
+
enabled: boolean().optional(),
|
|
14738
|
+
conditions: NcConditionsSchema.optional(),
|
|
14739
|
+
media: NcMediaPolicySchema.optional(),
|
|
14740
|
+
throttle: NcThrottleSchema.optional(),
|
|
14741
|
+
priority: number().int().min(1).max(5).optional()
|
|
14742
|
+
});
|
|
14481
14743
|
/** A persisted rule. */
|
|
14482
14744
|
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
14483
14745
|
id: string(),
|
|
@@ -14778,6 +15040,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
|
|
|
14778
15040
|
* Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
|
|
14779
15041
|
* copy would lie the first time a rule is disabled.
|
|
14780
15042
|
*/
|
|
15043
|
+
/**
|
|
15044
|
+
* Why a device a mode NAMES is nonetheless not armed by it.
|
|
15045
|
+
*
|
|
15046
|
+
* Each value is an existing authority, never a new flag (D62): `muted` is the
|
|
15047
|
+
* per-camera notification switch the Notification Center already owns,
|
|
15048
|
+
* `detection-off` is the device's own detection binding being inactive, and
|
|
15049
|
+
* `offline` is the device manager's liveness. A fourth reason would mean a
|
|
15050
|
+
* fourth authority, and inventing one here is how a panel starts disagreeing
|
|
15051
|
+
* with the switches the operator actually used.
|
|
15052
|
+
*/
|
|
15053
|
+
var NcAlarmSkipReasonSchema = _enum([
|
|
15054
|
+
"muted",
|
|
15055
|
+
"detection-off",
|
|
15056
|
+
"offline"
|
|
15057
|
+
]);
|
|
15058
|
+
var NcAlarmSkippedDeviceSchema = object({
|
|
15059
|
+
deviceId: number().int(),
|
|
15060
|
+
reason: NcAlarmSkipReasonSchema
|
|
15061
|
+
});
|
|
14781
15062
|
var NcAlarmModeCoverageSchema = object({
|
|
14782
15063
|
mode: AlarmArmModeSchema,
|
|
14783
15064
|
/** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
|
|
@@ -14785,7 +15066,18 @@ var NcAlarmModeCoverageSchema = object({
|
|
|
14785
15066
|
/** At least one covering rule has no device scope, so the mode covers all. */
|
|
14786
15067
|
allDevices: boolean(),
|
|
14787
15068
|
/** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
|
|
14788
|
-
deviceIds: array(number().int())
|
|
15069
|
+
deviceIds: array(number().int()),
|
|
15070
|
+
/**
|
|
15071
|
+
* Devices this mode NAMES but cannot actually arm, each with the switch that
|
|
15072
|
+
* excludes it.
|
|
15073
|
+
*
|
|
15074
|
+
* "Away armed — 12 cameras" is a promise, and a muted camera among those
|
|
15075
|
+
* twelve makes it false in exactly the way nobody notices until an incident.
|
|
15076
|
+
* Defaulted to `[]` so a coverage answer computed before this field existed
|
|
15077
|
+
* still parses as "nothing known to be skipped" rather than failing the whole
|
|
15078
|
+
* alarm tab.
|
|
15079
|
+
*/
|
|
15080
|
+
skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
|
|
14789
15081
|
});
|
|
14790
15082
|
var NcAlarmConfigSchema = object({
|
|
14791
15083
|
/**
|
|
@@ -17584,9 +17876,16 @@ var CameraStatusSchema = object({
|
|
|
17584
17876
|
audio: CameraAudioStatusSchema.nullable(),
|
|
17585
17877
|
recording: CameraRecordingStatusSchema.nullable(),
|
|
17586
17878
|
/**
|
|
17587
|
-
* Per-camera
|
|
17879
|
+
* Per-camera functions an OPERATOR has turned off
|
|
17588
17880
|
* ([D61](../../../../docs/decisions/adr-0067.md)).
|
|
17589
17881
|
*
|
|
17882
|
+
* Composed from the AUTHORITIES themselves — the wrapper bindings,
|
|
17883
|
+
* `RecordingConfig.enabled`, the notification mute, the broker's audio
|
|
17884
|
+
* policy, the camera's own microphone — via `composeSwitchedOff`, not from
|
|
17885
|
+
* the deprecated `getCameraSwitches` group ([D113](../../../../docs/decisions/adr-0113.md)).
|
|
17886
|
+
* The badge outlives the control panel: the panel was a convenience, this is
|
|
17887
|
+
* the difference between a camera being off and a camera being dead.
|
|
17888
|
+
*
|
|
17590
17889
|
* This is the difference between DISABLED and BROKEN. A camera whose
|
|
17591
17890
|
* `detection` block reports zero fps and whose `switchedOff` contains
|
|
17592
17891
|
* `'object-detection'` was switched off by a person; the same camera with an
|
|
@@ -23095,7 +23394,19 @@ var RecordingManifestSchema = object({
|
|
|
23095
23394
|
* profiles/subtrees/locations on this node). */
|
|
23096
23395
|
var RecordingDeviceUsageSchema = object({
|
|
23097
23396
|
deviceId: number(),
|
|
23098
|
-
usedBytes: number()
|
|
23397
|
+
usedBytes: number(),
|
|
23398
|
+
/**
|
|
23399
|
+
* Start of this camera's OLDEST indexed segment, across every profile and
|
|
23400
|
+
* location — the "Oldest footage" column in Recordings → Storage, and the
|
|
23401
|
+
* only honest answer to "is retention actually holding?" per camera.
|
|
23402
|
+
*
|
|
23403
|
+
* `null` = the camera has no footage. OPTIONAL because a recorder that
|
|
23404
|
+
* predates this field omits it entirely, and a hub whose types carry the
|
|
23405
|
+
* field must keep validating that older provider's payload: the framework
|
|
23406
|
+
* (types) and the addon ship on different trains, and the addon is usually
|
|
23407
|
+
* the later of the two.
|
|
23408
|
+
*/
|
|
23409
|
+
oldestMs: number().nullable().optional()
|
|
23099
23410
|
});
|
|
23100
23411
|
/** Recording storage usage + capacity for one storage location. */
|
|
23101
23412
|
var RecordingLocationUsageSchema = object({
|
|
@@ -23123,6 +23434,57 @@ var RecordingStorageUsageSchema = object({
|
|
|
23123
23434
|
locations: array(RecordingLocationUsageSchema)
|
|
23124
23435
|
});
|
|
23125
23436
|
/**
|
|
23437
|
+
* The OPERATOR-ARMED half of multi-location recordings (D116).
|
|
23438
|
+
*
|
|
23439
|
+
* The placement plan decides where NEW writes go and moves nothing. A rebalance
|
|
23440
|
+
* is the operator asking for the EXISTING archive to be brought into line with
|
|
23441
|
+
* that plan: one relocate job per (camera, profile) pile that sits on the wrong
|
|
23442
|
+
* location, run FIFO behind the single-flight mover.
|
|
23443
|
+
*
|
|
23444
|
+
* `plan…` and `start…` return the SAME shape deliberately — what the operator
|
|
23445
|
+
* confirms is exactly what gets enqueued, and `jobIds` is the only difference
|
|
23446
|
+
* (empty on the plan).
|
|
23447
|
+
*/
|
|
23448
|
+
var RecordingRebalanceMoveSchema = object({
|
|
23449
|
+
deviceId: number(),
|
|
23450
|
+
profile: string(),
|
|
23451
|
+
fromLocationId: string(),
|
|
23452
|
+
toLocationId: string(),
|
|
23453
|
+
bytes: number(),
|
|
23454
|
+
files: number().int()
|
|
23455
|
+
});
|
|
23456
|
+
/** Why a pile that is out of place is staying there. Every refusal is
|
|
23457
|
+
* reported: a rebalance that silently drops a camera reads exactly like one
|
|
23458
|
+
* that had nothing to do. */
|
|
23459
|
+
var RecordingRebalanceSkipReasonSchema = _enum([
|
|
23460
|
+
"unassigned",
|
|
23461
|
+
"target-not-writable",
|
|
23462
|
+
"below-threshold",
|
|
23463
|
+
"no-headroom"
|
|
23464
|
+
]);
|
|
23465
|
+
var RecordingRebalanceSkipSchema = object({
|
|
23466
|
+
deviceId: number(),
|
|
23467
|
+
profile: string(),
|
|
23468
|
+
fromLocationId: string(),
|
|
23469
|
+
/** The location the plan wants; null when the camera has no assignment. */
|
|
23470
|
+
toLocationId: string().nullable(),
|
|
23471
|
+
bytes: number(),
|
|
23472
|
+
reason: RecordingRebalanceSkipReasonSchema
|
|
23473
|
+
});
|
|
23474
|
+
var RecordingRebalancePlanSchema = object({
|
|
23475
|
+
moves: array(RecordingRebalanceMoveSchema),
|
|
23476
|
+
skipped: array(RecordingRebalanceSkipSchema),
|
|
23477
|
+
bytesToMove: number(),
|
|
23478
|
+
/** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
|
|
23479
|
+
jobIds: array(string())
|
|
23480
|
+
});
|
|
23481
|
+
var RecordingRebalanceInputSchema = object({
|
|
23482
|
+
/** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
|
|
23483
|
+
throttleMbps: number().min(1).max(1e3).optional(),
|
|
23484
|
+
/** Ignore piles smaller than this (default 1 GB). */
|
|
23485
|
+
minMoveGb: number().min(0).optional()
|
|
23486
|
+
});
|
|
23487
|
+
/**
|
|
23126
23488
|
* Result of locating footage at a wall-clock instant for one device/profile.
|
|
23127
23489
|
* `segment` carries the covering segment's window; `gap` reports the forward
|
|
23128
23490
|
* nearest covered edge (`null` past the end of footage / when none exists)
|
|
@@ -23285,9 +23647,24 @@ method(object({
|
|
|
23285
23647
|
}), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
23286
23648
|
kind: "mutation",
|
|
23287
23649
|
auth: "admin"
|
|
23650
|
+
}), method(RelocateFootageInputSchema, object({ jobId: string() }), {
|
|
23651
|
+
kind: "mutation",
|
|
23652
|
+
auth: "admin"
|
|
23653
|
+
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
23654
|
+
kind: "query",
|
|
23655
|
+
auth: "admin"
|
|
23656
|
+
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
23657
|
+
kind: "mutation",
|
|
23658
|
+
auth: "admin"
|
|
23659
|
+
}), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
|
|
23660
|
+
kind: "query",
|
|
23661
|
+
auth: "admin"
|
|
23662
|
+
}), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
|
|
23663
|
+
kind: "mutation",
|
|
23664
|
+
auth: "admin"
|
|
23288
23665
|
});
|
|
23289
23666
|
/**
|
|
23290
|
-
* `
|
|
23667
|
+
* `recording-export` cap — render a footage time range into a single downloadable
|
|
23291
23668
|
* MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
|
|
23292
23669
|
* bounded lifetime with a durable history, auto-expiry, and optional
|
|
23293
23670
|
* delete-after-download.
|
|
@@ -23302,10 +23679,42 @@ method(object({
|
|
|
23302
23679
|
*/
|
|
23303
23680
|
/** Playback-speed multiplier for the render (1 = realtime). */
|
|
23304
23681
|
var ExportSpeedSchema = number().min(.25).max(32);
|
|
23682
|
+
/**
|
|
23683
|
+
* One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
|
|
23684
|
+
*
|
|
23685
|
+
* Relative and not absolute epoch on purpose: the renderer's frame-select
|
|
23686
|
+
* expression sees ffmpeg's `t`, which starts at 0 for the export's source
|
|
23687
|
+
* playlist. Handing it absolute epochs would make every call site responsible
|
|
23688
|
+
* for the same subtraction, and the one that forgot would emit a filter that
|
|
23689
|
+
* selects nothing — silently, as a uniform timelapse.
|
|
23690
|
+
*/
|
|
23691
|
+
var ExportDenseRangeSchema = object({
|
|
23692
|
+
fromSec: number().nonnegative(),
|
|
23693
|
+
toSec: number().nonnegative()
|
|
23694
|
+
}).refine((r) => r.toSec > r.fromSec, { message: "dense range must have toSec > fromSec" });
|
|
23695
|
+
/**
|
|
23696
|
+
* Dense-interval overlay for a timelapse: sample at `dense.everyMs` INSIDE the
|
|
23697
|
+
* listed ranges and at the base `everyMs` everywhere else.
|
|
23698
|
+
*
|
|
23699
|
+
* `everyMs` must be strictly smaller than the base cadence — a dense rate that
|
|
23700
|
+
* is not denser renders a uniform timelapse the operator believes is two-rate.
|
|
23701
|
+
*/
|
|
23702
|
+
var ExportDenseSchema = object({
|
|
23703
|
+
everyMs: number().int().positive(),
|
|
23704
|
+
ranges: array(ExportDenseRangeSchema).min(1).max(200)
|
|
23705
|
+
});
|
|
23305
23706
|
/** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
|
|
23306
23707
|
var ExportTimelapseSchema = object({
|
|
23307
23708
|
everyMs: number().int().positive(),
|
|
23308
|
-
outputFps: number().int().min(1).max(60).optional()
|
|
23709
|
+
outputFps: number().int().min(1).max(60).optional(),
|
|
23710
|
+
/** Optional second, FASTER rate over the intervals that matter. */
|
|
23711
|
+
dense: ExportDenseSchema.optional()
|
|
23712
|
+
}).superRefine((v, ctx) => {
|
|
23713
|
+
if (v.dense !== void 0 && v.dense.everyMs >= v.everyMs) ctx.addIssue({
|
|
23714
|
+
code: ZodIssueCode.custom,
|
|
23715
|
+
message: "dense.everyMs must be strictly smaller than the base everyMs",
|
|
23716
|
+
path: ["dense", "everyMs"]
|
|
23717
|
+
});
|
|
23309
23718
|
});
|
|
23310
23719
|
/**
|
|
23311
23720
|
* Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
|
|
@@ -23363,6 +23772,19 @@ var ExportDownloadSchema = object({
|
|
|
23363
23772
|
url: string(),
|
|
23364
23773
|
endpoints: array(string())
|
|
23365
23774
|
});
|
|
23775
|
+
/**
|
|
23776
|
+
* A finished export's bytes, inline.
|
|
23777
|
+
*
|
|
23778
|
+
* `bytes` is the DECODED length — the number the caller bounds and logs
|
|
23779
|
+
* against, so nobody has to infer it from the base64 length.
|
|
23780
|
+
*/
|
|
23781
|
+
var ExportBytesSchema = object({
|
|
23782
|
+
base64: string(),
|
|
23783
|
+
contentType: string(),
|
|
23784
|
+
/** Suggested filename, extension included. */
|
|
23785
|
+
name: string(),
|
|
23786
|
+
bytes: number().int().nonnegative()
|
|
23787
|
+
});
|
|
23366
23788
|
method(object({
|
|
23367
23789
|
deviceId: number(),
|
|
23368
23790
|
profile: string(),
|
|
@@ -23387,6 +23809,9 @@ method(object({
|
|
|
23387
23809
|
}), method(object({ exportId: string() }), ExportDownloadSchema, {
|
|
23388
23810
|
kind: "query",
|
|
23389
23811
|
auth: "protected"
|
|
23812
|
+
}), method(object({ exportId: string() }), ExportBytesSchema, {
|
|
23813
|
+
kind: "query",
|
|
23814
|
+
auth: "protected"
|
|
23390
23815
|
});
|
|
23391
23816
|
/**
|
|
23392
23817
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
@@ -28580,6 +29005,12 @@ Object.freeze({
|
|
|
28580
29005
|
addonId: null,
|
|
28581
29006
|
access: "create"
|
|
28582
29007
|
},
|
|
29008
|
+
"recording.cancelRelocateJob": {
|
|
29009
|
+
capName: "recording",
|
|
29010
|
+
capScope: "system",
|
|
29011
|
+
addonId: null,
|
|
29012
|
+
access: "create"
|
|
29013
|
+
},
|
|
28583
29014
|
"recording.cancelStorageMigrationMove": {
|
|
28584
29015
|
capName: "recording",
|
|
28585
29016
|
capScope: "system",
|
|
@@ -28634,6 +29065,12 @@ Object.freeze({
|
|
|
28634
29065
|
addonId: null,
|
|
28635
29066
|
access: "view"
|
|
28636
29067
|
},
|
|
29068
|
+
"recording.listRelocateJobs": {
|
|
29069
|
+
capName: "recording",
|
|
29070
|
+
capScope: "system",
|
|
29071
|
+
addonId: null,
|
|
29072
|
+
access: "view"
|
|
29073
|
+
},
|
|
28637
29074
|
"recording.locateSegment": {
|
|
28638
29075
|
capName: "recording",
|
|
28639
29076
|
capScope: "system",
|
|
@@ -28646,6 +29083,12 @@ Object.freeze({
|
|
|
28646
29083
|
addonId: null,
|
|
28647
29084
|
access: "create"
|
|
28648
29085
|
},
|
|
29086
|
+
"recording.planStorageRebalance": {
|
|
29087
|
+
capName: "recording",
|
|
29088
|
+
capScope: "system",
|
|
29089
|
+
addonId: null,
|
|
29090
|
+
access: "view"
|
|
29091
|
+
},
|
|
28649
29092
|
"recording.pruneFootage": {
|
|
28650
29093
|
capName: "recording",
|
|
28651
29094
|
capScope: "system",
|
|
@@ -28670,6 +29113,12 @@ Object.freeze({
|
|
|
28670
29113
|
addonId: null,
|
|
28671
29114
|
access: "create"
|
|
28672
29115
|
},
|
|
29116
|
+
"recording.relocateFootage": {
|
|
29117
|
+
capName: "recording",
|
|
29118
|
+
capScope: "system",
|
|
29119
|
+
addonId: null,
|
|
29120
|
+
access: "create"
|
|
29121
|
+
},
|
|
28673
29122
|
"recording.renderClip": {
|
|
28674
29123
|
capName: "recording",
|
|
28675
29124
|
capScope: "system",
|
|
@@ -28706,38 +29155,50 @@ Object.freeze({
|
|
|
28706
29155
|
addonId: null,
|
|
28707
29156
|
access: "create"
|
|
28708
29157
|
},
|
|
29158
|
+
"recording.startStorageRebalance": {
|
|
29159
|
+
capName: "recording",
|
|
29160
|
+
capScope: "system",
|
|
29161
|
+
addonId: null,
|
|
29162
|
+
access: "create"
|
|
29163
|
+
},
|
|
28709
29164
|
"recordingExport.cancelExport": {
|
|
28710
|
-
capName: "
|
|
29165
|
+
capName: "recording-export",
|
|
28711
29166
|
capScope: "system",
|
|
28712
29167
|
addonId: null,
|
|
28713
29168
|
access: "create"
|
|
28714
29169
|
},
|
|
28715
29170
|
"recordingExport.createExport": {
|
|
28716
|
-
capName: "
|
|
29171
|
+
capName: "recording-export",
|
|
28717
29172
|
capScope: "system",
|
|
28718
29173
|
addonId: null,
|
|
28719
29174
|
access: "create"
|
|
28720
29175
|
},
|
|
28721
29176
|
"recordingExport.deleteExport": {
|
|
28722
|
-
capName: "
|
|
29177
|
+
capName: "recording-export",
|
|
28723
29178
|
capScope: "system",
|
|
28724
29179
|
addonId: null,
|
|
28725
29180
|
access: "delete"
|
|
28726
29181
|
},
|
|
28727
29182
|
"recordingExport.getDownloadUrl": {
|
|
28728
|
-
capName: "
|
|
29183
|
+
capName: "recording-export",
|
|
28729
29184
|
capScope: "system",
|
|
28730
29185
|
addonId: null,
|
|
28731
29186
|
access: "view"
|
|
28732
29187
|
},
|
|
28733
29188
|
"recordingExport.getExport": {
|
|
28734
|
-
capName: "
|
|
29189
|
+
capName: "recording-export",
|
|
28735
29190
|
capScope: "system",
|
|
28736
29191
|
addonId: null,
|
|
28737
29192
|
access: "view"
|
|
28738
29193
|
},
|
|
28739
29194
|
"recordingExport.listExports": {
|
|
28740
|
-
capName: "
|
|
29195
|
+
capName: "recording-export",
|
|
29196
|
+
capScope: "system",
|
|
29197
|
+
addonId: null,
|
|
29198
|
+
access: "view"
|
|
29199
|
+
},
|
|
29200
|
+
"recordingExport.readExportBytes": {
|
|
29201
|
+
capName: "recording-export",
|
|
28741
29202
|
capScope: "system",
|
|
28742
29203
|
addonId: null,
|
|
28743
29204
|
access: "view"
|
|
@@ -30114,6 +30575,104 @@ var FramerateField = number().int().min(1).max(60);
|
|
|
30114
30575
|
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
30115
30576
|
var PriorityField = number().int().min(1).max(5);
|
|
30116
30577
|
/**
|
|
30578
|
+
* Explicit override of the DENSE sampling cadence, seconds.
|
|
30579
|
+
*
|
|
30580
|
+
* Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
|
|
30581
|
+
* 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
|
|
30582
|
+
* made that same base 3 s and rendered a person pass as two frames.)
|
|
30583
|
+
*
|
|
30584
|
+
* THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
|
|
30585
|
+
* `denseCadenceSec` and played at `framerate` occupies
|
|
30586
|
+
*
|
|
30587
|
+
* outputSeconds = (rangeSec / denseCadenceSec) / framerate
|
|
30588
|
+
*
|
|
30589
|
+
* so a 7 s pass at 1 s / 12 fps is 0.58 s of video, and at 0.5 s it is 1.17 s.
|
|
30590
|
+
* Halving this field doubles the frames INSIDE ranges only — the base cadence,
|
|
30591
|
+
* and therefore the length of a quiet night, does not move.
|
|
30592
|
+
*
|
|
30593
|
+
* Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
|
|
30594
|
+
* the recording has them returns the same frames, requested twice. Must be
|
|
30595
|
+
* STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
|
|
30596
|
+
* a uniform video the operator believes is two-rate — and upsert refuses it
|
|
30597
|
+
* rather than letting the export cap reject the render hours after the window.
|
|
30598
|
+
*/
|
|
30599
|
+
var DenseCadenceSecField = number().min(.1).max(3600);
|
|
30600
|
+
/**
|
|
30601
|
+
* Minimum seconds of OUTPUT video each detection range must occupy.
|
|
30602
|
+
*
|
|
30603
|
+
* The operator-facing form of the arithmetic above: instead of solving for a
|
|
30604
|
+
* cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
|
|
30605
|
+
* 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
|
|
30606
|
+
* that range every ~583 ms.
|
|
30607
|
+
*
|
|
30608
|
+
* ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
|
|
30609
|
+
* ranges are terms of a single ffmpeg `select` expression that cannot vary rate
|
|
30610
|
+
* per term — so the MOST DEMANDING (shortest) range sets the rate and longer
|
|
30611
|
+
* ranges are sampled denser than they need. Per-range cadences require a cap
|
|
30612
|
+
* schema change and are the tracked follow-up.
|
|
30613
|
+
*
|
|
30614
|
+
* A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
|
|
30615
|
+
* is rendered with every frame that EXISTS and no more: the guarantee is capped
|
|
30616
|
+
* by real footage, never met by duplicating frames into motion that never
|
|
30617
|
+
* happened.
|
|
30618
|
+
*/
|
|
30619
|
+
var MinDwellSecField = number().min(0).max(60);
|
|
30620
|
+
/**
|
|
30621
|
+
* Caption burned into the notification's preview frame.
|
|
30622
|
+
*
|
|
30623
|
+
* Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
|
|
30624
|
+
* `rule`, `from`, `to`) and rendered by the SAME renderer — a second
|
|
30625
|
+
* templating dialect for one field would be a second thing to explain.
|
|
30626
|
+
*
|
|
30627
|
+
* Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
|
|
30628
|
+
* operator saying "the frame, no caption" — a distinct, reachable answer, and
|
|
30629
|
+
* the reason this is not `.min(1)`.
|
|
30630
|
+
*/
|
|
30631
|
+
var PreviewTextField = string().max(200);
|
|
30632
|
+
/**
|
|
30633
|
+
* Whether the notification's preview is a STILL or a short animation.
|
|
30634
|
+
*
|
|
30635
|
+
* The operator's ask, verbatim: *"inviato come gif o video (come per le altre
|
|
30636
|
+
* rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
|
|
30637
|
+
* night reads better as three seconds of motion than as one frame of it. Both
|
|
30638
|
+
* modes get the SAME treatment (blurred frame, large centred title); `'gif'`
|
|
30639
|
+
* simply applies it to a dozen frames sampled across the render and assembles
|
|
30640
|
+
* them.
|
|
30641
|
+
*
|
|
30642
|
+
* `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
|
|
30643
|
+
* seeks and a palette pass, and no rule that never asked for one should start
|
|
30644
|
+
* paying that on the deploy that shipped it.
|
|
30645
|
+
*
|
|
30646
|
+
* A GIF that cannot be assembled DEGRADES to the still — never to nothing.
|
|
30647
|
+
*/
|
|
30648
|
+
var PreviewModeField = _enum(["image", "gif"]);
|
|
30649
|
+
/**
|
|
30650
|
+
* Which detection classes the notification reports counts for.
|
|
30651
|
+
*
|
|
30652
|
+
* The counts come from the tracks the render ALREADY fetched for its dense-range
|
|
30653
|
+
* plan — no second query — aggregated per class. Absent or empty means "every
|
|
30654
|
+
* class the window actually contained", which is what an operator who never
|
|
30655
|
+
* opened the field wants; a list narrows it (`['person']` on a driveway that
|
|
30656
|
+
* counts cars all night).
|
|
30657
|
+
*
|
|
30658
|
+
* Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
|
|
30659
|
+
* …). An unknown name simply never matches and reports nothing — it is not an
|
|
30660
|
+
* error, because a rule may legitimately name a class this camera's model does
|
|
30661
|
+
* not emit.
|
|
30662
|
+
*
|
|
30663
|
+
* The counts are exposed to {@link TimelapseTemplateSchema} as:
|
|
30664
|
+
* - `{{detections}}` — total over the reported classes
|
|
30665
|
+
* - `{{detectionSummary}}` — `2 persone, 1 veicolo`
|
|
30666
|
+
* - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
|
|
30667
|
+
* one per class, `count_` + the class name
|
|
30668
|
+
*
|
|
30669
|
+
* With NO custom body template the summary is appended to the derived body, and
|
|
30670
|
+
* only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
|
|
30671
|
+
* reads. With a custom template the operator owns every word — nothing is
|
|
30672
|
+
* appended, so `{{detectionSummary}}` is how he asks for it.
|
|
30673
|
+
*/
|
|
30674
|
+
var ReportClassesField = array(string().min(1).max(40)).max(20);
|
|
30675
|
+
/**
|
|
30117
30676
|
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
30118
30677
|
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
30119
30678
|
* here (see the ownership note above).
|
|
@@ -30133,9 +30692,30 @@ var TimelapseRuleInputSchema = object({
|
|
|
30133
30692
|
cadenceSec: CadenceSecField.default(15),
|
|
30134
30693
|
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
30135
30694
|
framerate: FramerateField.default(10),
|
|
30695
|
+
/**
|
|
30696
|
+
* Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
|
|
30697
|
+
* as `max(1s, cadenceSec / 30)`, which is what every rule written before this
|
|
30698
|
+
* field gets.
|
|
30699
|
+
*/
|
|
30700
|
+
denseCadenceSec: DenseCadenceSecField.optional(),
|
|
30701
|
+
/** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
|
|
30702
|
+
minDwellSec: MinDwellSecField.optional(),
|
|
30136
30703
|
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
30137
30704
|
targets: TargetsField,
|
|
30138
30705
|
template: TimelapseTemplateSchema.optional(),
|
|
30706
|
+
/**
|
|
30707
|
+
* Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
|
|
30708
|
+
* and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
|
|
30709
|
+
*
|
|
30710
|
+
* Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
|
|
30711
|
+
* the notification's title/body, and clearing it (`template: null`) must not
|
|
30712
|
+
* silently clear the caption too.
|
|
30713
|
+
*/
|
|
30714
|
+
previewText: PreviewTextField.optional(),
|
|
30715
|
+
/** Still or animation — see {@link PreviewModeField}. */
|
|
30716
|
+
previewMode: PreviewModeField.default("image"),
|
|
30717
|
+
/** Classes the notification counts — see {@link ReportClassesField}. */
|
|
30718
|
+
reportClasses: ReportClassesField.optional(),
|
|
30139
30719
|
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
30140
30720
|
priority: PriorityField.default(3)
|
|
30141
30721
|
});
|
|
@@ -30146,8 +30726,13 @@ object({
|
|
|
30146
30726
|
schedule: NcScheduleSchema.optional(),
|
|
30147
30727
|
cadenceSec: CadenceSecField.optional(),
|
|
30148
30728
|
framerate: FramerateField.optional(),
|
|
30729
|
+
denseCadenceSec: DenseCadenceSecField.optional(),
|
|
30730
|
+
minDwellSec: MinDwellSecField.optional(),
|
|
30149
30731
|
targets: TargetsField.optional(),
|
|
30150
30732
|
template: TimelapseTemplateSchema.nullable().optional(),
|
|
30733
|
+
previewText: PreviewTextField.optional(),
|
|
30734
|
+
previewMode: PreviewModeField.optional(),
|
|
30735
|
+
reportClasses: ReportClassesField.optional(),
|
|
30151
30736
|
priority: PriorityField.optional()
|
|
30152
30737
|
});
|
|
30153
30738
|
TimelapseRuleInputSchema.extend({
|
|
@@ -30159,10 +30744,28 @@ TimelapseRuleInputSchema.extend({
|
|
|
30159
30744
|
*/
|
|
30160
30745
|
ownerUserId: string().optional(),
|
|
30161
30746
|
/**
|
|
30162
|
-
* Epoch-ms of the
|
|
30163
|
-
*
|
|
30747
|
+
* Epoch-ms of the NEWEST successful generation across every camera of this
|
|
30748
|
+
* rule. What a UI shows, and the compatibility floor for
|
|
30749
|
+
* {@link readTimelapseGeneratedAt}. Absent = never generated.
|
|
30164
30750
|
*/
|
|
30165
30751
|
lastGeneratedAt: number().optional(),
|
|
30752
|
+
/**
|
|
30753
|
+
* PER-CAMERA generation state, keyed by `String(deviceId)` — the
|
|
30754
|
+
* re-generation guard's real durable state.
|
|
30755
|
+
*
|
|
30756
|
+
* One rule covers several cameras and each renders its own video, so a rule
|
|
30757
|
+
* -wide stamp is wrong in the direction that DESTROYS work: camera A
|
|
30758
|
+
* succeeding at 06:05 tells camera B, whose render failed, that it is
|
|
30759
|
+
* already done — and B's night is gone for good, because the window will not
|
|
30760
|
+
* come back.
|
|
30761
|
+
*
|
|
30762
|
+
* ADDITIVE, so the migration is free: a row written before this field simply
|
|
30763
|
+
* has no map, and {@link readTimelapseGeneratedAt} falls back to
|
|
30764
|
+
* {@link TimelapseRuleSchema.shape.lastGeneratedAt}. Reading an old row as
|
|
30765
|
+
* "never generated" would re-render and re-notify every camera of every rule
|
|
30766
|
+
* once, on the deploy that shipped the map.
|
|
30767
|
+
*/
|
|
30768
|
+
generatedByDevice: record(string(), number()).optional(),
|
|
30166
30769
|
/** userId of the caller who created the rule (server-stamped). */
|
|
30167
30770
|
createdBy: string(),
|
|
30168
30771
|
createdAt: number(),
|