@camstack/addon-provider-tuya 0.2.13 → 0.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/addon.js +625 -22
- package/dist/addon.mjs +625 -22
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -8039,8 +8039,31 @@ var AdoptionJobSchema = object({
|
|
|
8039
8039
|
error: string().nullable()
|
|
8040
8040
|
});
|
|
8041
8041
|
/**
|
|
8042
|
-
* Per-camera FUNCTION SWITCHES
|
|
8043
|
-
*
|
|
8042
|
+
* Per-camera FUNCTION SWITCHES.
|
|
8043
|
+
*
|
|
8044
|
+
* ## The aggregate group is being withdrawn — the BADGE is not (D113)
|
|
8045
|
+
*
|
|
8046
|
+
* This file shipped as "the one coherent on/off surface over the pipeline
|
|
8047
|
+
* functions an operator thinks in terms of". The operator's verdict on
|
|
8048
|
+
* 2026-08-12 was that the coherent surface bought complexity and no clarity:
|
|
8049
|
+
* every function already had a settings page of its own, and a second place to
|
|
8050
|
+
* turn it off is a second place to look. Each switch is going back to its own
|
|
8051
|
+
* component's original options — detection to the detection-pipeline wrapper
|
|
8052
|
+
* binding, audio analysis to its own, recording to `RecordingConfig.enabled`
|
|
8053
|
+
* (which was always first-class; the switch was a veneer over
|
|
8054
|
+
* `recording.setDeviceConfig`), notifications to a notification-center
|
|
8055
|
+
* per-device setting, the two camera planes to their own components.
|
|
8056
|
+
*
|
|
8057
|
+
* What survives is {@link composeSwitchedOff}: `CameraStatus.switchedOff`, the
|
|
8058
|
+
* thing that lets a status surface say DISABLED instead of BROKEN, recomposed
|
|
8059
|
+
* straight from the authorities with no group in the middle. That rule was
|
|
8060
|
+
* never about a control panel.
|
|
8061
|
+
*
|
|
8062
|
+
* Everything else here — {@link CAMERA_SWITCH_CATALOG}, {@link CameraSwitch},
|
|
8063
|
+
* {@link deriveCameraSwitches}, the `pipelineOrchestrator.getCameraSwitches` /
|
|
8064
|
+
* `setCameraSwitch` pair — is a COMPATIBILITY surface for as long as deployed
|
|
8065
|
+
* viewers (v1.0.305) and the admin UI still call it. It is deleted when they
|
|
8066
|
+
* stop; nothing new may be built on it.
|
|
8044
8067
|
*
|
|
8045
8068
|
* ## This file adds no state
|
|
8046
8069
|
*
|
|
@@ -8391,7 +8414,15 @@ var RecordingConfigSchema = object({
|
|
|
8391
8414
|
* Each completed/failed run also lands one durable ops-log row on its owning
|
|
8392
8415
|
* addon surface.
|
|
8393
8416
|
*/
|
|
8417
|
+
/**
|
|
8418
|
+
* `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
|
|
8419
|
+
* rebalance enqueues one job per (camera, profile). Refusing the second job —
|
|
8420
|
+
* what the engine did before — turned a fifteen-camera rebalance into fifteen
|
|
8421
|
+
* manual retries. Queued jobs run FIFO; a queued job that is cancelled never
|
|
8422
|
+
* runs at all.
|
|
8423
|
+
*/
|
|
8394
8424
|
var RelocateJobStateSchema = _enum([
|
|
8425
|
+
"queued",
|
|
8395
8426
|
"running",
|
|
8396
8427
|
"done",
|
|
8397
8428
|
"failed",
|
|
@@ -8426,6 +8457,15 @@ var RelocateFootageInputSchema = object({
|
|
|
8426
8457
|
/** Limits relocation to the logical profile class. Omit only for the
|
|
8427
8458
|
* pre-orchestration compatibility path. */
|
|
8428
8459
|
footageClass: RelocateFootageClassSchema.optional(),
|
|
8460
|
+
/** Scope the move to ONE camera. Absent = every camera on the source, which
|
|
8461
|
+
* is what a whole-disk drain means. The rebalance path always sets it: its
|
|
8462
|
+
* unit is a (camera, profile) pile, not a disk. */
|
|
8463
|
+
deviceId: number().int().optional(),
|
|
8464
|
+
/** Scope the move to specific segment profiles (`high` / `mid` / `low`).
|
|
8465
|
+
* Finer than `footageClass`, which cannot separate high from mid — and the
|
|
8466
|
+
* placement plan assigns those two independently, so a rebalance that could
|
|
8467
|
+
* only say "recordings" would move footage the plan never asked to move. */
|
|
8468
|
+
profiles: array(string()).optional(),
|
|
8429
8469
|
/** Copy throttle in MB/s (default 40) — the drain is a background chore,
|
|
8430
8470
|
* never allowed to starve live writers. */
|
|
8431
8471
|
throttleMbps: number().min(1).max(1e3).optional()
|
|
@@ -8561,6 +8601,21 @@ var StorageLocationSchema = object({
|
|
|
8561
8601
|
nodeId: string().optional(),
|
|
8562
8602
|
isDefault: boolean().default(false),
|
|
8563
8603
|
isSystem: boolean().default(false),
|
|
8604
|
+
/**
|
|
8605
|
+
* Operator opt-in: whether consumers that BALANCE across several locations
|
|
8606
|
+
* of a type may write here. Recordings reads it today; event media and
|
|
8607
|
+
* backups are the next consumers, which is why the flag lives on the
|
|
8608
|
+
* location rather than in any one addon's store — nothing has to be
|
|
8609
|
+
* extended to add the next consumer.
|
|
8610
|
+
*
|
|
8611
|
+
* OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
|
|
8612
|
+
* flag existed reads back with no flag and keeps working exactly as before;
|
|
8613
|
+
* that is the whole compat story, and it is why no migration ships with it.
|
|
8614
|
+
* A newly CREATED sibling is stamped `false` by the orchestrator (creating a
|
|
8615
|
+
* disk must not silently start writing to it); the default of a type is
|
|
8616
|
+
* always stamped `true`.
|
|
8617
|
+
*/
|
|
8618
|
+
enabled: boolean().optional(),
|
|
8564
8619
|
/** COMPUTED at read time by the orchestrator (statfs of the backing volume
|
|
8565
8620
|
* for node-local locations it can reach) — never persisted, absent when the
|
|
8566
8621
|
* volume is remote/unreachable. The single capacity truth every UI reads. */
|
|
@@ -13130,7 +13185,8 @@ method(object({
|
|
|
13130
13185
|
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
13131
13186
|
/**
|
|
13132
13187
|
* filesystem-browse — per-node capability for browsing the node's local
|
|
13133
|
-
* filesystem
|
|
13188
|
+
* filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
|
|
13189
|
+
* are sandboxed to operator-configured allowed roots (D115). Used by the
|
|
13134
13190
|
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
13135
13191
|
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
13136
13192
|
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
@@ -14971,6 +15027,13 @@ var MaskGridDimsSchema = object({
|
|
|
14971
15027
|
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
14972
15028
|
* this one field keeps the schema additive — a rule still declares exactly
|
|
14973
15029
|
* one trigger.
|
|
15030
|
+
*
|
|
15031
|
+
* AUDIO rules add no member here, for the reason occupancy added none: the
|
|
15032
|
+
* enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
|
|
15033
|
+
* mirror.ts` fails the build on a member the app cannot render) and every
|
|
15034
|
+
* member costs a release train. A sustained-sound rule is therefore an
|
|
15035
|
+
* `immediate` rule carrying {@link NcConditions.audio} — the condition is the
|
|
15036
|
+
* trigger discriminator, exactly as `occupancy` is on `device-event`.
|
|
14974
15037
|
*/
|
|
14975
15038
|
var NcDeliverySchema = _enum([
|
|
14976
15039
|
"immediate",
|
|
@@ -14985,15 +15048,32 @@ var NcDeliverySchema = _enum([
|
|
|
14985
15048
|
* depend on a provider's raw event name or payload shape.
|
|
14986
15049
|
*/
|
|
14987
15050
|
var NcSystemEventKindSchema = _enum([
|
|
14988
|
-
"
|
|
14989
|
-
"
|
|
15051
|
+
"device-online",
|
|
15052
|
+
"device-offline",
|
|
15053
|
+
"device-disabled",
|
|
15054
|
+
"device-enabled",
|
|
14990
15055
|
"stream-online",
|
|
14991
15056
|
"stream-offline",
|
|
14992
15057
|
"node-online",
|
|
14993
15058
|
"node-offline",
|
|
14994
15059
|
"addon-update-available",
|
|
14995
|
-
"server-update-available"
|
|
15060
|
+
"server-update-available",
|
|
15061
|
+
"alarm-triggered",
|
|
15062
|
+
"alarm-armed",
|
|
15063
|
+
"alarm-disarmed",
|
|
15064
|
+
"camera-online",
|
|
15065
|
+
"camera-offline",
|
|
15066
|
+
"camera-disabled",
|
|
15067
|
+
"camera-enabled"
|
|
15068
|
+
]);
|
|
15069
|
+
/** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
|
|
15070
|
+
var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
|
|
15071
|
+
"camera-online",
|
|
15072
|
+
"camera-offline",
|
|
15073
|
+
"camera-disabled",
|
|
15074
|
+
"camera-enabled"
|
|
14996
15075
|
]);
|
|
15076
|
+
NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
|
|
14997
15077
|
/**
|
|
14998
15078
|
* One coherent system-event condition. `kinds` is the required opt-in safety
|
|
14999
15079
|
* gate; the remaining lists are optional narrowing filters relevant to the
|
|
@@ -15002,6 +15082,18 @@ var NcSystemEventKindSchema = _enum([
|
|
|
15002
15082
|
var NcSystemEventConditionSchema = object({
|
|
15003
15083
|
kinds: array(NcSystemEventKindSchema).min(1),
|
|
15004
15084
|
deviceIds: array(number().int()).min(1).optional(),
|
|
15085
|
+
/**
|
|
15086
|
+
* Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
|
|
15087
|
+
* `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
|
|
15088
|
+
* is what a liveness rule means when nobody said otherwise.
|
|
15089
|
+
*
|
|
15090
|
+
* This is where "only my cameras" is expressed, and it lives on the rule for
|
|
15091
|
+
* one reason: the intake cannot know which devices this household cares
|
|
15092
|
+
* about, and a producer-side filter is one no operator can change. Fails
|
|
15093
|
+
* CLOSED — a subject whose device type is unknown (an id the device mirror
|
|
15094
|
+
* does not carry) matches no `deviceTypes` list.
|
|
15095
|
+
*/
|
|
15096
|
+
deviceTypes: array(string().min(1)).min(1).optional(),
|
|
15005
15097
|
nodeIds: array(string().min(1)).min(1).optional(),
|
|
15006
15098
|
packageNames: array(string().min(1)).min(1).optional()
|
|
15007
15099
|
});
|
|
@@ -15052,6 +15144,47 @@ var NcOccupancyConditionSchema = object({
|
|
|
15052
15144
|
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
15053
15145
|
});
|
|
15054
15146
|
/**
|
|
15147
|
+
* Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
|
|
15148
|
+
*
|
|
15149
|
+
* Operator-approved vocabulary (2026-08-12, option A — the same one the
|
|
15150
|
+
* reference notifier uses, so an operator moving between them re-uses what
|
|
15151
|
+
* they already know): a rule matches when, over a sampling window of
|
|
15152
|
+
* `samplingSeconds`, at least `hitPercent`% of the audio samples in that
|
|
15153
|
+
* window are HITS. A sample is a hit when it satisfies BOTH present filters:
|
|
15154
|
+
*
|
|
15155
|
+
* - `dbThreshold` — its level is at or above this many dBFS (see
|
|
15156
|
+
* {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
|
|
15157
|
+
* - `labels` — the classifier put at least one of these labels on it.
|
|
15158
|
+
*
|
|
15159
|
+
* Both are OPTIONAL and independent, which is the point of the shape: a
|
|
15160
|
+
* loudness rule ("something loud at 3am") needs no model to be right, and a
|
|
15161
|
+
* label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
|
|
15162
|
+
* is given** — a window in which every sample is trivially a hit would fire on
|
|
15163
|
+
* silence, so the engine refuses such a condition rather than notifying on
|
|
15164
|
+
* nothing (the schema cannot express "at least one of" without becoming a
|
|
15165
|
+
* ZodEffects the cap path would have to special-case).
|
|
15166
|
+
*
|
|
15167
|
+
* `hitPercent` is over the samples the window actually HOLDS, and the window
|
|
15168
|
+
* must be FULL before it can match — a window that has been open for two
|
|
15169
|
+
* seconds of its ten is 100% of nothing, and firing on it would make
|
|
15170
|
+
* `samplingSeconds` decorative.
|
|
15171
|
+
*
|
|
15172
|
+
* Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
|
|
15173
|
+
* `audio-*` ids). Both spellings are accepted — the matcher normalizes the
|
|
15174
|
+
* `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
|
|
15175
|
+
* an operator who typed `dog` mean the same thing.
|
|
15176
|
+
*/
|
|
15177
|
+
var NcAudioConditionSchema = object({
|
|
15178
|
+
/** Audio macro labels; absent = any sound (level-only rule). */
|
|
15179
|
+
labels: array(string().min(1)).min(1).optional(),
|
|
15180
|
+
/** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
|
|
15181
|
+
dbThreshold: number().min(-96).max(0).optional(),
|
|
15182
|
+
/** Percentage of the window's samples that must be hits (1–100). */
|
|
15183
|
+
hitPercent: number().int().min(1).max(100).default(60),
|
|
15184
|
+
/** Length of the sampling window in seconds. */
|
|
15185
|
+
samplingSeconds: number().int().min(1).max(300).default(10)
|
|
15186
|
+
});
|
|
15187
|
+
/**
|
|
15055
15188
|
* Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
|
|
15056
15189
|
*
|
|
15057
15190
|
* The values are not symmetric, and deliberately so — the absent value has to
|
|
@@ -15324,7 +15457,33 @@ var NcConditionsSchema = object({
|
|
|
15324
15457
|
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
15325
15458
|
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
15326
15459
|
*/
|
|
15327
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
15460
|
+
occupancy: NcOccupancyConditionSchema.optional(),
|
|
15461
|
+
/**
|
|
15462
|
+
* IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
|
|
15463
|
+
* `samplingSeconds` window clear the optional `dbThreshold` and carry one of
|
|
15464
|
+
* the optional `labels`. Fail-closed on missing substrate (no audio samples,
|
|
15465
|
+
* a window that is not full yet, neither filter given). See
|
|
15466
|
+
* {@link NcAudioCondition}.
|
|
15467
|
+
*
|
|
15468
|
+
* Presence of this key is what makes a rule an AUDIO rule: the engine fires
|
|
15469
|
+
* it ONLY on a confirmed audio window, and a rule carrying it never fires on
|
|
15470
|
+
* a detection, a track or a device event (the same fail-closed pairing
|
|
15471
|
+
* `occupancy` has with the `device-event` trigger). That is how audio labels
|
|
15472
|
+
* leave `classes`: an audio rule names its sounds HERE, and the legacy path
|
|
15473
|
+
* (an `immediate` rule naming an `audio-*` class, one notification per
|
|
15474
|
+
* classified sample) stays exactly as it was for rules that already use it.
|
|
15475
|
+
*
|
|
15476
|
+
* NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
|
|
15477
|
+
* rather than an oversight: the viewer mirrors the descriptor enums BY HAND
|
|
15478
|
+
* (`camstack/src/data/notification-center.ts`, guarded by
|
|
15479
|
+
* `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
|
|
15480
|
+
* condition fields it does not know when a rule is saved from the phone.
|
|
15481
|
+
* Publishing an editor for a condition the app cannot round-trip is how an
|
|
15482
|
+
* operator loses a rule's conditions by opening it — so the descriptor, the
|
|
15483
|
+
* admin widget and the viewer mirror land together (P2 + P3), and only then
|
|
15484
|
+
* does an audio rule become authorable.
|
|
15485
|
+
*/
|
|
15486
|
+
audio: NcAudioConditionSchema.optional()
|
|
15328
15487
|
});
|
|
15329
15488
|
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
15330
15489
|
var NcRuleTargetSchema = object({
|
|
@@ -15438,6 +15597,73 @@ var NcThrottleSchema = object({
|
|
|
15438
15597
|
*/
|
|
15439
15598
|
granularity: NcThrottleGranularitySchema.optional()
|
|
15440
15599
|
});
|
|
15600
|
+
/**
|
|
15601
|
+
* How long the confirm gate may hold ONE notification, and how big the picture
|
|
15602
|
+
* it judges may be.
|
|
15603
|
+
*
|
|
15604
|
+
* The clamp is the product decision, not a coincidence of the model: p50 was
|
|
15605
|
+
* 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
|
|
15606
|
+
* arrives after the visitor has gone is not a notification. 448 px was enough
|
|
15607
|
+
* to score 16/16 on the operator's parking scenario — bigger costs latency and
|
|
15608
|
+
* tokens for pixels the model pools away.
|
|
15609
|
+
*/
|
|
15610
|
+
var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
|
|
15611
|
+
var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
|
|
15612
|
+
var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
|
|
15613
|
+
/** Comparison the model's COUNT must satisfy for the notification to fire. */
|
|
15614
|
+
var NcConfirmExpectSchema = object({
|
|
15615
|
+
op: _enum([
|
|
15616
|
+
">=",
|
|
15617
|
+
">",
|
|
15618
|
+
"<=",
|
|
15619
|
+
"<",
|
|
15620
|
+
"=="
|
|
15621
|
+
]),
|
|
15622
|
+
count: number().int().min(0).max(1e3)
|
|
15623
|
+
});
|
|
15624
|
+
/**
|
|
15625
|
+
* AI CONFIRM — a vision model looks at the picture this notification is about
|
|
15626
|
+
* to ship and says whether it agrees with the rule.
|
|
15627
|
+
*
|
|
15628
|
+
* It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
|
|
15629
|
+
* crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
|
|
15630
|
+
* on the operator's phone is not a verdict about this notification.
|
|
15631
|
+
*
|
|
15632
|
+
* FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
|
|
15633
|
+
* whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
|
|
15634
|
+
* the default and every fail-open is COUNTED, because a gate that always fails
|
|
15635
|
+
* open looks in the log exactly like a gate that works.
|
|
15636
|
+
*
|
|
15637
|
+
* Every field is `.optional()` rather than relied on as a Zod default at the
|
|
15638
|
+
* runtime seam: a Zod default does NOT run on the addon→addon cap path (three
|
|
15639
|
+
* production failures in one day), so the gate reads absent as the constant
|
|
15640
|
+
* above rather than trusting a parse it may never have seen.
|
|
15641
|
+
*/
|
|
15642
|
+
var NcConfirmSchema = object({
|
|
15643
|
+
/** Off unless asked for. An absent `confirm` and `enabled:false` are the
|
|
15644
|
+
* same thing, and both mean "deliver exactly as before". */
|
|
15645
|
+
enabled: boolean().default(false),
|
|
15646
|
+
/** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
|
|
15647
|
+
profileId: string().optional(),
|
|
15648
|
+
/**
|
|
15649
|
+
* The operator's question, in his own words. Absent = a question derived
|
|
15650
|
+
* from the rule (its class and its expectation).
|
|
15651
|
+
*
|
|
15652
|
+
* NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
|
|
15653
|
+
* banners, signage and plates as instructions if you let them reach the
|
|
15654
|
+
* prompt — proven live — so the authoritative contract stays in the system
|
|
15655
|
+
* turn and only rule-authored words land here.
|
|
15656
|
+
*/
|
|
15657
|
+
prompt: string().max(1e3).optional(),
|
|
15658
|
+
/** Fire only when the model's count satisfies this. Absent = the model's
|
|
15659
|
+
* own boolean verdict decides. */
|
|
15660
|
+
expect: NcConfirmExpectSchema.optional(),
|
|
15661
|
+
timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
|
|
15662
|
+
/** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
|
|
15663
|
+
onTimeout: _enum(["fire", "suppress"]).default("fire"),
|
|
15664
|
+
/** Longest edge the judged image is downscaled to before it is sent. */
|
|
15665
|
+
maxImagePx: number().int().min(64).max(2048).default(448)
|
|
15666
|
+
});
|
|
15441
15667
|
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
15442
15668
|
var NcRuleInputSchema = object({
|
|
15443
15669
|
name: string().min(1).max(200),
|
|
@@ -15498,7 +15724,13 @@ var NcRuleInputSchema = object({
|
|
|
15498
15724
|
* `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
|
|
15499
15725
|
* shape as every other actuation.
|
|
15500
15726
|
*/
|
|
15501
|
-
actions: NcRuleActionsSchema.optional()
|
|
15727
|
+
actions: NcRuleActionsSchema.optional(),
|
|
15728
|
+
/**
|
|
15729
|
+
* AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
|
|
15730
|
+
* a rule that predates the gate must keep delivering byte-for-byte as it
|
|
15731
|
+
* did, and absent is the only way to say that without a migration.
|
|
15732
|
+
*/
|
|
15733
|
+
confirm: NcConfirmSchema.optional()
|
|
15502
15734
|
});
|
|
15503
15735
|
/**
|
|
15504
15736
|
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
@@ -15509,7 +15741,37 @@ var NcRuleInputSchema = object({
|
|
|
15509
15741
|
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
15510
15742
|
* `updateRule` patch.
|
|
15511
15743
|
*/
|
|
15512
|
-
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
|
|
15744
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
|
|
15745
|
+
disabledTargetIds: array(string()).optional(),
|
|
15746
|
+
/**
|
|
15747
|
+
* `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
|
|
15748
|
+
*
|
|
15749
|
+
* It makes the key optional to SUPPLY; the parse still materialises the
|
|
15750
|
+
* default when the key is absent. And `NcRuleStore.update` merges with
|
|
15751
|
+
* `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
|
|
15752
|
+
* one — which made every partial edit destructive:
|
|
15753
|
+
*
|
|
15754
|
+
* nc.updateRule({ throttle }) → conditions reset to `{}`
|
|
15755
|
+
* nc.setRuleTargetEnabled(...) → conditions reset to `{}`
|
|
15756
|
+
* setEnabled(ruleId, false) → conditions reset to `{}`
|
|
15757
|
+
*
|
|
15758
|
+
* A rule scoped to one camera and one zone silently became a rule that
|
|
15759
|
+
* matches EVERY event on EVERY camera, and lost its `media` policy
|
|
15760
|
+
* (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
|
|
15761
|
+
* live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
|
|
15762
|
+
* within a minute of a two-field patch.
|
|
15763
|
+
*
|
|
15764
|
+
* So every defaulted field is re-declared here WITHOUT its default. The
|
|
15765
|
+
* inner defaults still apply when the caller DOES send the key — `{}` for
|
|
15766
|
+
* conditions remains a real instruction ("clear them") — and only the
|
|
15767
|
+
* absent key is now genuinely absent.
|
|
15768
|
+
*/
|
|
15769
|
+
enabled: boolean().optional(),
|
|
15770
|
+
conditions: NcConditionsSchema.optional(),
|
|
15771
|
+
media: NcMediaPolicySchema.optional(),
|
|
15772
|
+
throttle: NcThrottleSchema.optional(),
|
|
15773
|
+
priority: number().int().min(1).max(5).optional()
|
|
15774
|
+
});
|
|
15513
15775
|
/** A persisted rule. */
|
|
15514
15776
|
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
15515
15777
|
id: string(),
|
|
@@ -15810,6 +16072,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
|
|
|
15810
16072
|
* Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
|
|
15811
16073
|
* copy would lie the first time a rule is disabled.
|
|
15812
16074
|
*/
|
|
16075
|
+
/**
|
|
16076
|
+
* Why a device a mode NAMES is nonetheless not armed by it.
|
|
16077
|
+
*
|
|
16078
|
+
* Each value is an existing authority, never a new flag (D62): `muted` is the
|
|
16079
|
+
* per-camera notification switch the Notification Center already owns,
|
|
16080
|
+
* `detection-off` is the device's own detection binding being inactive, and
|
|
16081
|
+
* `offline` is the device manager's liveness. A fourth reason would mean a
|
|
16082
|
+
* fourth authority, and inventing one here is how a panel starts disagreeing
|
|
16083
|
+
* with the switches the operator actually used.
|
|
16084
|
+
*/
|
|
16085
|
+
var NcAlarmSkipReasonSchema = _enum([
|
|
16086
|
+
"muted",
|
|
16087
|
+
"detection-off",
|
|
16088
|
+
"offline"
|
|
16089
|
+
]);
|
|
16090
|
+
var NcAlarmSkippedDeviceSchema = object({
|
|
16091
|
+
deviceId: number().int(),
|
|
16092
|
+
reason: NcAlarmSkipReasonSchema
|
|
16093
|
+
});
|
|
15813
16094
|
var NcAlarmModeCoverageSchema = object({
|
|
15814
16095
|
mode: AlarmArmModeSchema,
|
|
15815
16096
|
/** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
|
|
@@ -15817,7 +16098,18 @@ var NcAlarmModeCoverageSchema = object({
|
|
|
15817
16098
|
/** At least one covering rule has no device scope, so the mode covers all. */
|
|
15818
16099
|
allDevices: boolean(),
|
|
15819
16100
|
/** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
|
|
15820
|
-
deviceIds: array(number().int())
|
|
16101
|
+
deviceIds: array(number().int()),
|
|
16102
|
+
/**
|
|
16103
|
+
* Devices this mode NAMES but cannot actually arm, each with the switch that
|
|
16104
|
+
* excludes it.
|
|
16105
|
+
*
|
|
16106
|
+
* "Away armed — 12 cameras" is a promise, and a muted camera among those
|
|
16107
|
+
* twelve makes it false in exactly the way nobody notices until an incident.
|
|
16108
|
+
* Defaulted to `[]` so a coverage answer computed before this field existed
|
|
16109
|
+
* still parses as "nothing known to be skipped" rather than failing the whole
|
|
16110
|
+
* alarm tab.
|
|
16111
|
+
*/
|
|
16112
|
+
skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
|
|
15821
16113
|
});
|
|
15822
16114
|
var NcAlarmConfigSchema = object({
|
|
15823
16115
|
/**
|
|
@@ -18649,9 +18941,16 @@ var CameraStatusSchema = object({
|
|
|
18649
18941
|
audio: CameraAudioStatusSchema.nullable(),
|
|
18650
18942
|
recording: CameraRecordingStatusSchema.nullable(),
|
|
18651
18943
|
/**
|
|
18652
|
-
* Per-camera
|
|
18944
|
+
* Per-camera functions an OPERATOR has turned off
|
|
18653
18945
|
* ([D61](../../../../docs/decisions/adr-0067.md)).
|
|
18654
18946
|
*
|
|
18947
|
+
* Composed from the AUTHORITIES themselves — the wrapper bindings,
|
|
18948
|
+
* `RecordingConfig.enabled`, the notification mute, the broker's audio
|
|
18949
|
+
* policy, the camera's own microphone — via `composeSwitchedOff`, not from
|
|
18950
|
+
* the deprecated `getCameraSwitches` group ([D113](../../../../docs/decisions/adr-0113.md)).
|
|
18951
|
+
* The badge outlives the control panel: the panel was a convenience, this is
|
|
18952
|
+
* the difference between a camera being off and a camera being dead.
|
|
18953
|
+
*
|
|
18655
18954
|
* This is the difference between DISABLED and BROKEN. A camera whose
|
|
18656
18955
|
* `detection` block reports zero fps and whose `switchedOff` contains
|
|
18657
18956
|
* `'object-detection'` was switched off by a person; the same camera with an
|
|
@@ -25401,7 +25700,19 @@ var RecordingManifestSchema = object({
|
|
|
25401
25700
|
* profiles/subtrees/locations on this node). */
|
|
25402
25701
|
var RecordingDeviceUsageSchema = object({
|
|
25403
25702
|
deviceId: number(),
|
|
25404
|
-
usedBytes: number()
|
|
25703
|
+
usedBytes: number(),
|
|
25704
|
+
/**
|
|
25705
|
+
* Start of this camera's OLDEST indexed segment, across every profile and
|
|
25706
|
+
* location — the "Oldest footage" column in Recordings → Storage, and the
|
|
25707
|
+
* only honest answer to "is retention actually holding?" per camera.
|
|
25708
|
+
*
|
|
25709
|
+
* `null` = the camera has no footage. OPTIONAL because a recorder that
|
|
25710
|
+
* predates this field omits it entirely, and a hub whose types carry the
|
|
25711
|
+
* field must keep validating that older provider's payload: the framework
|
|
25712
|
+
* (types) and the addon ship on different trains, and the addon is usually
|
|
25713
|
+
* the later of the two.
|
|
25714
|
+
*/
|
|
25715
|
+
oldestMs: number().nullable().optional()
|
|
25405
25716
|
});
|
|
25406
25717
|
/** Recording storage usage + capacity for one storage location. */
|
|
25407
25718
|
var RecordingLocationUsageSchema = object({
|
|
@@ -25429,6 +25740,57 @@ var RecordingStorageUsageSchema = object({
|
|
|
25429
25740
|
locations: array(RecordingLocationUsageSchema)
|
|
25430
25741
|
});
|
|
25431
25742
|
/**
|
|
25743
|
+
* The OPERATOR-ARMED half of multi-location recordings (D116).
|
|
25744
|
+
*
|
|
25745
|
+
* The placement plan decides where NEW writes go and moves nothing. A rebalance
|
|
25746
|
+
* is the operator asking for the EXISTING archive to be brought into line with
|
|
25747
|
+
* that plan: one relocate job per (camera, profile) pile that sits on the wrong
|
|
25748
|
+
* location, run FIFO behind the single-flight mover.
|
|
25749
|
+
*
|
|
25750
|
+
* `plan…` and `start…` return the SAME shape deliberately — what the operator
|
|
25751
|
+
* confirms is exactly what gets enqueued, and `jobIds` is the only difference
|
|
25752
|
+
* (empty on the plan).
|
|
25753
|
+
*/
|
|
25754
|
+
var RecordingRebalanceMoveSchema = object({
|
|
25755
|
+
deviceId: number(),
|
|
25756
|
+
profile: string(),
|
|
25757
|
+
fromLocationId: string(),
|
|
25758
|
+
toLocationId: string(),
|
|
25759
|
+
bytes: number(),
|
|
25760
|
+
files: number().int()
|
|
25761
|
+
});
|
|
25762
|
+
/** Why a pile that is out of place is staying there. Every refusal is
|
|
25763
|
+
* reported: a rebalance that silently drops a camera reads exactly like one
|
|
25764
|
+
* that had nothing to do. */
|
|
25765
|
+
var RecordingRebalanceSkipReasonSchema = _enum([
|
|
25766
|
+
"unassigned",
|
|
25767
|
+
"target-not-writable",
|
|
25768
|
+
"below-threshold",
|
|
25769
|
+
"no-headroom"
|
|
25770
|
+
]);
|
|
25771
|
+
var RecordingRebalanceSkipSchema = object({
|
|
25772
|
+
deviceId: number(),
|
|
25773
|
+
profile: string(),
|
|
25774
|
+
fromLocationId: string(),
|
|
25775
|
+
/** The location the plan wants; null when the camera has no assignment. */
|
|
25776
|
+
toLocationId: string().nullable(),
|
|
25777
|
+
bytes: number(),
|
|
25778
|
+
reason: RecordingRebalanceSkipReasonSchema
|
|
25779
|
+
});
|
|
25780
|
+
var RecordingRebalancePlanSchema = object({
|
|
25781
|
+
moves: array(RecordingRebalanceMoveSchema),
|
|
25782
|
+
skipped: array(RecordingRebalanceSkipSchema),
|
|
25783
|
+
bytesToMove: number(),
|
|
25784
|
+
/** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
|
|
25785
|
+
jobIds: array(string())
|
|
25786
|
+
});
|
|
25787
|
+
var RecordingRebalanceInputSchema = object({
|
|
25788
|
+
/** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
|
|
25789
|
+
throttleMbps: number().min(1).max(1e3).optional(),
|
|
25790
|
+
/** Ignore piles smaller than this (default 1 GB). */
|
|
25791
|
+
minMoveGb: number().min(0).optional()
|
|
25792
|
+
});
|
|
25793
|
+
/**
|
|
25432
25794
|
* Result of locating footage at a wall-clock instant for one device/profile.
|
|
25433
25795
|
* `segment` carries the covering segment's window; `gap` reports the forward
|
|
25434
25796
|
* nearest covered edge (`null` past the end of footage / when none exists)
|
|
@@ -25591,9 +25953,24 @@ method(object({
|
|
|
25591
25953
|
}), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
25592
25954
|
kind: "mutation",
|
|
25593
25955
|
auth: "admin"
|
|
25956
|
+
}), method(RelocateFootageInputSchema, object({ jobId: string() }), {
|
|
25957
|
+
kind: "mutation",
|
|
25958
|
+
auth: "admin"
|
|
25959
|
+
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
25960
|
+
kind: "query",
|
|
25961
|
+
auth: "admin"
|
|
25962
|
+
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
25963
|
+
kind: "mutation",
|
|
25964
|
+
auth: "admin"
|
|
25965
|
+
}), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
|
|
25966
|
+
kind: "query",
|
|
25967
|
+
auth: "admin"
|
|
25968
|
+
}), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
|
|
25969
|
+
kind: "mutation",
|
|
25970
|
+
auth: "admin"
|
|
25594
25971
|
});
|
|
25595
25972
|
/**
|
|
25596
|
-
* `
|
|
25973
|
+
* `recording-export` cap — render a footage time range into a single downloadable
|
|
25597
25974
|
* MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
|
|
25598
25975
|
* bounded lifetime with a durable history, auto-expiry, and optional
|
|
25599
25976
|
* delete-after-download.
|
|
@@ -25608,10 +25985,42 @@ method(object({
|
|
|
25608
25985
|
*/
|
|
25609
25986
|
/** Playback-speed multiplier for the render (1 = realtime). */
|
|
25610
25987
|
var ExportSpeedSchema = number().min(.25).max(32);
|
|
25988
|
+
/**
|
|
25989
|
+
* One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
|
|
25990
|
+
*
|
|
25991
|
+
* Relative and not absolute epoch on purpose: the renderer's frame-select
|
|
25992
|
+
* expression sees ffmpeg's `t`, which starts at 0 for the export's source
|
|
25993
|
+
* playlist. Handing it absolute epochs would make every call site responsible
|
|
25994
|
+
* for the same subtraction, and the one that forgot would emit a filter that
|
|
25995
|
+
* selects nothing — silently, as a uniform timelapse.
|
|
25996
|
+
*/
|
|
25997
|
+
var ExportDenseRangeSchema = object({
|
|
25998
|
+
fromSec: number().nonnegative(),
|
|
25999
|
+
toSec: number().nonnegative()
|
|
26000
|
+
}).refine((r) => r.toSec > r.fromSec, { message: "dense range must have toSec > fromSec" });
|
|
26001
|
+
/**
|
|
26002
|
+
* Dense-interval overlay for a timelapse: sample at `dense.everyMs` INSIDE the
|
|
26003
|
+
* listed ranges and at the base `everyMs` everywhere else.
|
|
26004
|
+
*
|
|
26005
|
+
* `everyMs` must be strictly smaller than the base cadence — a dense rate that
|
|
26006
|
+
* is not denser renders a uniform timelapse the operator believes is two-rate.
|
|
26007
|
+
*/
|
|
26008
|
+
var ExportDenseSchema = object({
|
|
26009
|
+
everyMs: number().int().positive(),
|
|
26010
|
+
ranges: array(ExportDenseRangeSchema).min(1).max(200)
|
|
26011
|
+
});
|
|
25611
26012
|
/** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
|
|
25612
26013
|
var ExportTimelapseSchema = object({
|
|
25613
26014
|
everyMs: number().int().positive(),
|
|
25614
|
-
outputFps: number().int().min(1).max(60).optional()
|
|
26015
|
+
outputFps: number().int().min(1).max(60).optional(),
|
|
26016
|
+
/** Optional second, FASTER rate over the intervals that matter. */
|
|
26017
|
+
dense: ExportDenseSchema.optional()
|
|
26018
|
+
}).superRefine((v, ctx) => {
|
|
26019
|
+
if (v.dense !== void 0 && v.dense.everyMs >= v.everyMs) ctx.addIssue({
|
|
26020
|
+
code: ZodIssueCode.custom,
|
|
26021
|
+
message: "dense.everyMs must be strictly smaller than the base everyMs",
|
|
26022
|
+
path: ["dense", "everyMs"]
|
|
26023
|
+
});
|
|
25615
26024
|
});
|
|
25616
26025
|
/**
|
|
25617
26026
|
* Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
|
|
@@ -25669,6 +26078,19 @@ var ExportDownloadSchema = object({
|
|
|
25669
26078
|
url: string(),
|
|
25670
26079
|
endpoints: array(string())
|
|
25671
26080
|
});
|
|
26081
|
+
/**
|
|
26082
|
+
* A finished export's bytes, inline.
|
|
26083
|
+
*
|
|
26084
|
+
* `bytes` is the DECODED length — the number the caller bounds and logs
|
|
26085
|
+
* against, so nobody has to infer it from the base64 length.
|
|
26086
|
+
*/
|
|
26087
|
+
var ExportBytesSchema = object({
|
|
26088
|
+
base64: string(),
|
|
26089
|
+
contentType: string(),
|
|
26090
|
+
/** Suggested filename, extension included. */
|
|
26091
|
+
name: string(),
|
|
26092
|
+
bytes: number().int().nonnegative()
|
|
26093
|
+
});
|
|
25672
26094
|
method(object({
|
|
25673
26095
|
deviceId: number(),
|
|
25674
26096
|
profile: string(),
|
|
@@ -25693,6 +26115,9 @@ method(object({
|
|
|
25693
26115
|
}), method(object({ exportId: string() }), ExportDownloadSchema, {
|
|
25694
26116
|
kind: "query",
|
|
25695
26117
|
auth: "protected"
|
|
26118
|
+
}), method(object({ exportId: string() }), ExportBytesSchema, {
|
|
26119
|
+
kind: "query",
|
|
26120
|
+
auth: "protected"
|
|
25696
26121
|
});
|
|
25697
26122
|
/**
|
|
25698
26123
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
@@ -32370,6 +32795,12 @@ Object.freeze({
|
|
|
32370
32795
|
addonId: null,
|
|
32371
32796
|
access: "create"
|
|
32372
32797
|
},
|
|
32798
|
+
"recording.cancelRelocateJob": {
|
|
32799
|
+
capName: "recording",
|
|
32800
|
+
capScope: "system",
|
|
32801
|
+
addonId: null,
|
|
32802
|
+
access: "create"
|
|
32803
|
+
},
|
|
32373
32804
|
"recording.cancelStorageMigrationMove": {
|
|
32374
32805
|
capName: "recording",
|
|
32375
32806
|
capScope: "system",
|
|
@@ -32424,6 +32855,12 @@ Object.freeze({
|
|
|
32424
32855
|
addonId: null,
|
|
32425
32856
|
access: "view"
|
|
32426
32857
|
},
|
|
32858
|
+
"recording.listRelocateJobs": {
|
|
32859
|
+
capName: "recording",
|
|
32860
|
+
capScope: "system",
|
|
32861
|
+
addonId: null,
|
|
32862
|
+
access: "view"
|
|
32863
|
+
},
|
|
32427
32864
|
"recording.locateSegment": {
|
|
32428
32865
|
capName: "recording",
|
|
32429
32866
|
capScope: "system",
|
|
@@ -32436,6 +32873,12 @@ Object.freeze({
|
|
|
32436
32873
|
addonId: null,
|
|
32437
32874
|
access: "create"
|
|
32438
32875
|
},
|
|
32876
|
+
"recording.planStorageRebalance": {
|
|
32877
|
+
capName: "recording",
|
|
32878
|
+
capScope: "system",
|
|
32879
|
+
addonId: null,
|
|
32880
|
+
access: "view"
|
|
32881
|
+
},
|
|
32439
32882
|
"recording.pruneFootage": {
|
|
32440
32883
|
capName: "recording",
|
|
32441
32884
|
capScope: "system",
|
|
@@ -32460,6 +32903,12 @@ Object.freeze({
|
|
|
32460
32903
|
addonId: null,
|
|
32461
32904
|
access: "create"
|
|
32462
32905
|
},
|
|
32906
|
+
"recording.relocateFootage": {
|
|
32907
|
+
capName: "recording",
|
|
32908
|
+
capScope: "system",
|
|
32909
|
+
addonId: null,
|
|
32910
|
+
access: "create"
|
|
32911
|
+
},
|
|
32463
32912
|
"recording.renderClip": {
|
|
32464
32913
|
capName: "recording",
|
|
32465
32914
|
capScope: "system",
|
|
@@ -32496,38 +32945,50 @@ Object.freeze({
|
|
|
32496
32945
|
addonId: null,
|
|
32497
32946
|
access: "create"
|
|
32498
32947
|
},
|
|
32948
|
+
"recording.startStorageRebalance": {
|
|
32949
|
+
capName: "recording",
|
|
32950
|
+
capScope: "system",
|
|
32951
|
+
addonId: null,
|
|
32952
|
+
access: "create"
|
|
32953
|
+
},
|
|
32499
32954
|
"recordingExport.cancelExport": {
|
|
32500
|
-
capName: "
|
|
32955
|
+
capName: "recording-export",
|
|
32501
32956
|
capScope: "system",
|
|
32502
32957
|
addonId: null,
|
|
32503
32958
|
access: "create"
|
|
32504
32959
|
},
|
|
32505
32960
|
"recordingExport.createExport": {
|
|
32506
|
-
capName: "
|
|
32961
|
+
capName: "recording-export",
|
|
32507
32962
|
capScope: "system",
|
|
32508
32963
|
addonId: null,
|
|
32509
32964
|
access: "create"
|
|
32510
32965
|
},
|
|
32511
32966
|
"recordingExport.deleteExport": {
|
|
32512
|
-
capName: "
|
|
32967
|
+
capName: "recording-export",
|
|
32513
32968
|
capScope: "system",
|
|
32514
32969
|
addonId: null,
|
|
32515
32970
|
access: "delete"
|
|
32516
32971
|
},
|
|
32517
32972
|
"recordingExport.getDownloadUrl": {
|
|
32518
|
-
capName: "
|
|
32973
|
+
capName: "recording-export",
|
|
32519
32974
|
capScope: "system",
|
|
32520
32975
|
addonId: null,
|
|
32521
32976
|
access: "view"
|
|
32522
32977
|
},
|
|
32523
32978
|
"recordingExport.getExport": {
|
|
32524
|
-
capName: "
|
|
32979
|
+
capName: "recording-export",
|
|
32525
32980
|
capScope: "system",
|
|
32526
32981
|
addonId: null,
|
|
32527
32982
|
access: "view"
|
|
32528
32983
|
},
|
|
32529
32984
|
"recordingExport.listExports": {
|
|
32530
|
-
capName: "
|
|
32985
|
+
capName: "recording-export",
|
|
32986
|
+
capScope: "system",
|
|
32987
|
+
addonId: null,
|
|
32988
|
+
access: "view"
|
|
32989
|
+
},
|
|
32990
|
+
"recordingExport.readExportBytes": {
|
|
32991
|
+
capName: "recording-export",
|
|
32531
32992
|
capScope: "system",
|
|
32532
32993
|
addonId: null,
|
|
32533
32994
|
access: "view"
|
|
@@ -33904,6 +34365,104 @@ var FramerateField = number().int().min(1).max(60);
|
|
|
33904
34365
|
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
33905
34366
|
var PriorityField = number().int().min(1).max(5);
|
|
33906
34367
|
/**
|
|
34368
|
+
* Explicit override of the DENSE sampling cadence, seconds.
|
|
34369
|
+
*
|
|
34370
|
+
* Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
|
|
34371
|
+
* 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
|
|
34372
|
+
* made that same base 3 s and rendered a person pass as two frames.)
|
|
34373
|
+
*
|
|
34374
|
+
* THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
|
|
34375
|
+
* `denseCadenceSec` and played at `framerate` occupies
|
|
34376
|
+
*
|
|
34377
|
+
* outputSeconds = (rangeSec / denseCadenceSec) / framerate
|
|
34378
|
+
*
|
|
34379
|
+
* 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.
|
|
34380
|
+
* Halving this field doubles the frames INSIDE ranges only — the base cadence,
|
|
34381
|
+
* and therefore the length of a quiet night, does not move.
|
|
34382
|
+
*
|
|
34383
|
+
* Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
|
|
34384
|
+
* the recording has them returns the same frames, requested twice. Must be
|
|
34385
|
+
* STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
|
|
34386
|
+
* a uniform video the operator believes is two-rate — and upsert refuses it
|
|
34387
|
+
* rather than letting the export cap reject the render hours after the window.
|
|
34388
|
+
*/
|
|
34389
|
+
var DenseCadenceSecField = number().min(.1).max(3600);
|
|
34390
|
+
/**
|
|
34391
|
+
* Minimum seconds of OUTPUT video each detection range must occupy.
|
|
34392
|
+
*
|
|
34393
|
+
* The operator-facing form of the arithmetic above: instead of solving for a
|
|
34394
|
+
* cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
|
|
34395
|
+
* 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
|
|
34396
|
+
* that range every ~583 ms.
|
|
34397
|
+
*
|
|
34398
|
+
* ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
|
|
34399
|
+
* ranges are terms of a single ffmpeg `select` expression that cannot vary rate
|
|
34400
|
+
* per term — so the MOST DEMANDING (shortest) range sets the rate and longer
|
|
34401
|
+
* ranges are sampled denser than they need. Per-range cadences require a cap
|
|
34402
|
+
* schema change and are the tracked follow-up.
|
|
34403
|
+
*
|
|
34404
|
+
* A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
|
|
34405
|
+
* is rendered with every frame that EXISTS and no more: the guarantee is capped
|
|
34406
|
+
* by real footage, never met by duplicating frames into motion that never
|
|
34407
|
+
* happened.
|
|
34408
|
+
*/
|
|
34409
|
+
var MinDwellSecField = number().min(0).max(60);
|
|
34410
|
+
/**
|
|
34411
|
+
* Caption burned into the notification's preview frame.
|
|
34412
|
+
*
|
|
34413
|
+
* Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
|
|
34414
|
+
* `rule`, `from`, `to`) and rendered by the SAME renderer — a second
|
|
34415
|
+
* templating dialect for one field would be a second thing to explain.
|
|
34416
|
+
*
|
|
34417
|
+
* Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
|
|
34418
|
+
* operator saying "the frame, no caption" — a distinct, reachable answer, and
|
|
34419
|
+
* the reason this is not `.min(1)`.
|
|
34420
|
+
*/
|
|
34421
|
+
var PreviewTextField = string().max(200);
|
|
34422
|
+
/**
|
|
34423
|
+
* Whether the notification's preview is a STILL or a short animation.
|
|
34424
|
+
*
|
|
34425
|
+
* The operator's ask, verbatim: *"inviato come gif o video (come per le altre
|
|
34426
|
+
* rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
|
|
34427
|
+
* night reads better as three seconds of motion than as one frame of it. Both
|
|
34428
|
+
* modes get the SAME treatment (blurred frame, large centred title); `'gif'`
|
|
34429
|
+
* simply applies it to a dozen frames sampled across the render and assembles
|
|
34430
|
+
* them.
|
|
34431
|
+
*
|
|
34432
|
+
* `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
|
|
34433
|
+
* seeks and a palette pass, and no rule that never asked for one should start
|
|
34434
|
+
* paying that on the deploy that shipped it.
|
|
34435
|
+
*
|
|
34436
|
+
* A GIF that cannot be assembled DEGRADES to the still — never to nothing.
|
|
34437
|
+
*/
|
|
34438
|
+
var PreviewModeField = _enum(["image", "gif"]);
|
|
34439
|
+
/**
|
|
34440
|
+
* Which detection classes the notification reports counts for.
|
|
34441
|
+
*
|
|
34442
|
+
* The counts come from the tracks the render ALREADY fetched for its dense-range
|
|
34443
|
+
* plan — no second query — aggregated per class. Absent or empty means "every
|
|
34444
|
+
* class the window actually contained", which is what an operator who never
|
|
34445
|
+
* opened the field wants; a list narrows it (`['person']` on a driveway that
|
|
34446
|
+
* counts cars all night).
|
|
34447
|
+
*
|
|
34448
|
+
* Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
|
|
34449
|
+
* …). An unknown name simply never matches and reports nothing — it is not an
|
|
34450
|
+
* error, because a rule may legitimately name a class this camera's model does
|
|
34451
|
+
* not emit.
|
|
34452
|
+
*
|
|
34453
|
+
* The counts are exposed to {@link TimelapseTemplateSchema} as:
|
|
34454
|
+
* - `{{detections}}` — total over the reported classes
|
|
34455
|
+
* - `{{detectionSummary}}` — `2 persone, 1 veicolo`
|
|
34456
|
+
* - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
|
|
34457
|
+
* one per class, `count_` + the class name
|
|
34458
|
+
*
|
|
34459
|
+
* With NO custom body template the summary is appended to the derived body, and
|
|
34460
|
+
* only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
|
|
34461
|
+
* reads. With a custom template the operator owns every word — nothing is
|
|
34462
|
+
* appended, so `{{detectionSummary}}` is how he asks for it.
|
|
34463
|
+
*/
|
|
34464
|
+
var ReportClassesField = array(string().min(1).max(40)).max(20);
|
|
34465
|
+
/**
|
|
33907
34466
|
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
33908
34467
|
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
33909
34468
|
* here (see the ownership note above).
|
|
@@ -33923,9 +34482,30 @@ var TimelapseRuleInputSchema = object({
|
|
|
33923
34482
|
cadenceSec: CadenceSecField.default(15),
|
|
33924
34483
|
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
33925
34484
|
framerate: FramerateField.default(10),
|
|
34485
|
+
/**
|
|
34486
|
+
* Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
|
|
34487
|
+
* as `max(1s, cadenceSec / 30)`, which is what every rule written before this
|
|
34488
|
+
* field gets.
|
|
34489
|
+
*/
|
|
34490
|
+
denseCadenceSec: DenseCadenceSecField.optional(),
|
|
34491
|
+
/** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
|
|
34492
|
+
minDwellSec: MinDwellSecField.optional(),
|
|
33926
34493
|
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
33927
34494
|
targets: TargetsField,
|
|
33928
34495
|
template: TimelapseTemplateSchema.optional(),
|
|
34496
|
+
/**
|
|
34497
|
+
* Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
|
|
34498
|
+
* and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
|
|
34499
|
+
*
|
|
34500
|
+
* Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
|
|
34501
|
+
* the notification's title/body, and clearing it (`template: null`) must not
|
|
34502
|
+
* silently clear the caption too.
|
|
34503
|
+
*/
|
|
34504
|
+
previewText: PreviewTextField.optional(),
|
|
34505
|
+
/** Still or animation — see {@link PreviewModeField}. */
|
|
34506
|
+
previewMode: PreviewModeField.default("image"),
|
|
34507
|
+
/** Classes the notification counts — see {@link ReportClassesField}. */
|
|
34508
|
+
reportClasses: ReportClassesField.optional(),
|
|
33929
34509
|
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
33930
34510
|
priority: PriorityField.default(3)
|
|
33931
34511
|
});
|
|
@@ -33936,8 +34516,13 @@ object({
|
|
|
33936
34516
|
schedule: NcScheduleSchema.optional(),
|
|
33937
34517
|
cadenceSec: CadenceSecField.optional(),
|
|
33938
34518
|
framerate: FramerateField.optional(),
|
|
34519
|
+
denseCadenceSec: DenseCadenceSecField.optional(),
|
|
34520
|
+
minDwellSec: MinDwellSecField.optional(),
|
|
33939
34521
|
targets: TargetsField.optional(),
|
|
33940
34522
|
template: TimelapseTemplateSchema.nullable().optional(),
|
|
34523
|
+
previewText: PreviewTextField.optional(),
|
|
34524
|
+
previewMode: PreviewModeField.optional(),
|
|
34525
|
+
reportClasses: ReportClassesField.optional(),
|
|
33941
34526
|
priority: PriorityField.optional()
|
|
33942
34527
|
});
|
|
33943
34528
|
TimelapseRuleInputSchema.extend({
|
|
@@ -33949,10 +34534,28 @@ TimelapseRuleInputSchema.extend({
|
|
|
33949
34534
|
*/
|
|
33950
34535
|
ownerUserId: string().optional(),
|
|
33951
34536
|
/**
|
|
33952
|
-
* Epoch-ms of the
|
|
33953
|
-
*
|
|
34537
|
+
* Epoch-ms of the NEWEST successful generation across every camera of this
|
|
34538
|
+
* rule. What a UI shows, and the compatibility floor for
|
|
34539
|
+
* {@link readTimelapseGeneratedAt}. Absent = never generated.
|
|
33954
34540
|
*/
|
|
33955
34541
|
lastGeneratedAt: number().optional(),
|
|
34542
|
+
/**
|
|
34543
|
+
* PER-CAMERA generation state, keyed by `String(deviceId)` — the
|
|
34544
|
+
* re-generation guard's real durable state.
|
|
34545
|
+
*
|
|
34546
|
+
* One rule covers several cameras and each renders its own video, so a rule
|
|
34547
|
+
* -wide stamp is wrong in the direction that DESTROYS work: camera A
|
|
34548
|
+
* succeeding at 06:05 tells camera B, whose render failed, that it is
|
|
34549
|
+
* already done — and B's night is gone for good, because the window will not
|
|
34550
|
+
* come back.
|
|
34551
|
+
*
|
|
34552
|
+
* ADDITIVE, so the migration is free: a row written before this field simply
|
|
34553
|
+
* has no map, and {@link readTimelapseGeneratedAt} falls back to
|
|
34554
|
+
* {@link TimelapseRuleSchema.shape.lastGeneratedAt}. Reading an old row as
|
|
34555
|
+
* "never generated" would re-render and re-notify every camera of every rule
|
|
34556
|
+
* once, on the deploy that shipped the map.
|
|
34557
|
+
*/
|
|
34558
|
+
generatedByDevice: record(string(), number()).optional(),
|
|
33956
34559
|
/** userId of the caller who created the rule (server-stamped). */
|
|
33957
34560
|
createdBy: string(),
|
|
33958
34561
|
createdAt: number(),
|