@camstack/addon-provider-petkit 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
|
@@ -8321,8 +8321,31 @@ var AdoptionJobSchema = object({
|
|
|
8321
8321
|
error: string().nullable()
|
|
8322
8322
|
});
|
|
8323
8323
|
/**
|
|
8324
|
-
* Per-camera FUNCTION SWITCHES
|
|
8325
|
-
*
|
|
8324
|
+
* Per-camera FUNCTION SWITCHES.
|
|
8325
|
+
*
|
|
8326
|
+
* ## The aggregate group is being withdrawn — the BADGE is not (D113)
|
|
8327
|
+
*
|
|
8328
|
+
* This file shipped as "the one coherent on/off surface over the pipeline
|
|
8329
|
+
* functions an operator thinks in terms of". The operator's verdict on
|
|
8330
|
+
* 2026-08-12 was that the coherent surface bought complexity and no clarity:
|
|
8331
|
+
* every function already had a settings page of its own, and a second place to
|
|
8332
|
+
* turn it off is a second place to look. Each switch is going back to its own
|
|
8333
|
+
* component's original options — detection to the detection-pipeline wrapper
|
|
8334
|
+
* binding, audio analysis to its own, recording to `RecordingConfig.enabled`
|
|
8335
|
+
* (which was always first-class; the switch was a veneer over
|
|
8336
|
+
* `recording.setDeviceConfig`), notifications to a notification-center
|
|
8337
|
+
* per-device setting, the two camera planes to their own components.
|
|
8338
|
+
*
|
|
8339
|
+
* What survives is {@link composeSwitchedOff}: `CameraStatus.switchedOff`, the
|
|
8340
|
+
* thing that lets a status surface say DISABLED instead of BROKEN, recomposed
|
|
8341
|
+
* straight from the authorities with no group in the middle. That rule was
|
|
8342
|
+
* never about a control panel.
|
|
8343
|
+
*
|
|
8344
|
+
* Everything else here — {@link CAMERA_SWITCH_CATALOG}, {@link CameraSwitch},
|
|
8345
|
+
* {@link deriveCameraSwitches}, the `pipelineOrchestrator.getCameraSwitches` /
|
|
8346
|
+
* `setCameraSwitch` pair — is a COMPATIBILITY surface for as long as deployed
|
|
8347
|
+
* viewers (v1.0.305) and the admin UI still call it. It is deleted when they
|
|
8348
|
+
* stop; nothing new may be built on it.
|
|
8326
8349
|
*
|
|
8327
8350
|
* ## This file adds no state
|
|
8328
8351
|
*
|
|
@@ -8673,7 +8696,15 @@ var RecordingConfigSchema = object({
|
|
|
8673
8696
|
* Each completed/failed run also lands one durable ops-log row on its owning
|
|
8674
8697
|
* addon surface.
|
|
8675
8698
|
*/
|
|
8699
|
+
/**
|
|
8700
|
+
* `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
|
|
8701
|
+
* rebalance enqueues one job per (camera, profile). Refusing the second job —
|
|
8702
|
+
* what the engine did before — turned a fifteen-camera rebalance into fifteen
|
|
8703
|
+
* manual retries. Queued jobs run FIFO; a queued job that is cancelled never
|
|
8704
|
+
* runs at all.
|
|
8705
|
+
*/
|
|
8676
8706
|
var RelocateJobStateSchema = _enum([
|
|
8707
|
+
"queued",
|
|
8677
8708
|
"running",
|
|
8678
8709
|
"done",
|
|
8679
8710
|
"failed",
|
|
@@ -8708,6 +8739,15 @@ var RelocateFootageInputSchema = object({
|
|
|
8708
8739
|
/** Limits relocation to the logical profile class. Omit only for the
|
|
8709
8740
|
* pre-orchestration compatibility path. */
|
|
8710
8741
|
footageClass: RelocateFootageClassSchema.optional(),
|
|
8742
|
+
/** Scope the move to ONE camera. Absent = every camera on the source, which
|
|
8743
|
+
* is what a whole-disk drain means. The rebalance path always sets it: its
|
|
8744
|
+
* unit is a (camera, profile) pile, not a disk. */
|
|
8745
|
+
deviceId: number().int().optional(),
|
|
8746
|
+
/** Scope the move to specific segment profiles (`high` / `mid` / `low`).
|
|
8747
|
+
* Finer than `footageClass`, which cannot separate high from mid — and the
|
|
8748
|
+
* placement plan assigns those two independently, so a rebalance that could
|
|
8749
|
+
* only say "recordings" would move footage the plan never asked to move. */
|
|
8750
|
+
profiles: array(string()).optional(),
|
|
8711
8751
|
/** Copy throttle in MB/s (default 40) — the drain is a background chore,
|
|
8712
8752
|
* never allowed to starve live writers. */
|
|
8713
8753
|
throttleMbps: number().min(1).max(1e3).optional()
|
|
@@ -8843,6 +8883,21 @@ var StorageLocationSchema = object({
|
|
|
8843
8883
|
nodeId: string().optional(),
|
|
8844
8884
|
isDefault: boolean().default(false),
|
|
8845
8885
|
isSystem: boolean().default(false),
|
|
8886
|
+
/**
|
|
8887
|
+
* Operator opt-in: whether consumers that BALANCE across several locations
|
|
8888
|
+
* of a type may write here. Recordings reads it today; event media and
|
|
8889
|
+
* backups are the next consumers, which is why the flag lives on the
|
|
8890
|
+
* location rather than in any one addon's store — nothing has to be
|
|
8891
|
+
* extended to add the next consumer.
|
|
8892
|
+
*
|
|
8893
|
+
* OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
|
|
8894
|
+
* flag existed reads back with no flag and keeps working exactly as before;
|
|
8895
|
+
* that is the whole compat story, and it is why no migration ships with it.
|
|
8896
|
+
* A newly CREATED sibling is stamped `false` by the orchestrator (creating a
|
|
8897
|
+
* disk must not silently start writing to it); the default of a type is
|
|
8898
|
+
* always stamped `true`.
|
|
8899
|
+
*/
|
|
8900
|
+
enabled: boolean().optional(),
|
|
8846
8901
|
/** COMPUTED at read time by the orchestrator (statfs of the backing volume
|
|
8847
8902
|
* for node-local locations it can reach) — never persisted, absent when the
|
|
8848
8903
|
* volume is remote/unreachable. The single capacity truth every UI reads. */
|
|
@@ -13412,7 +13467,8 @@ method(object({
|
|
|
13412
13467
|
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
13413
13468
|
/**
|
|
13414
13469
|
* filesystem-browse — per-node capability for browsing the node's local
|
|
13415
|
-
* filesystem
|
|
13470
|
+
* filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
|
|
13471
|
+
* are sandboxed to operator-configured allowed roots (D115). Used by the
|
|
13416
13472
|
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
13417
13473
|
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
13418
13474
|
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
@@ -15253,6 +15309,13 @@ var MaskGridDimsSchema = object({
|
|
|
15253
15309
|
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
15254
15310
|
* this one field keeps the schema additive — a rule still declares exactly
|
|
15255
15311
|
* one trigger.
|
|
15312
|
+
*
|
|
15313
|
+
* AUDIO rules add no member here, for the reason occupancy added none: the
|
|
15314
|
+
* enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
|
|
15315
|
+
* mirror.ts` fails the build on a member the app cannot render) and every
|
|
15316
|
+
* member costs a release train. A sustained-sound rule is therefore an
|
|
15317
|
+
* `immediate` rule carrying {@link NcConditions.audio} — the condition is the
|
|
15318
|
+
* trigger discriminator, exactly as `occupancy` is on `device-event`.
|
|
15256
15319
|
*/
|
|
15257
15320
|
var NcDeliverySchema = _enum([
|
|
15258
15321
|
"immediate",
|
|
@@ -15267,15 +15330,32 @@ var NcDeliverySchema = _enum([
|
|
|
15267
15330
|
* depend on a provider's raw event name or payload shape.
|
|
15268
15331
|
*/
|
|
15269
15332
|
var NcSystemEventKindSchema = _enum([
|
|
15270
|
-
"
|
|
15271
|
-
"
|
|
15333
|
+
"device-online",
|
|
15334
|
+
"device-offline",
|
|
15335
|
+
"device-disabled",
|
|
15336
|
+
"device-enabled",
|
|
15272
15337
|
"stream-online",
|
|
15273
15338
|
"stream-offline",
|
|
15274
15339
|
"node-online",
|
|
15275
15340
|
"node-offline",
|
|
15276
15341
|
"addon-update-available",
|
|
15277
|
-
"server-update-available"
|
|
15342
|
+
"server-update-available",
|
|
15343
|
+
"alarm-triggered",
|
|
15344
|
+
"alarm-armed",
|
|
15345
|
+
"alarm-disarmed",
|
|
15346
|
+
"camera-online",
|
|
15347
|
+
"camera-offline",
|
|
15348
|
+
"camera-disabled",
|
|
15349
|
+
"camera-enabled"
|
|
15350
|
+
]);
|
|
15351
|
+
/** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
|
|
15352
|
+
var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
|
|
15353
|
+
"camera-online",
|
|
15354
|
+
"camera-offline",
|
|
15355
|
+
"camera-disabled",
|
|
15356
|
+
"camera-enabled"
|
|
15278
15357
|
]);
|
|
15358
|
+
NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
|
|
15279
15359
|
/**
|
|
15280
15360
|
* One coherent system-event condition. `kinds` is the required opt-in safety
|
|
15281
15361
|
* gate; the remaining lists are optional narrowing filters relevant to the
|
|
@@ -15284,6 +15364,18 @@ var NcSystemEventKindSchema = _enum([
|
|
|
15284
15364
|
var NcSystemEventConditionSchema = object({
|
|
15285
15365
|
kinds: array(NcSystemEventKindSchema).min(1),
|
|
15286
15366
|
deviceIds: array(number().int()).min(1).optional(),
|
|
15367
|
+
/**
|
|
15368
|
+
* Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
|
|
15369
|
+
* `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
|
|
15370
|
+
* is what a liveness rule means when nobody said otherwise.
|
|
15371
|
+
*
|
|
15372
|
+
* This is where "only my cameras" is expressed, and it lives on the rule for
|
|
15373
|
+
* one reason: the intake cannot know which devices this household cares
|
|
15374
|
+
* about, and a producer-side filter is one no operator can change. Fails
|
|
15375
|
+
* CLOSED — a subject whose device type is unknown (an id the device mirror
|
|
15376
|
+
* does not carry) matches no `deviceTypes` list.
|
|
15377
|
+
*/
|
|
15378
|
+
deviceTypes: array(string().min(1)).min(1).optional(),
|
|
15287
15379
|
nodeIds: array(string().min(1)).min(1).optional(),
|
|
15288
15380
|
packageNames: array(string().min(1)).min(1).optional()
|
|
15289
15381
|
});
|
|
@@ -15334,6 +15426,47 @@ var NcOccupancyConditionSchema = object({
|
|
|
15334
15426
|
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
15335
15427
|
});
|
|
15336
15428
|
/**
|
|
15429
|
+
* Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
|
|
15430
|
+
*
|
|
15431
|
+
* Operator-approved vocabulary (2026-08-12, option A — the same one the
|
|
15432
|
+
* reference notifier uses, so an operator moving between them re-uses what
|
|
15433
|
+
* they already know): a rule matches when, over a sampling window of
|
|
15434
|
+
* `samplingSeconds`, at least `hitPercent`% of the audio samples in that
|
|
15435
|
+
* window are HITS. A sample is a hit when it satisfies BOTH present filters:
|
|
15436
|
+
*
|
|
15437
|
+
* - `dbThreshold` — its level is at or above this many dBFS (see
|
|
15438
|
+
* {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
|
|
15439
|
+
* - `labels` — the classifier put at least one of these labels on it.
|
|
15440
|
+
*
|
|
15441
|
+
* Both are OPTIONAL and independent, which is the point of the shape: a
|
|
15442
|
+
* loudness rule ("something loud at 3am") needs no model to be right, and a
|
|
15443
|
+
* label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
|
|
15444
|
+
* is given** — a window in which every sample is trivially a hit would fire on
|
|
15445
|
+
* silence, so the engine refuses such a condition rather than notifying on
|
|
15446
|
+
* nothing (the schema cannot express "at least one of" without becoming a
|
|
15447
|
+
* ZodEffects the cap path would have to special-case).
|
|
15448
|
+
*
|
|
15449
|
+
* `hitPercent` is over the samples the window actually HOLDS, and the window
|
|
15450
|
+
* must be FULL before it can match — a window that has been open for two
|
|
15451
|
+
* seconds of its ten is 100% of nothing, and firing on it would make
|
|
15452
|
+
* `samplingSeconds` decorative.
|
|
15453
|
+
*
|
|
15454
|
+
* Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
|
|
15455
|
+
* `audio-*` ids). Both spellings are accepted — the matcher normalizes the
|
|
15456
|
+
* `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
|
|
15457
|
+
* an operator who typed `dog` mean the same thing.
|
|
15458
|
+
*/
|
|
15459
|
+
var NcAudioConditionSchema = object({
|
|
15460
|
+
/** Audio macro labels; absent = any sound (level-only rule). */
|
|
15461
|
+
labels: array(string().min(1)).min(1).optional(),
|
|
15462
|
+
/** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
|
|
15463
|
+
dbThreshold: number().min(-96).max(0).optional(),
|
|
15464
|
+
/** Percentage of the window's samples that must be hits (1–100). */
|
|
15465
|
+
hitPercent: number().int().min(1).max(100).default(60),
|
|
15466
|
+
/** Length of the sampling window in seconds. */
|
|
15467
|
+
samplingSeconds: number().int().min(1).max(300).default(10)
|
|
15468
|
+
});
|
|
15469
|
+
/**
|
|
15337
15470
|
* Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
|
|
15338
15471
|
*
|
|
15339
15472
|
* The values are not symmetric, and deliberately so — the absent value has to
|
|
@@ -15606,7 +15739,33 @@ var NcConditionsSchema = object({
|
|
|
15606
15739
|
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
15607
15740
|
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
15608
15741
|
*/
|
|
15609
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
15742
|
+
occupancy: NcOccupancyConditionSchema.optional(),
|
|
15743
|
+
/**
|
|
15744
|
+
* IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
|
|
15745
|
+
* `samplingSeconds` window clear the optional `dbThreshold` and carry one of
|
|
15746
|
+
* the optional `labels`. Fail-closed on missing substrate (no audio samples,
|
|
15747
|
+
* a window that is not full yet, neither filter given). See
|
|
15748
|
+
* {@link NcAudioCondition}.
|
|
15749
|
+
*
|
|
15750
|
+
* Presence of this key is what makes a rule an AUDIO rule: the engine fires
|
|
15751
|
+
* it ONLY on a confirmed audio window, and a rule carrying it never fires on
|
|
15752
|
+
* a detection, a track or a device event (the same fail-closed pairing
|
|
15753
|
+
* `occupancy` has with the `device-event` trigger). That is how audio labels
|
|
15754
|
+
* leave `classes`: an audio rule names its sounds HERE, and the legacy path
|
|
15755
|
+
* (an `immediate` rule naming an `audio-*` class, one notification per
|
|
15756
|
+
* classified sample) stays exactly as it was for rules that already use it.
|
|
15757
|
+
*
|
|
15758
|
+
* NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
|
|
15759
|
+
* rather than an oversight: the viewer mirrors the descriptor enums BY HAND
|
|
15760
|
+
* (`camstack/src/data/notification-center.ts`, guarded by
|
|
15761
|
+
* `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
|
|
15762
|
+
* condition fields it does not know when a rule is saved from the phone.
|
|
15763
|
+
* Publishing an editor for a condition the app cannot round-trip is how an
|
|
15764
|
+
* operator loses a rule's conditions by opening it — so the descriptor, the
|
|
15765
|
+
* admin widget and the viewer mirror land together (P2 + P3), and only then
|
|
15766
|
+
* does an audio rule become authorable.
|
|
15767
|
+
*/
|
|
15768
|
+
audio: NcAudioConditionSchema.optional()
|
|
15610
15769
|
});
|
|
15611
15770
|
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
15612
15771
|
var NcRuleTargetSchema = object({
|
|
@@ -15720,6 +15879,73 @@ var NcThrottleSchema = object({
|
|
|
15720
15879
|
*/
|
|
15721
15880
|
granularity: NcThrottleGranularitySchema.optional()
|
|
15722
15881
|
});
|
|
15882
|
+
/**
|
|
15883
|
+
* How long the confirm gate may hold ONE notification, and how big the picture
|
|
15884
|
+
* it judges may be.
|
|
15885
|
+
*
|
|
15886
|
+
* The clamp is the product decision, not a coincidence of the model: p50 was
|
|
15887
|
+
* 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
|
|
15888
|
+
* arrives after the visitor has gone is not a notification. 448 px was enough
|
|
15889
|
+
* to score 16/16 on the operator's parking scenario — bigger costs latency and
|
|
15890
|
+
* tokens for pixels the model pools away.
|
|
15891
|
+
*/
|
|
15892
|
+
var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
|
|
15893
|
+
var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
|
|
15894
|
+
var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
|
|
15895
|
+
/** Comparison the model's COUNT must satisfy for the notification to fire. */
|
|
15896
|
+
var NcConfirmExpectSchema = object({
|
|
15897
|
+
op: _enum([
|
|
15898
|
+
">=",
|
|
15899
|
+
">",
|
|
15900
|
+
"<=",
|
|
15901
|
+
"<",
|
|
15902
|
+
"=="
|
|
15903
|
+
]),
|
|
15904
|
+
count: number().int().min(0).max(1e3)
|
|
15905
|
+
});
|
|
15906
|
+
/**
|
|
15907
|
+
* AI CONFIRM — a vision model looks at the picture this notification is about
|
|
15908
|
+
* to ship and says whether it agrees with the rule.
|
|
15909
|
+
*
|
|
15910
|
+
* It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
|
|
15911
|
+
* crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
|
|
15912
|
+
* on the operator's phone is not a verdict about this notification.
|
|
15913
|
+
*
|
|
15914
|
+
* FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
|
|
15915
|
+
* whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
|
|
15916
|
+
* the default and every fail-open is COUNTED, because a gate that always fails
|
|
15917
|
+
* open looks in the log exactly like a gate that works.
|
|
15918
|
+
*
|
|
15919
|
+
* Every field is `.optional()` rather than relied on as a Zod default at the
|
|
15920
|
+
* runtime seam: a Zod default does NOT run on the addon→addon cap path (three
|
|
15921
|
+
* production failures in one day), so the gate reads absent as the constant
|
|
15922
|
+
* above rather than trusting a parse it may never have seen.
|
|
15923
|
+
*/
|
|
15924
|
+
var NcConfirmSchema = object({
|
|
15925
|
+
/** Off unless asked for. An absent `confirm` and `enabled:false` are the
|
|
15926
|
+
* same thing, and both mean "deliver exactly as before". */
|
|
15927
|
+
enabled: boolean().default(false),
|
|
15928
|
+
/** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
|
|
15929
|
+
profileId: string().optional(),
|
|
15930
|
+
/**
|
|
15931
|
+
* The operator's question, in his own words. Absent = a question derived
|
|
15932
|
+
* from the rule (its class and its expectation).
|
|
15933
|
+
*
|
|
15934
|
+
* NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
|
|
15935
|
+
* banners, signage and plates as instructions if you let them reach the
|
|
15936
|
+
* prompt — proven live — so the authoritative contract stays in the system
|
|
15937
|
+
* turn and only rule-authored words land here.
|
|
15938
|
+
*/
|
|
15939
|
+
prompt: string().max(1e3).optional(),
|
|
15940
|
+
/** Fire only when the model's count satisfies this. Absent = the model's
|
|
15941
|
+
* own boolean verdict decides. */
|
|
15942
|
+
expect: NcConfirmExpectSchema.optional(),
|
|
15943
|
+
timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
|
|
15944
|
+
/** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
|
|
15945
|
+
onTimeout: _enum(["fire", "suppress"]).default("fire"),
|
|
15946
|
+
/** Longest edge the judged image is downscaled to before it is sent. */
|
|
15947
|
+
maxImagePx: number().int().min(64).max(2048).default(448)
|
|
15948
|
+
});
|
|
15723
15949
|
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
15724
15950
|
var NcRuleInputSchema = object({
|
|
15725
15951
|
name: string().min(1).max(200),
|
|
@@ -15780,7 +16006,13 @@ var NcRuleInputSchema = object({
|
|
|
15780
16006
|
* `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
|
|
15781
16007
|
* shape as every other actuation.
|
|
15782
16008
|
*/
|
|
15783
|
-
actions: NcRuleActionsSchema.optional()
|
|
16009
|
+
actions: NcRuleActionsSchema.optional(),
|
|
16010
|
+
/**
|
|
16011
|
+
* AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
|
|
16012
|
+
* a rule that predates the gate must keep delivering byte-for-byte as it
|
|
16013
|
+
* did, and absent is the only way to say that without a migration.
|
|
16014
|
+
*/
|
|
16015
|
+
confirm: NcConfirmSchema.optional()
|
|
15784
16016
|
});
|
|
15785
16017
|
/**
|
|
15786
16018
|
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
@@ -15791,7 +16023,37 @@ var NcRuleInputSchema = object({
|
|
|
15791
16023
|
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
15792
16024
|
* `updateRule` patch.
|
|
15793
16025
|
*/
|
|
15794
|
-
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
|
|
16026
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
|
|
16027
|
+
disabledTargetIds: array(string()).optional(),
|
|
16028
|
+
/**
|
|
16029
|
+
* `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
|
|
16030
|
+
*
|
|
16031
|
+
* It makes the key optional to SUPPLY; the parse still materialises the
|
|
16032
|
+
* default when the key is absent. And `NcRuleStore.update` merges with
|
|
16033
|
+
* `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
|
|
16034
|
+
* one — which made every partial edit destructive:
|
|
16035
|
+
*
|
|
16036
|
+
* nc.updateRule({ throttle }) → conditions reset to `{}`
|
|
16037
|
+
* nc.setRuleTargetEnabled(...) → conditions reset to `{}`
|
|
16038
|
+
* setEnabled(ruleId, false) → conditions reset to `{}`
|
|
16039
|
+
*
|
|
16040
|
+
* A rule scoped to one camera and one zone silently became a rule that
|
|
16041
|
+
* matches EVERY event on EVERY camera, and lost its `media` policy
|
|
16042
|
+
* (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
|
|
16043
|
+
* live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
|
|
16044
|
+
* within a minute of a two-field patch.
|
|
16045
|
+
*
|
|
16046
|
+
* So every defaulted field is re-declared here WITHOUT its default. The
|
|
16047
|
+
* inner defaults still apply when the caller DOES send the key — `{}` for
|
|
16048
|
+
* conditions remains a real instruction ("clear them") — and only the
|
|
16049
|
+
* absent key is now genuinely absent.
|
|
16050
|
+
*/
|
|
16051
|
+
enabled: boolean().optional(),
|
|
16052
|
+
conditions: NcConditionsSchema.optional(),
|
|
16053
|
+
media: NcMediaPolicySchema.optional(),
|
|
16054
|
+
throttle: NcThrottleSchema.optional(),
|
|
16055
|
+
priority: number().int().min(1).max(5).optional()
|
|
16056
|
+
});
|
|
15795
16057
|
/** A persisted rule. */
|
|
15796
16058
|
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
15797
16059
|
id: string(),
|
|
@@ -16092,6 +16354,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
|
|
|
16092
16354
|
* Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
|
|
16093
16355
|
* copy would lie the first time a rule is disabled.
|
|
16094
16356
|
*/
|
|
16357
|
+
/**
|
|
16358
|
+
* Why a device a mode NAMES is nonetheless not armed by it.
|
|
16359
|
+
*
|
|
16360
|
+
* Each value is an existing authority, never a new flag (D62): `muted` is the
|
|
16361
|
+
* per-camera notification switch the Notification Center already owns,
|
|
16362
|
+
* `detection-off` is the device's own detection binding being inactive, and
|
|
16363
|
+
* `offline` is the device manager's liveness. A fourth reason would mean a
|
|
16364
|
+
* fourth authority, and inventing one here is how a panel starts disagreeing
|
|
16365
|
+
* with the switches the operator actually used.
|
|
16366
|
+
*/
|
|
16367
|
+
var NcAlarmSkipReasonSchema = _enum([
|
|
16368
|
+
"muted",
|
|
16369
|
+
"detection-off",
|
|
16370
|
+
"offline"
|
|
16371
|
+
]);
|
|
16372
|
+
var NcAlarmSkippedDeviceSchema = object({
|
|
16373
|
+
deviceId: number().int(),
|
|
16374
|
+
reason: NcAlarmSkipReasonSchema
|
|
16375
|
+
});
|
|
16095
16376
|
var NcAlarmModeCoverageSchema = object({
|
|
16096
16377
|
mode: AlarmArmModeSchema,
|
|
16097
16378
|
/** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
|
|
@@ -16099,7 +16380,18 @@ var NcAlarmModeCoverageSchema = object({
|
|
|
16099
16380
|
/** At least one covering rule has no device scope, so the mode covers all. */
|
|
16100
16381
|
allDevices: boolean(),
|
|
16101
16382
|
/** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
|
|
16102
|
-
deviceIds: array(number().int())
|
|
16383
|
+
deviceIds: array(number().int()),
|
|
16384
|
+
/**
|
|
16385
|
+
* Devices this mode NAMES but cannot actually arm, each with the switch that
|
|
16386
|
+
* excludes it.
|
|
16387
|
+
*
|
|
16388
|
+
* "Away armed — 12 cameras" is a promise, and a muted camera among those
|
|
16389
|
+
* twelve makes it false in exactly the way nobody notices until an incident.
|
|
16390
|
+
* Defaulted to `[]` so a coverage answer computed before this field existed
|
|
16391
|
+
* still parses as "nothing known to be skipped" rather than failing the whole
|
|
16392
|
+
* alarm tab.
|
|
16393
|
+
*/
|
|
16394
|
+
skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
|
|
16103
16395
|
});
|
|
16104
16396
|
var NcAlarmConfigSchema = object({
|
|
16105
16397
|
/**
|
|
@@ -18931,9 +19223,16 @@ var CameraStatusSchema = object({
|
|
|
18931
19223
|
audio: CameraAudioStatusSchema.nullable(),
|
|
18932
19224
|
recording: CameraRecordingStatusSchema.nullable(),
|
|
18933
19225
|
/**
|
|
18934
|
-
* Per-camera
|
|
19226
|
+
* Per-camera functions an OPERATOR has turned off
|
|
18935
19227
|
* ([D61](../../../../docs/decisions/adr-0067.md)).
|
|
18936
19228
|
*
|
|
19229
|
+
* Composed from the AUTHORITIES themselves — the wrapper bindings,
|
|
19230
|
+
* `RecordingConfig.enabled`, the notification mute, the broker's audio
|
|
19231
|
+
* policy, the camera's own microphone — via `composeSwitchedOff`, not from
|
|
19232
|
+
* the deprecated `getCameraSwitches` group ([D113](../../../../docs/decisions/adr-0113.md)).
|
|
19233
|
+
* The badge outlives the control panel: the panel was a convenience, this is
|
|
19234
|
+
* the difference between a camera being off and a camera being dead.
|
|
19235
|
+
*
|
|
18937
19236
|
* This is the difference between DISABLED and BROKEN. A camera whose
|
|
18938
19237
|
* `detection` block reports zero fps and whose `switchedOff` contains
|
|
18939
19238
|
* `'object-detection'` was switched off by a person; the same camera with an
|
|
@@ -25683,7 +25982,19 @@ var RecordingManifestSchema = object({
|
|
|
25683
25982
|
* profiles/subtrees/locations on this node). */
|
|
25684
25983
|
var RecordingDeviceUsageSchema = object({
|
|
25685
25984
|
deviceId: number(),
|
|
25686
|
-
usedBytes: number()
|
|
25985
|
+
usedBytes: number(),
|
|
25986
|
+
/**
|
|
25987
|
+
* Start of this camera's OLDEST indexed segment, across every profile and
|
|
25988
|
+
* location — the "Oldest footage" column in Recordings → Storage, and the
|
|
25989
|
+
* only honest answer to "is retention actually holding?" per camera.
|
|
25990
|
+
*
|
|
25991
|
+
* `null` = the camera has no footage. OPTIONAL because a recorder that
|
|
25992
|
+
* predates this field omits it entirely, and a hub whose types carry the
|
|
25993
|
+
* field must keep validating that older provider's payload: the framework
|
|
25994
|
+
* (types) and the addon ship on different trains, and the addon is usually
|
|
25995
|
+
* the later of the two.
|
|
25996
|
+
*/
|
|
25997
|
+
oldestMs: number().nullable().optional()
|
|
25687
25998
|
});
|
|
25688
25999
|
/** Recording storage usage + capacity for one storage location. */
|
|
25689
26000
|
var RecordingLocationUsageSchema = object({
|
|
@@ -25711,6 +26022,57 @@ var RecordingStorageUsageSchema = object({
|
|
|
25711
26022
|
locations: array(RecordingLocationUsageSchema)
|
|
25712
26023
|
});
|
|
25713
26024
|
/**
|
|
26025
|
+
* The OPERATOR-ARMED half of multi-location recordings (D116).
|
|
26026
|
+
*
|
|
26027
|
+
* The placement plan decides where NEW writes go and moves nothing. A rebalance
|
|
26028
|
+
* is the operator asking for the EXISTING archive to be brought into line with
|
|
26029
|
+
* that plan: one relocate job per (camera, profile) pile that sits on the wrong
|
|
26030
|
+
* location, run FIFO behind the single-flight mover.
|
|
26031
|
+
*
|
|
26032
|
+
* `plan…` and `start…` return the SAME shape deliberately — what the operator
|
|
26033
|
+
* confirms is exactly what gets enqueued, and `jobIds` is the only difference
|
|
26034
|
+
* (empty on the plan).
|
|
26035
|
+
*/
|
|
26036
|
+
var RecordingRebalanceMoveSchema = object({
|
|
26037
|
+
deviceId: number(),
|
|
26038
|
+
profile: string(),
|
|
26039
|
+
fromLocationId: string(),
|
|
26040
|
+
toLocationId: string(),
|
|
26041
|
+
bytes: number(),
|
|
26042
|
+
files: number().int()
|
|
26043
|
+
});
|
|
26044
|
+
/** Why a pile that is out of place is staying there. Every refusal is
|
|
26045
|
+
* reported: a rebalance that silently drops a camera reads exactly like one
|
|
26046
|
+
* that had nothing to do. */
|
|
26047
|
+
var RecordingRebalanceSkipReasonSchema = _enum([
|
|
26048
|
+
"unassigned",
|
|
26049
|
+
"target-not-writable",
|
|
26050
|
+
"below-threshold",
|
|
26051
|
+
"no-headroom"
|
|
26052
|
+
]);
|
|
26053
|
+
var RecordingRebalanceSkipSchema = object({
|
|
26054
|
+
deviceId: number(),
|
|
26055
|
+
profile: string(),
|
|
26056
|
+
fromLocationId: string(),
|
|
26057
|
+
/** The location the plan wants; null when the camera has no assignment. */
|
|
26058
|
+
toLocationId: string().nullable(),
|
|
26059
|
+
bytes: number(),
|
|
26060
|
+
reason: RecordingRebalanceSkipReasonSchema
|
|
26061
|
+
});
|
|
26062
|
+
var RecordingRebalancePlanSchema = object({
|
|
26063
|
+
moves: array(RecordingRebalanceMoveSchema),
|
|
26064
|
+
skipped: array(RecordingRebalanceSkipSchema),
|
|
26065
|
+
bytesToMove: number(),
|
|
26066
|
+
/** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
|
|
26067
|
+
jobIds: array(string())
|
|
26068
|
+
});
|
|
26069
|
+
var RecordingRebalanceInputSchema = object({
|
|
26070
|
+
/** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
|
|
26071
|
+
throttleMbps: number().min(1).max(1e3).optional(),
|
|
26072
|
+
/** Ignore piles smaller than this (default 1 GB). */
|
|
26073
|
+
minMoveGb: number().min(0).optional()
|
|
26074
|
+
});
|
|
26075
|
+
/**
|
|
25714
26076
|
* Result of locating footage at a wall-clock instant for one device/profile.
|
|
25715
26077
|
* `segment` carries the covering segment's window; `gap` reports the forward
|
|
25716
26078
|
* nearest covered edge (`null` past the end of footage / when none exists)
|
|
@@ -25873,9 +26235,24 @@ method(object({
|
|
|
25873
26235
|
}), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
25874
26236
|
kind: "mutation",
|
|
25875
26237
|
auth: "admin"
|
|
26238
|
+
}), method(RelocateFootageInputSchema, object({ jobId: string() }), {
|
|
26239
|
+
kind: "mutation",
|
|
26240
|
+
auth: "admin"
|
|
26241
|
+
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
26242
|
+
kind: "query",
|
|
26243
|
+
auth: "admin"
|
|
26244
|
+
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
26245
|
+
kind: "mutation",
|
|
26246
|
+
auth: "admin"
|
|
26247
|
+
}), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
|
|
26248
|
+
kind: "query",
|
|
26249
|
+
auth: "admin"
|
|
26250
|
+
}), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
|
|
26251
|
+
kind: "mutation",
|
|
26252
|
+
auth: "admin"
|
|
25876
26253
|
});
|
|
25877
26254
|
/**
|
|
25878
|
-
* `
|
|
26255
|
+
* `recording-export` cap — render a footage time range into a single downloadable
|
|
25879
26256
|
* MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
|
|
25880
26257
|
* bounded lifetime with a durable history, auto-expiry, and optional
|
|
25881
26258
|
* delete-after-download.
|
|
@@ -25890,10 +26267,42 @@ method(object({
|
|
|
25890
26267
|
*/
|
|
25891
26268
|
/** Playback-speed multiplier for the render (1 = realtime). */
|
|
25892
26269
|
var ExportSpeedSchema = number().min(.25).max(32);
|
|
26270
|
+
/**
|
|
26271
|
+
* One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
|
|
26272
|
+
*
|
|
26273
|
+
* Relative and not absolute epoch on purpose: the renderer's frame-select
|
|
26274
|
+
* expression sees ffmpeg's `t`, which starts at 0 for the export's source
|
|
26275
|
+
* playlist. Handing it absolute epochs would make every call site responsible
|
|
26276
|
+
* for the same subtraction, and the one that forgot would emit a filter that
|
|
26277
|
+
* selects nothing — silently, as a uniform timelapse.
|
|
26278
|
+
*/
|
|
26279
|
+
var ExportDenseRangeSchema = object({
|
|
26280
|
+
fromSec: number().nonnegative(),
|
|
26281
|
+
toSec: number().nonnegative()
|
|
26282
|
+
}).refine((r) => r.toSec > r.fromSec, { message: "dense range must have toSec > fromSec" });
|
|
26283
|
+
/**
|
|
26284
|
+
* Dense-interval overlay for a timelapse: sample at `dense.everyMs` INSIDE the
|
|
26285
|
+
* listed ranges and at the base `everyMs` everywhere else.
|
|
26286
|
+
*
|
|
26287
|
+
* `everyMs` must be strictly smaller than the base cadence — a dense rate that
|
|
26288
|
+
* is not denser renders a uniform timelapse the operator believes is two-rate.
|
|
26289
|
+
*/
|
|
26290
|
+
var ExportDenseSchema = object({
|
|
26291
|
+
everyMs: number().int().positive(),
|
|
26292
|
+
ranges: array(ExportDenseRangeSchema).min(1).max(200)
|
|
26293
|
+
});
|
|
25893
26294
|
/** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
|
|
25894
26295
|
var ExportTimelapseSchema = object({
|
|
25895
26296
|
everyMs: number().int().positive(),
|
|
25896
|
-
outputFps: number().int().min(1).max(60).optional()
|
|
26297
|
+
outputFps: number().int().min(1).max(60).optional(),
|
|
26298
|
+
/** Optional second, FASTER rate over the intervals that matter. */
|
|
26299
|
+
dense: ExportDenseSchema.optional()
|
|
26300
|
+
}).superRefine((v, ctx) => {
|
|
26301
|
+
if (v.dense !== void 0 && v.dense.everyMs >= v.everyMs) ctx.addIssue({
|
|
26302
|
+
code: ZodIssueCode.custom,
|
|
26303
|
+
message: "dense.everyMs must be strictly smaller than the base everyMs",
|
|
26304
|
+
path: ["dense", "everyMs"]
|
|
26305
|
+
});
|
|
25897
26306
|
});
|
|
25898
26307
|
/**
|
|
25899
26308
|
* Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
|
|
@@ -25951,6 +26360,19 @@ var ExportDownloadSchema = object({
|
|
|
25951
26360
|
url: string(),
|
|
25952
26361
|
endpoints: array(string())
|
|
25953
26362
|
});
|
|
26363
|
+
/**
|
|
26364
|
+
* A finished export's bytes, inline.
|
|
26365
|
+
*
|
|
26366
|
+
* `bytes` is the DECODED length — the number the caller bounds and logs
|
|
26367
|
+
* against, so nobody has to infer it from the base64 length.
|
|
26368
|
+
*/
|
|
26369
|
+
var ExportBytesSchema = object({
|
|
26370
|
+
base64: string(),
|
|
26371
|
+
contentType: string(),
|
|
26372
|
+
/** Suggested filename, extension included. */
|
|
26373
|
+
name: string(),
|
|
26374
|
+
bytes: number().int().nonnegative()
|
|
26375
|
+
});
|
|
25954
26376
|
method(object({
|
|
25955
26377
|
deviceId: number(),
|
|
25956
26378
|
profile: string(),
|
|
@@ -25975,6 +26397,9 @@ method(object({
|
|
|
25975
26397
|
}), method(object({ exportId: string() }), ExportDownloadSchema, {
|
|
25976
26398
|
kind: "query",
|
|
25977
26399
|
auth: "protected"
|
|
26400
|
+
}), method(object({ exportId: string() }), ExportBytesSchema, {
|
|
26401
|
+
kind: "query",
|
|
26402
|
+
auth: "protected"
|
|
25978
26403
|
});
|
|
25979
26404
|
/**
|
|
25980
26405
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
@@ -32652,6 +33077,12 @@ Object.freeze({
|
|
|
32652
33077
|
addonId: null,
|
|
32653
33078
|
access: "create"
|
|
32654
33079
|
},
|
|
33080
|
+
"recording.cancelRelocateJob": {
|
|
33081
|
+
capName: "recording",
|
|
33082
|
+
capScope: "system",
|
|
33083
|
+
addonId: null,
|
|
33084
|
+
access: "create"
|
|
33085
|
+
},
|
|
32655
33086
|
"recording.cancelStorageMigrationMove": {
|
|
32656
33087
|
capName: "recording",
|
|
32657
33088
|
capScope: "system",
|
|
@@ -32706,6 +33137,12 @@ Object.freeze({
|
|
|
32706
33137
|
addonId: null,
|
|
32707
33138
|
access: "view"
|
|
32708
33139
|
},
|
|
33140
|
+
"recording.listRelocateJobs": {
|
|
33141
|
+
capName: "recording",
|
|
33142
|
+
capScope: "system",
|
|
33143
|
+
addonId: null,
|
|
33144
|
+
access: "view"
|
|
33145
|
+
},
|
|
32709
33146
|
"recording.locateSegment": {
|
|
32710
33147
|
capName: "recording",
|
|
32711
33148
|
capScope: "system",
|
|
@@ -32718,6 +33155,12 @@ Object.freeze({
|
|
|
32718
33155
|
addonId: null,
|
|
32719
33156
|
access: "create"
|
|
32720
33157
|
},
|
|
33158
|
+
"recording.planStorageRebalance": {
|
|
33159
|
+
capName: "recording",
|
|
33160
|
+
capScope: "system",
|
|
33161
|
+
addonId: null,
|
|
33162
|
+
access: "view"
|
|
33163
|
+
},
|
|
32721
33164
|
"recording.pruneFootage": {
|
|
32722
33165
|
capName: "recording",
|
|
32723
33166
|
capScope: "system",
|
|
@@ -32742,6 +33185,12 @@ Object.freeze({
|
|
|
32742
33185
|
addonId: null,
|
|
32743
33186
|
access: "create"
|
|
32744
33187
|
},
|
|
33188
|
+
"recording.relocateFootage": {
|
|
33189
|
+
capName: "recording",
|
|
33190
|
+
capScope: "system",
|
|
33191
|
+
addonId: null,
|
|
33192
|
+
access: "create"
|
|
33193
|
+
},
|
|
32745
33194
|
"recording.renderClip": {
|
|
32746
33195
|
capName: "recording",
|
|
32747
33196
|
capScope: "system",
|
|
@@ -32778,38 +33227,50 @@ Object.freeze({
|
|
|
32778
33227
|
addonId: null,
|
|
32779
33228
|
access: "create"
|
|
32780
33229
|
},
|
|
33230
|
+
"recording.startStorageRebalance": {
|
|
33231
|
+
capName: "recording",
|
|
33232
|
+
capScope: "system",
|
|
33233
|
+
addonId: null,
|
|
33234
|
+
access: "create"
|
|
33235
|
+
},
|
|
32781
33236
|
"recordingExport.cancelExport": {
|
|
32782
|
-
capName: "
|
|
33237
|
+
capName: "recording-export",
|
|
32783
33238
|
capScope: "system",
|
|
32784
33239
|
addonId: null,
|
|
32785
33240
|
access: "create"
|
|
32786
33241
|
},
|
|
32787
33242
|
"recordingExport.createExport": {
|
|
32788
|
-
capName: "
|
|
33243
|
+
capName: "recording-export",
|
|
32789
33244
|
capScope: "system",
|
|
32790
33245
|
addonId: null,
|
|
32791
33246
|
access: "create"
|
|
32792
33247
|
},
|
|
32793
33248
|
"recordingExport.deleteExport": {
|
|
32794
|
-
capName: "
|
|
33249
|
+
capName: "recording-export",
|
|
32795
33250
|
capScope: "system",
|
|
32796
33251
|
addonId: null,
|
|
32797
33252
|
access: "delete"
|
|
32798
33253
|
},
|
|
32799
33254
|
"recordingExport.getDownloadUrl": {
|
|
32800
|
-
capName: "
|
|
33255
|
+
capName: "recording-export",
|
|
32801
33256
|
capScope: "system",
|
|
32802
33257
|
addonId: null,
|
|
32803
33258
|
access: "view"
|
|
32804
33259
|
},
|
|
32805
33260
|
"recordingExport.getExport": {
|
|
32806
|
-
capName: "
|
|
33261
|
+
capName: "recording-export",
|
|
32807
33262
|
capScope: "system",
|
|
32808
33263
|
addonId: null,
|
|
32809
33264
|
access: "view"
|
|
32810
33265
|
},
|
|
32811
33266
|
"recordingExport.listExports": {
|
|
32812
|
-
capName: "
|
|
33267
|
+
capName: "recording-export",
|
|
33268
|
+
capScope: "system",
|
|
33269
|
+
addonId: null,
|
|
33270
|
+
access: "view"
|
|
33271
|
+
},
|
|
33272
|
+
"recordingExport.readExportBytes": {
|
|
33273
|
+
capName: "recording-export",
|
|
32813
33274
|
capScope: "system",
|
|
32814
33275
|
addonId: null,
|
|
32815
33276
|
access: "view"
|
|
@@ -34186,6 +34647,104 @@ var FramerateField = number().int().min(1).max(60);
|
|
|
34186
34647
|
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
34187
34648
|
var PriorityField = number().int().min(1).max(5);
|
|
34188
34649
|
/**
|
|
34650
|
+
* Explicit override of the DENSE sampling cadence, seconds.
|
|
34651
|
+
*
|
|
34652
|
+
* Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
|
|
34653
|
+
* 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
|
|
34654
|
+
* made that same base 3 s and rendered a person pass as two frames.)
|
|
34655
|
+
*
|
|
34656
|
+
* THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
|
|
34657
|
+
* `denseCadenceSec` and played at `framerate` occupies
|
|
34658
|
+
*
|
|
34659
|
+
* outputSeconds = (rangeSec / denseCadenceSec) / framerate
|
|
34660
|
+
*
|
|
34661
|
+
* 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.
|
|
34662
|
+
* Halving this field doubles the frames INSIDE ranges only — the base cadence,
|
|
34663
|
+
* and therefore the length of a quiet night, does not move.
|
|
34664
|
+
*
|
|
34665
|
+
* Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
|
|
34666
|
+
* the recording has them returns the same frames, requested twice. Must be
|
|
34667
|
+
* STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
|
|
34668
|
+
* a uniform video the operator believes is two-rate — and upsert refuses it
|
|
34669
|
+
* rather than letting the export cap reject the render hours after the window.
|
|
34670
|
+
*/
|
|
34671
|
+
var DenseCadenceSecField = number().min(.1).max(3600);
|
|
34672
|
+
/**
|
|
34673
|
+
* Minimum seconds of OUTPUT video each detection range must occupy.
|
|
34674
|
+
*
|
|
34675
|
+
* The operator-facing form of the arithmetic above: instead of solving for a
|
|
34676
|
+
* cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
|
|
34677
|
+
* 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
|
|
34678
|
+
* that range every ~583 ms.
|
|
34679
|
+
*
|
|
34680
|
+
* ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
|
|
34681
|
+
* ranges are terms of a single ffmpeg `select` expression that cannot vary rate
|
|
34682
|
+
* per term — so the MOST DEMANDING (shortest) range sets the rate and longer
|
|
34683
|
+
* ranges are sampled denser than they need. Per-range cadences require a cap
|
|
34684
|
+
* schema change and are the tracked follow-up.
|
|
34685
|
+
*
|
|
34686
|
+
* A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
|
|
34687
|
+
* is rendered with every frame that EXISTS and no more: the guarantee is capped
|
|
34688
|
+
* by real footage, never met by duplicating frames into motion that never
|
|
34689
|
+
* happened.
|
|
34690
|
+
*/
|
|
34691
|
+
var MinDwellSecField = number().min(0).max(60);
|
|
34692
|
+
/**
|
|
34693
|
+
* Caption burned into the notification's preview frame.
|
|
34694
|
+
*
|
|
34695
|
+
* Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
|
|
34696
|
+
* `rule`, `from`, `to`) and rendered by the SAME renderer — a second
|
|
34697
|
+
* templating dialect for one field would be a second thing to explain.
|
|
34698
|
+
*
|
|
34699
|
+
* Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
|
|
34700
|
+
* operator saying "the frame, no caption" — a distinct, reachable answer, and
|
|
34701
|
+
* the reason this is not `.min(1)`.
|
|
34702
|
+
*/
|
|
34703
|
+
var PreviewTextField = string().max(200);
|
|
34704
|
+
/**
|
|
34705
|
+
* Whether the notification's preview is a STILL or a short animation.
|
|
34706
|
+
*
|
|
34707
|
+
* The operator's ask, verbatim: *"inviato come gif o video (come per le altre
|
|
34708
|
+
* rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
|
|
34709
|
+
* night reads better as three seconds of motion than as one frame of it. Both
|
|
34710
|
+
* modes get the SAME treatment (blurred frame, large centred title); `'gif'`
|
|
34711
|
+
* simply applies it to a dozen frames sampled across the render and assembles
|
|
34712
|
+
* them.
|
|
34713
|
+
*
|
|
34714
|
+
* `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
|
|
34715
|
+
* seeks and a palette pass, and no rule that never asked for one should start
|
|
34716
|
+
* paying that on the deploy that shipped it.
|
|
34717
|
+
*
|
|
34718
|
+
* A GIF that cannot be assembled DEGRADES to the still — never to nothing.
|
|
34719
|
+
*/
|
|
34720
|
+
var PreviewModeField = _enum(["image", "gif"]);
|
|
34721
|
+
/**
|
|
34722
|
+
* Which detection classes the notification reports counts for.
|
|
34723
|
+
*
|
|
34724
|
+
* The counts come from the tracks the render ALREADY fetched for its dense-range
|
|
34725
|
+
* plan — no second query — aggregated per class. Absent or empty means "every
|
|
34726
|
+
* class the window actually contained", which is what an operator who never
|
|
34727
|
+
* opened the field wants; a list narrows it (`['person']` on a driveway that
|
|
34728
|
+
* counts cars all night).
|
|
34729
|
+
*
|
|
34730
|
+
* Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
|
|
34731
|
+
* …). An unknown name simply never matches and reports nothing — it is not an
|
|
34732
|
+
* error, because a rule may legitimately name a class this camera's model does
|
|
34733
|
+
* not emit.
|
|
34734
|
+
*
|
|
34735
|
+
* The counts are exposed to {@link TimelapseTemplateSchema} as:
|
|
34736
|
+
* - `{{detections}}` — total over the reported classes
|
|
34737
|
+
* - `{{detectionSummary}}` — `2 persone, 1 veicolo`
|
|
34738
|
+
* - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
|
|
34739
|
+
* one per class, `count_` + the class name
|
|
34740
|
+
*
|
|
34741
|
+
* With NO custom body template the summary is appended to the derived body, and
|
|
34742
|
+
* only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
|
|
34743
|
+
* reads. With a custom template the operator owns every word — nothing is
|
|
34744
|
+
* appended, so `{{detectionSummary}}` is how he asks for it.
|
|
34745
|
+
*/
|
|
34746
|
+
var ReportClassesField = array(string().min(1).max(40)).max(20);
|
|
34747
|
+
/**
|
|
34189
34748
|
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
34190
34749
|
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
34191
34750
|
* here (see the ownership note above).
|
|
@@ -34205,9 +34764,30 @@ var TimelapseRuleInputSchema = object({
|
|
|
34205
34764
|
cadenceSec: CadenceSecField.default(15),
|
|
34206
34765
|
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
34207
34766
|
framerate: FramerateField.default(10),
|
|
34767
|
+
/**
|
|
34768
|
+
* Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
|
|
34769
|
+
* as `max(1s, cadenceSec / 30)`, which is what every rule written before this
|
|
34770
|
+
* field gets.
|
|
34771
|
+
*/
|
|
34772
|
+
denseCadenceSec: DenseCadenceSecField.optional(),
|
|
34773
|
+
/** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
|
|
34774
|
+
minDwellSec: MinDwellSecField.optional(),
|
|
34208
34775
|
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
34209
34776
|
targets: TargetsField,
|
|
34210
34777
|
template: TimelapseTemplateSchema.optional(),
|
|
34778
|
+
/**
|
|
34779
|
+
* Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
|
|
34780
|
+
* and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
|
|
34781
|
+
*
|
|
34782
|
+
* Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
|
|
34783
|
+
* the notification's title/body, and clearing it (`template: null`) must not
|
|
34784
|
+
* silently clear the caption too.
|
|
34785
|
+
*/
|
|
34786
|
+
previewText: PreviewTextField.optional(),
|
|
34787
|
+
/** Still or animation — see {@link PreviewModeField}. */
|
|
34788
|
+
previewMode: PreviewModeField.default("image"),
|
|
34789
|
+
/** Classes the notification counts — see {@link ReportClassesField}. */
|
|
34790
|
+
reportClasses: ReportClassesField.optional(),
|
|
34211
34791
|
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
34212
34792
|
priority: PriorityField.default(3)
|
|
34213
34793
|
});
|
|
@@ -34218,8 +34798,13 @@ object({
|
|
|
34218
34798
|
schedule: NcScheduleSchema.optional(),
|
|
34219
34799
|
cadenceSec: CadenceSecField.optional(),
|
|
34220
34800
|
framerate: FramerateField.optional(),
|
|
34801
|
+
denseCadenceSec: DenseCadenceSecField.optional(),
|
|
34802
|
+
minDwellSec: MinDwellSecField.optional(),
|
|
34221
34803
|
targets: TargetsField.optional(),
|
|
34222
34804
|
template: TimelapseTemplateSchema.nullable().optional(),
|
|
34805
|
+
previewText: PreviewTextField.optional(),
|
|
34806
|
+
previewMode: PreviewModeField.optional(),
|
|
34807
|
+
reportClasses: ReportClassesField.optional(),
|
|
34223
34808
|
priority: PriorityField.optional()
|
|
34224
34809
|
});
|
|
34225
34810
|
TimelapseRuleInputSchema.extend({
|
|
@@ -34231,10 +34816,28 @@ TimelapseRuleInputSchema.extend({
|
|
|
34231
34816
|
*/
|
|
34232
34817
|
ownerUserId: string().optional(),
|
|
34233
34818
|
/**
|
|
34234
|
-
* Epoch-ms of the
|
|
34235
|
-
*
|
|
34819
|
+
* Epoch-ms of the NEWEST successful generation across every camera of this
|
|
34820
|
+
* rule. What a UI shows, and the compatibility floor for
|
|
34821
|
+
* {@link readTimelapseGeneratedAt}. Absent = never generated.
|
|
34236
34822
|
*/
|
|
34237
34823
|
lastGeneratedAt: number().optional(),
|
|
34824
|
+
/**
|
|
34825
|
+
* PER-CAMERA generation state, keyed by `String(deviceId)` — the
|
|
34826
|
+
* re-generation guard's real durable state.
|
|
34827
|
+
*
|
|
34828
|
+
* One rule covers several cameras and each renders its own video, so a rule
|
|
34829
|
+
* -wide stamp is wrong in the direction that DESTROYS work: camera A
|
|
34830
|
+
* succeeding at 06:05 tells camera B, whose render failed, that it is
|
|
34831
|
+
* already done — and B's night is gone for good, because the window will not
|
|
34832
|
+
* come back.
|
|
34833
|
+
*
|
|
34834
|
+
* ADDITIVE, so the migration is free: a row written before this field simply
|
|
34835
|
+
* has no map, and {@link readTimelapseGeneratedAt} falls back to
|
|
34836
|
+
* {@link TimelapseRuleSchema.shape.lastGeneratedAt}. Reading an old row as
|
|
34837
|
+
* "never generated" would re-render and re-notify every camera of every rule
|
|
34838
|
+
* once, on the deploy that shipped the map.
|
|
34839
|
+
*/
|
|
34840
|
+
generatedByDevice: record(string(), number()).optional(),
|
|
34238
34841
|
/** userId of the caller who created the rule (server-stamped). */
|
|
34239
34842
|
createdBy: string(),
|
|
34240
34843
|
createdAt: number(),
|