@camstack/addon-ai 0.2.17 → 0.2.18
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
CHANGED
|
@@ -7294,8 +7294,31 @@ var AdoptionJobSchema = object({
|
|
|
7294
7294
|
error: string().nullable()
|
|
7295
7295
|
});
|
|
7296
7296
|
/**
|
|
7297
|
-
* Per-camera FUNCTION SWITCHES
|
|
7298
|
-
*
|
|
7297
|
+
* Per-camera FUNCTION SWITCHES.
|
|
7298
|
+
*
|
|
7299
|
+
* ## The aggregate group is being withdrawn — the BADGE is not (D113)
|
|
7300
|
+
*
|
|
7301
|
+
* This file shipped as "the one coherent on/off surface over the pipeline
|
|
7302
|
+
* functions an operator thinks in terms of". The operator's verdict on
|
|
7303
|
+
* 2026-08-12 was that the coherent surface bought complexity and no clarity:
|
|
7304
|
+
* every function already had a settings page of its own, and a second place to
|
|
7305
|
+
* turn it off is a second place to look. Each switch is going back to its own
|
|
7306
|
+
* component's original options — detection to the detection-pipeline wrapper
|
|
7307
|
+
* binding, audio analysis to its own, recording to `RecordingConfig.enabled`
|
|
7308
|
+
* (which was always first-class; the switch was a veneer over
|
|
7309
|
+
* `recording.setDeviceConfig`), notifications to a notification-center
|
|
7310
|
+
* per-device setting, the two camera planes to their own components.
|
|
7311
|
+
*
|
|
7312
|
+
* What survives is {@link composeSwitchedOff}: `CameraStatus.switchedOff`, the
|
|
7313
|
+
* thing that lets a status surface say DISABLED instead of BROKEN, recomposed
|
|
7314
|
+
* straight from the authorities with no group in the middle. That rule was
|
|
7315
|
+
* never about a control panel.
|
|
7316
|
+
*
|
|
7317
|
+
* Everything else here — {@link CAMERA_SWITCH_CATALOG}, {@link CameraSwitch},
|
|
7318
|
+
* {@link deriveCameraSwitches}, the `pipelineOrchestrator.getCameraSwitches` /
|
|
7319
|
+
* `setCameraSwitch` pair — is a COMPATIBILITY surface for as long as deployed
|
|
7320
|
+
* viewers (v1.0.305) and the admin UI still call it. It is deleted when they
|
|
7321
|
+
* stop; nothing new may be built on it.
|
|
7299
7322
|
*
|
|
7300
7323
|
* ## This file adds no state
|
|
7301
7324
|
*
|
|
@@ -7646,7 +7669,15 @@ var RecordingConfigSchema = object({
|
|
|
7646
7669
|
* Each completed/failed run also lands one durable ops-log row on its owning
|
|
7647
7670
|
* addon surface.
|
|
7648
7671
|
*/
|
|
7672
|
+
/**
|
|
7673
|
+
* `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
|
|
7674
|
+
* rebalance enqueues one job per (camera, profile). Refusing the second job —
|
|
7675
|
+
* what the engine did before — turned a fifteen-camera rebalance into fifteen
|
|
7676
|
+
* manual retries. Queued jobs run FIFO; a queued job that is cancelled never
|
|
7677
|
+
* runs at all.
|
|
7678
|
+
*/
|
|
7649
7679
|
var RelocateJobStateSchema = _enum([
|
|
7680
|
+
"queued",
|
|
7650
7681
|
"running",
|
|
7651
7682
|
"done",
|
|
7652
7683
|
"failed",
|
|
@@ -7681,6 +7712,15 @@ var RelocateFootageInputSchema = object({
|
|
|
7681
7712
|
/** Limits relocation to the logical profile class. Omit only for the
|
|
7682
7713
|
* pre-orchestration compatibility path. */
|
|
7683
7714
|
footageClass: RelocateFootageClassSchema.optional(),
|
|
7715
|
+
/** Scope the move to ONE camera. Absent = every camera on the source, which
|
|
7716
|
+
* is what a whole-disk drain means. The rebalance path always sets it: its
|
|
7717
|
+
* unit is a (camera, profile) pile, not a disk. */
|
|
7718
|
+
deviceId: number().int().optional(),
|
|
7719
|
+
/** Scope the move to specific segment profiles (`high` / `mid` / `low`).
|
|
7720
|
+
* Finer than `footageClass`, which cannot separate high from mid — and the
|
|
7721
|
+
* placement plan assigns those two independently, so a rebalance that could
|
|
7722
|
+
* only say "recordings" would move footage the plan never asked to move. */
|
|
7723
|
+
profiles: array(string()).optional(),
|
|
7684
7724
|
/** Copy throttle in MB/s (default 40) — the drain is a background chore,
|
|
7685
7725
|
* never allowed to starve live writers. */
|
|
7686
7726
|
throttleMbps: number().min(1).max(1e3).optional()
|
|
@@ -7816,6 +7856,21 @@ var StorageLocationSchema = object({
|
|
|
7816
7856
|
nodeId: string().optional(),
|
|
7817
7857
|
isDefault: boolean().default(false),
|
|
7818
7858
|
isSystem: boolean().default(false),
|
|
7859
|
+
/**
|
|
7860
|
+
* Operator opt-in: whether consumers that BALANCE across several locations
|
|
7861
|
+
* of a type may write here. Recordings reads it today; event media and
|
|
7862
|
+
* backups are the next consumers, which is why the flag lives on the
|
|
7863
|
+
* location rather than in any one addon's store — nothing has to be
|
|
7864
|
+
* extended to add the next consumer.
|
|
7865
|
+
*
|
|
7866
|
+
* OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
|
|
7867
|
+
* flag existed reads back with no flag and keeps working exactly as before;
|
|
7868
|
+
* that is the whole compat story, and it is why no migration ships with it.
|
|
7869
|
+
* A newly CREATED sibling is stamped `false` by the orchestrator (creating a
|
|
7870
|
+
* disk must not silently start writing to it); the default of a type is
|
|
7871
|
+
* always stamped `true`.
|
|
7872
|
+
*/
|
|
7873
|
+
enabled: boolean().optional(),
|
|
7819
7874
|
/** COMPUTED at read time by the orchestrator (statfs of the backing volume
|
|
7820
7875
|
* for node-local locations it can reach) — never persisted, absent when the
|
|
7821
7876
|
* volume is remote/unreachable. The single capacity truth every UI reads. */
|
|
@@ -12118,7 +12173,8 @@ method(object({
|
|
|
12118
12173
|
}), EmbeddingResultSchema), method(object({ text: string() }), EmbeddingResultSchema), method(_void(), EmbeddingInfoSchema);
|
|
12119
12174
|
/**
|
|
12120
12175
|
* filesystem-browse — per-node capability for browsing the node's local
|
|
12121
|
-
* filesystem
|
|
12176
|
+
* filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
|
|
12177
|
+
* are sandboxed to operator-configured allowed roots (D115). Used by the
|
|
12122
12178
|
* admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
|
|
12123
12179
|
* (one provider per node); the hub calls it with `{nodeId}` so the codegen
|
|
12124
12180
|
* routes to that exact node (default `nodeIdMode:'routing'`).
|
|
@@ -13976,6 +14032,13 @@ var MaskGridDimsSchema = object({
|
|
|
13976
14032
|
* `package-event` are pure trigger kinds (no urgency dimension). Extending
|
|
13977
14033
|
* this one field keeps the schema additive — a rule still declares exactly
|
|
13978
14034
|
* one trigger.
|
|
14035
|
+
*
|
|
14036
|
+
* AUDIO rules add no member here, for the reason occupancy added none: the
|
|
14037
|
+
* enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
|
|
14038
|
+
* mirror.ts` fails the build on a member the app cannot render) and every
|
|
14039
|
+
* member costs a release train. A sustained-sound rule is therefore an
|
|
14040
|
+
* `immediate` rule carrying {@link NcConditions.audio} — the condition is the
|
|
14041
|
+
* trigger discriminator, exactly as `occupancy` is on `device-event`.
|
|
13979
14042
|
*/
|
|
13980
14043
|
var NcDeliverySchema = _enum([
|
|
13981
14044
|
"immediate",
|
|
@@ -13990,15 +14053,32 @@ var NcDeliverySchema = _enum([
|
|
|
13990
14053
|
* depend on a provider's raw event name or payload shape.
|
|
13991
14054
|
*/
|
|
13992
14055
|
var NcSystemEventKindSchema = _enum([
|
|
13993
|
-
"
|
|
13994
|
-
"
|
|
14056
|
+
"device-online",
|
|
14057
|
+
"device-offline",
|
|
14058
|
+
"device-disabled",
|
|
14059
|
+
"device-enabled",
|
|
13995
14060
|
"stream-online",
|
|
13996
14061
|
"stream-offline",
|
|
13997
14062
|
"node-online",
|
|
13998
14063
|
"node-offline",
|
|
13999
14064
|
"addon-update-available",
|
|
14000
|
-
"server-update-available"
|
|
14065
|
+
"server-update-available",
|
|
14066
|
+
"alarm-triggered",
|
|
14067
|
+
"alarm-armed",
|
|
14068
|
+
"alarm-disarmed",
|
|
14069
|
+
"camera-online",
|
|
14070
|
+
"camera-offline",
|
|
14071
|
+
"camera-disabled",
|
|
14072
|
+
"camera-enabled"
|
|
14073
|
+
]);
|
|
14074
|
+
/** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
|
|
14075
|
+
var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
|
|
14076
|
+
"camera-online",
|
|
14077
|
+
"camera-offline",
|
|
14078
|
+
"camera-disabled",
|
|
14079
|
+
"camera-enabled"
|
|
14001
14080
|
]);
|
|
14081
|
+
NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
|
|
14002
14082
|
/**
|
|
14003
14083
|
* One coherent system-event condition. `kinds` is the required opt-in safety
|
|
14004
14084
|
* gate; the remaining lists are optional narrowing filters relevant to the
|
|
@@ -14007,6 +14087,18 @@ var NcSystemEventKindSchema = _enum([
|
|
|
14007
14087
|
var NcSystemEventConditionSchema = object({
|
|
14008
14088
|
kinds: array(NcSystemEventKindSchema).min(1),
|
|
14009
14089
|
deviceIds: array(number().int()).min(1).optional(),
|
|
14090
|
+
/**
|
|
14091
|
+
* Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
|
|
14092
|
+
* `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
|
|
14093
|
+
* is what a liveness rule means when nobody said otherwise.
|
|
14094
|
+
*
|
|
14095
|
+
* This is where "only my cameras" is expressed, and it lives on the rule for
|
|
14096
|
+
* one reason: the intake cannot know which devices this household cares
|
|
14097
|
+
* about, and a producer-side filter is one no operator can change. Fails
|
|
14098
|
+
* CLOSED — a subject whose device type is unknown (an id the device mirror
|
|
14099
|
+
* does not carry) matches no `deviceTypes` list.
|
|
14100
|
+
*/
|
|
14101
|
+
deviceTypes: array(string().min(1)).min(1).optional(),
|
|
14010
14102
|
nodeIds: array(string().min(1)).min(1).optional(),
|
|
14011
14103
|
packageNames: array(string().min(1)).min(1).optional()
|
|
14012
14104
|
});
|
|
@@ -14057,6 +14149,47 @@ var NcOccupancyConditionSchema = object({
|
|
|
14057
14149
|
sustainSeconds: number().int().min(0).max(3600).default(15)
|
|
14058
14150
|
});
|
|
14059
14151
|
/**
|
|
14152
|
+
* Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
|
|
14153
|
+
*
|
|
14154
|
+
* Operator-approved vocabulary (2026-08-12, option A — the same one the
|
|
14155
|
+
* reference notifier uses, so an operator moving between them re-uses what
|
|
14156
|
+
* they already know): a rule matches when, over a sampling window of
|
|
14157
|
+
* `samplingSeconds`, at least `hitPercent`% of the audio samples in that
|
|
14158
|
+
* window are HITS. A sample is a hit when it satisfies BOTH present filters:
|
|
14159
|
+
*
|
|
14160
|
+
* - `dbThreshold` — its level is at or above this many dBFS (see
|
|
14161
|
+
* {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
|
|
14162
|
+
* - `labels` — the classifier put at least one of these labels on it.
|
|
14163
|
+
*
|
|
14164
|
+
* Both are OPTIONAL and independent, which is the point of the shape: a
|
|
14165
|
+
* loudness rule ("something loud at 3am") needs no model to be right, and a
|
|
14166
|
+
* label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
|
|
14167
|
+
* is given** — a window in which every sample is trivially a hit would fire on
|
|
14168
|
+
* silence, so the engine refuses such a condition rather than notifying on
|
|
14169
|
+
* nothing (the schema cannot express "at least one of" without becoming a
|
|
14170
|
+
* ZodEffects the cap path would have to special-case).
|
|
14171
|
+
*
|
|
14172
|
+
* `hitPercent` is over the samples the window actually HOLDS, and the window
|
|
14173
|
+
* must be FULL before it can match — a window that has been open for two
|
|
14174
|
+
* seconds of its ten is 100% of nothing, and firing on it would make
|
|
14175
|
+
* `samplingSeconds` decorative.
|
|
14176
|
+
*
|
|
14177
|
+
* Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
|
|
14178
|
+
* `audio-*` ids). Both spellings are accepted — the matcher normalizes the
|
|
14179
|
+
* `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
|
|
14180
|
+
* an operator who typed `dog` mean the same thing.
|
|
14181
|
+
*/
|
|
14182
|
+
var NcAudioConditionSchema = object({
|
|
14183
|
+
/** Audio macro labels; absent = any sound (level-only rule). */
|
|
14184
|
+
labels: array(string().min(1)).min(1).optional(),
|
|
14185
|
+
/** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
|
|
14186
|
+
dbThreshold: number().min(-96).max(0).optional(),
|
|
14187
|
+
/** Percentage of the window's samples that must be hits (1–100). */
|
|
14188
|
+
hitPercent: number().int().min(1).max(100).default(60),
|
|
14189
|
+
/** Length of the sampling window in seconds. */
|
|
14190
|
+
samplingSeconds: number().int().min(1).max(300).default(10)
|
|
14191
|
+
});
|
|
14192
|
+
/**
|
|
14060
14193
|
* Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
|
|
14061
14194
|
*
|
|
14062
14195
|
* The values are not symmetric, and deliberately so — the absent value has to
|
|
@@ -14329,7 +14462,33 @@ var NcConditionsSchema = object({
|
|
|
14329
14462
|
* threshold and holds for `sustainSeconds`. Fail-closed on missing
|
|
14330
14463
|
* substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
|
|
14331
14464
|
*/
|
|
14332
|
-
occupancy: NcOccupancyConditionSchema.optional()
|
|
14465
|
+
occupancy: NcOccupancyConditionSchema.optional(),
|
|
14466
|
+
/**
|
|
14467
|
+
* IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
|
|
14468
|
+
* `samplingSeconds` window clear the optional `dbThreshold` and carry one of
|
|
14469
|
+
* the optional `labels`. Fail-closed on missing substrate (no audio samples,
|
|
14470
|
+
* a window that is not full yet, neither filter given). See
|
|
14471
|
+
* {@link NcAudioCondition}.
|
|
14472
|
+
*
|
|
14473
|
+
* Presence of this key is what makes a rule an AUDIO rule: the engine fires
|
|
14474
|
+
* it ONLY on a confirmed audio window, and a rule carrying it never fires on
|
|
14475
|
+
* a detection, a track or a device event (the same fail-closed pairing
|
|
14476
|
+
* `occupancy` has with the `device-event` trigger). That is how audio labels
|
|
14477
|
+
* leave `classes`: an audio rule names its sounds HERE, and the legacy path
|
|
14478
|
+
* (an `immediate` rule naming an `audio-*` class, one notification per
|
|
14479
|
+
* classified sample) stays exactly as it was for rules that already use it.
|
|
14480
|
+
*
|
|
14481
|
+
* NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
|
|
14482
|
+
* rather than an oversight: the viewer mirrors the descriptor enums BY HAND
|
|
14483
|
+
* (`camstack/src/data/notification-center.ts`, guarded by
|
|
14484
|
+
* `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
|
|
14485
|
+
* condition fields it does not know when a rule is saved from the phone.
|
|
14486
|
+
* Publishing an editor for a condition the app cannot round-trip is how an
|
|
14487
|
+
* operator loses a rule's conditions by opening it — so the descriptor, the
|
|
14488
|
+
* admin widget and the viewer mirror land together (P2 + P3), and only then
|
|
14489
|
+
* does an audio rule become authorable.
|
|
14490
|
+
*/
|
|
14491
|
+
audio: NcAudioConditionSchema.optional()
|
|
14333
14492
|
});
|
|
14334
14493
|
/** One delivery target: a `notification-output` Target ref + passthrough params. */
|
|
14335
14494
|
var NcRuleTargetSchema = object({
|
|
@@ -14443,6 +14602,73 @@ var NcThrottleSchema = object({
|
|
|
14443
14602
|
*/
|
|
14444
14603
|
granularity: NcThrottleGranularitySchema.optional()
|
|
14445
14604
|
});
|
|
14605
|
+
/**
|
|
14606
|
+
* How long the confirm gate may hold ONE notification, and how big the picture
|
|
14607
|
+
* it judges may be.
|
|
14608
|
+
*
|
|
14609
|
+
* The clamp is the product decision, not a coincidence of the model: p50 was
|
|
14610
|
+
* 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
|
|
14611
|
+
* arrives after the visitor has gone is not a notification. 448 px was enough
|
|
14612
|
+
* to score 16/16 on the operator's parking scenario — bigger costs latency and
|
|
14613
|
+
* tokens for pixels the model pools away.
|
|
14614
|
+
*/
|
|
14615
|
+
var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
|
|
14616
|
+
var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
|
|
14617
|
+
var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
|
|
14618
|
+
/** Comparison the model's COUNT must satisfy for the notification to fire. */
|
|
14619
|
+
var NcConfirmExpectSchema = object({
|
|
14620
|
+
op: _enum([
|
|
14621
|
+
">=",
|
|
14622
|
+
">",
|
|
14623
|
+
"<=",
|
|
14624
|
+
"<",
|
|
14625
|
+
"=="
|
|
14626
|
+
]),
|
|
14627
|
+
count: number().int().min(0).max(1e3)
|
|
14628
|
+
});
|
|
14629
|
+
/**
|
|
14630
|
+
* AI CONFIRM — a vision model looks at the picture this notification is about
|
|
14631
|
+
* to ship and says whether it agrees with the rule.
|
|
14632
|
+
*
|
|
14633
|
+
* It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
|
|
14634
|
+
* crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
|
|
14635
|
+
* on the operator's phone is not a verdict about this notification.
|
|
14636
|
+
*
|
|
14637
|
+
* FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
|
|
14638
|
+
* whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
|
|
14639
|
+
* the default and every fail-open is COUNTED, because a gate that always fails
|
|
14640
|
+
* open looks in the log exactly like a gate that works.
|
|
14641
|
+
*
|
|
14642
|
+
* Every field is `.optional()` rather than relied on as a Zod default at the
|
|
14643
|
+
* runtime seam: a Zod default does NOT run on the addon→addon cap path (three
|
|
14644
|
+
* production failures in one day), so the gate reads absent as the constant
|
|
14645
|
+
* above rather than trusting a parse it may never have seen.
|
|
14646
|
+
*/
|
|
14647
|
+
var NcConfirmSchema = object({
|
|
14648
|
+
/** Off unless asked for. An absent `confirm` and `enabled:false` are the
|
|
14649
|
+
* same thing, and both mean "deliver exactly as before". */
|
|
14650
|
+
enabled: boolean().default(false),
|
|
14651
|
+
/** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
|
|
14652
|
+
profileId: string().optional(),
|
|
14653
|
+
/**
|
|
14654
|
+
* The operator's question, in his own words. Absent = a question derived
|
|
14655
|
+
* from the rule (its class and its expectation).
|
|
14656
|
+
*
|
|
14657
|
+
* NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
|
|
14658
|
+
* banners, signage and plates as instructions if you let them reach the
|
|
14659
|
+
* prompt — proven live — so the authoritative contract stays in the system
|
|
14660
|
+
* turn and only rule-authored words land here.
|
|
14661
|
+
*/
|
|
14662
|
+
prompt: string().max(1e3).optional(),
|
|
14663
|
+
/** Fire only when the model's count satisfies this. Absent = the model's
|
|
14664
|
+
* own boolean verdict decides. */
|
|
14665
|
+
expect: NcConfirmExpectSchema.optional(),
|
|
14666
|
+
timeoutMs: number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
|
|
14667
|
+
/** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
|
|
14668
|
+
onTimeout: _enum(["fire", "suppress"]).default("fire"),
|
|
14669
|
+
/** Longest edge the judged image is downscaled to before it is sent. */
|
|
14670
|
+
maxImagePx: number().int().min(64).max(2048).default(448)
|
|
14671
|
+
});
|
|
14446
14672
|
/** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
|
|
14447
14673
|
var NcRuleInputSchema = object({
|
|
14448
14674
|
name: string().min(1).max(200),
|
|
@@ -14503,7 +14729,13 @@ var NcRuleInputSchema = object({
|
|
|
14503
14729
|
* `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
|
|
14504
14730
|
* shape as every other actuation.
|
|
14505
14731
|
*/
|
|
14506
|
-
actions: NcRuleActionsSchema.optional()
|
|
14732
|
+
actions: NcRuleActionsSchema.optional(),
|
|
14733
|
+
/**
|
|
14734
|
+
* AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
|
|
14735
|
+
* a rule that predates the gate must keep delivering byte-for-byte as it
|
|
14736
|
+
* did, and absent is the only way to say that without a migration.
|
|
14737
|
+
*/
|
|
14738
|
+
confirm: NcConfirmSchema.optional()
|
|
14507
14739
|
});
|
|
14508
14740
|
/**
|
|
14509
14741
|
* Partial patch for `updateRule` — any subset of the input fields, plus the
|
|
@@ -14514,7 +14746,37 @@ var NcRuleInputSchema = object({
|
|
|
14514
14746
|
* still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
|
|
14515
14747
|
* `updateRule` patch.
|
|
14516
14748
|
*/
|
|
14517
|
-
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
|
|
14749
|
+
var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
|
|
14750
|
+
disabledTargetIds: array(string()).optional(),
|
|
14751
|
+
/**
|
|
14752
|
+
* `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
|
|
14753
|
+
*
|
|
14754
|
+
* It makes the key optional to SUPPLY; the parse still materialises the
|
|
14755
|
+
* default when the key is absent. And `NcRuleStore.update` merges with
|
|
14756
|
+
* `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
|
|
14757
|
+
* one — which made every partial edit destructive:
|
|
14758
|
+
*
|
|
14759
|
+
* nc.updateRule({ throttle }) → conditions reset to `{}`
|
|
14760
|
+
* nc.setRuleTargetEnabled(...) → conditions reset to `{}`
|
|
14761
|
+
* setEnabled(ruleId, false) → conditions reset to `{}`
|
|
14762
|
+
*
|
|
14763
|
+
* A rule scoped to one camera and one zone silently became a rule that
|
|
14764
|
+
* matches EVERY event on EVERY camera, and lost its `media` policy
|
|
14765
|
+
* (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
|
|
14766
|
+
* live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
|
|
14767
|
+
* within a minute of a two-field patch.
|
|
14768
|
+
*
|
|
14769
|
+
* So every defaulted field is re-declared here WITHOUT its default. The
|
|
14770
|
+
* inner defaults still apply when the caller DOES send the key — `{}` for
|
|
14771
|
+
* conditions remains a real instruction ("clear them") — and only the
|
|
14772
|
+
* absent key is now genuinely absent.
|
|
14773
|
+
*/
|
|
14774
|
+
enabled: boolean().optional(),
|
|
14775
|
+
conditions: NcConditionsSchema.optional(),
|
|
14776
|
+
media: NcMediaPolicySchema.optional(),
|
|
14777
|
+
throttle: NcThrottleSchema.optional(),
|
|
14778
|
+
priority: number().int().min(1).max(5).optional()
|
|
14779
|
+
});
|
|
14518
14780
|
/** A persisted rule. */
|
|
14519
14781
|
var NcRuleSchema = NcRuleInputSchema.extend({
|
|
14520
14782
|
id: string(),
|
|
@@ -14815,6 +15077,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
|
|
|
14815
15077
|
* Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
|
|
14816
15078
|
* copy would lie the first time a rule is disabled.
|
|
14817
15079
|
*/
|
|
15080
|
+
/**
|
|
15081
|
+
* Why a device a mode NAMES is nonetheless not armed by it.
|
|
15082
|
+
*
|
|
15083
|
+
* Each value is an existing authority, never a new flag (D62): `muted` is the
|
|
15084
|
+
* per-camera notification switch the Notification Center already owns,
|
|
15085
|
+
* `detection-off` is the device's own detection binding being inactive, and
|
|
15086
|
+
* `offline` is the device manager's liveness. A fourth reason would mean a
|
|
15087
|
+
* fourth authority, and inventing one here is how a panel starts disagreeing
|
|
15088
|
+
* with the switches the operator actually used.
|
|
15089
|
+
*/
|
|
15090
|
+
var NcAlarmSkipReasonSchema = _enum([
|
|
15091
|
+
"muted",
|
|
15092
|
+
"detection-off",
|
|
15093
|
+
"offline"
|
|
15094
|
+
]);
|
|
15095
|
+
var NcAlarmSkippedDeviceSchema = object({
|
|
15096
|
+
deviceId: number().int(),
|
|
15097
|
+
reason: NcAlarmSkipReasonSchema
|
|
15098
|
+
});
|
|
14818
15099
|
var NcAlarmModeCoverageSchema = object({
|
|
14819
15100
|
mode: AlarmArmModeSchema,
|
|
14820
15101
|
/** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
|
|
@@ -14822,7 +15103,18 @@ var NcAlarmModeCoverageSchema = object({
|
|
|
14822
15103
|
/** At least one covering rule has no device scope, so the mode covers all. */
|
|
14823
15104
|
allDevices: boolean(),
|
|
14824
15105
|
/** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
|
|
14825
|
-
deviceIds: array(number().int())
|
|
15106
|
+
deviceIds: array(number().int()),
|
|
15107
|
+
/**
|
|
15108
|
+
* Devices this mode NAMES but cannot actually arm, each with the switch that
|
|
15109
|
+
* excludes it.
|
|
15110
|
+
*
|
|
15111
|
+
* "Away armed — 12 cameras" is a promise, and a muted camera among those
|
|
15112
|
+
* twelve makes it false in exactly the way nobody notices until an incident.
|
|
15113
|
+
* Defaulted to `[]` so a coverage answer computed before this field existed
|
|
15114
|
+
* still parses as "nothing known to be skipped" rather than failing the whole
|
|
15115
|
+
* alarm tab.
|
|
15116
|
+
*/
|
|
15117
|
+
skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
|
|
14826
15118
|
});
|
|
14827
15119
|
var NcAlarmConfigSchema = object({
|
|
14828
15120
|
/**
|
|
@@ -17621,9 +17913,16 @@ var CameraStatusSchema = object({
|
|
|
17621
17913
|
audio: CameraAudioStatusSchema.nullable(),
|
|
17622
17914
|
recording: CameraRecordingStatusSchema.nullable(),
|
|
17623
17915
|
/**
|
|
17624
|
-
* Per-camera
|
|
17916
|
+
* Per-camera functions an OPERATOR has turned off
|
|
17625
17917
|
* ([D61](../../../../docs/decisions/adr-0067.md)).
|
|
17626
17918
|
*
|
|
17919
|
+
* Composed from the AUTHORITIES themselves — the wrapper bindings,
|
|
17920
|
+
* `RecordingConfig.enabled`, the notification mute, the broker's audio
|
|
17921
|
+
* policy, the camera's own microphone — via `composeSwitchedOff`, not from
|
|
17922
|
+
* the deprecated `getCameraSwitches` group ([D113](../../../../docs/decisions/adr-0113.md)).
|
|
17923
|
+
* The badge outlives the control panel: the panel was a convenience, this is
|
|
17924
|
+
* the difference between a camera being off and a camera being dead.
|
|
17925
|
+
*
|
|
17627
17926
|
* This is the difference between DISABLED and BROKEN. A camera whose
|
|
17628
17927
|
* `detection` block reports zero fps and whose `switchedOff` contains
|
|
17629
17928
|
* `'object-detection'` was switched off by a person; the same camera with an
|
|
@@ -23132,7 +23431,19 @@ var RecordingManifestSchema = object({
|
|
|
23132
23431
|
* profiles/subtrees/locations on this node). */
|
|
23133
23432
|
var RecordingDeviceUsageSchema = object({
|
|
23134
23433
|
deviceId: number(),
|
|
23135
|
-
usedBytes: number()
|
|
23434
|
+
usedBytes: number(),
|
|
23435
|
+
/**
|
|
23436
|
+
* Start of this camera's OLDEST indexed segment, across every profile and
|
|
23437
|
+
* location — the "Oldest footage" column in Recordings → Storage, and the
|
|
23438
|
+
* only honest answer to "is retention actually holding?" per camera.
|
|
23439
|
+
*
|
|
23440
|
+
* `null` = the camera has no footage. OPTIONAL because a recorder that
|
|
23441
|
+
* predates this field omits it entirely, and a hub whose types carry the
|
|
23442
|
+
* field must keep validating that older provider's payload: the framework
|
|
23443
|
+
* (types) and the addon ship on different trains, and the addon is usually
|
|
23444
|
+
* the later of the two.
|
|
23445
|
+
*/
|
|
23446
|
+
oldestMs: number().nullable().optional()
|
|
23136
23447
|
});
|
|
23137
23448
|
/** Recording storage usage + capacity for one storage location. */
|
|
23138
23449
|
var RecordingLocationUsageSchema = object({
|
|
@@ -23160,6 +23471,57 @@ var RecordingStorageUsageSchema = object({
|
|
|
23160
23471
|
locations: array(RecordingLocationUsageSchema)
|
|
23161
23472
|
});
|
|
23162
23473
|
/**
|
|
23474
|
+
* The OPERATOR-ARMED half of multi-location recordings (D116).
|
|
23475
|
+
*
|
|
23476
|
+
* The placement plan decides where NEW writes go and moves nothing. A rebalance
|
|
23477
|
+
* is the operator asking for the EXISTING archive to be brought into line with
|
|
23478
|
+
* that plan: one relocate job per (camera, profile) pile that sits on the wrong
|
|
23479
|
+
* location, run FIFO behind the single-flight mover.
|
|
23480
|
+
*
|
|
23481
|
+
* `plan…` and `start…` return the SAME shape deliberately — what the operator
|
|
23482
|
+
* confirms is exactly what gets enqueued, and `jobIds` is the only difference
|
|
23483
|
+
* (empty on the plan).
|
|
23484
|
+
*/
|
|
23485
|
+
var RecordingRebalanceMoveSchema = object({
|
|
23486
|
+
deviceId: number(),
|
|
23487
|
+
profile: string(),
|
|
23488
|
+
fromLocationId: string(),
|
|
23489
|
+
toLocationId: string(),
|
|
23490
|
+
bytes: number(),
|
|
23491
|
+
files: number().int()
|
|
23492
|
+
});
|
|
23493
|
+
/** Why a pile that is out of place is staying there. Every refusal is
|
|
23494
|
+
* reported: a rebalance that silently drops a camera reads exactly like one
|
|
23495
|
+
* that had nothing to do. */
|
|
23496
|
+
var RecordingRebalanceSkipReasonSchema = _enum([
|
|
23497
|
+
"unassigned",
|
|
23498
|
+
"target-not-writable",
|
|
23499
|
+
"below-threshold",
|
|
23500
|
+
"no-headroom"
|
|
23501
|
+
]);
|
|
23502
|
+
var RecordingRebalanceSkipSchema = object({
|
|
23503
|
+
deviceId: number(),
|
|
23504
|
+
profile: string(),
|
|
23505
|
+
fromLocationId: string(),
|
|
23506
|
+
/** The location the plan wants; null when the camera has no assignment. */
|
|
23507
|
+
toLocationId: string().nullable(),
|
|
23508
|
+
bytes: number(),
|
|
23509
|
+
reason: RecordingRebalanceSkipReasonSchema
|
|
23510
|
+
});
|
|
23511
|
+
var RecordingRebalancePlanSchema = object({
|
|
23512
|
+
moves: array(RecordingRebalanceMoveSchema),
|
|
23513
|
+
skipped: array(RecordingRebalanceSkipSchema),
|
|
23514
|
+
bytesToMove: number(),
|
|
23515
|
+
/** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
|
|
23516
|
+
jobIds: array(string())
|
|
23517
|
+
});
|
|
23518
|
+
var RecordingRebalanceInputSchema = object({
|
|
23519
|
+
/** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
|
|
23520
|
+
throttleMbps: number().min(1).max(1e3).optional(),
|
|
23521
|
+
/** Ignore piles smaller than this (default 1 GB). */
|
|
23522
|
+
minMoveGb: number().min(0).optional()
|
|
23523
|
+
});
|
|
23524
|
+
/**
|
|
23163
23525
|
* Result of locating footage at a wall-clock instant for one device/profile.
|
|
23164
23526
|
* `segment` carries the covering segment's window; `gap` reports the forward
|
|
23165
23527
|
* nearest covered edge (`null` past the end of footage / when none exists)
|
|
@@ -23322,9 +23684,24 @@ method(object({
|
|
|
23322
23684
|
}), method(object({ jobId: string() }), RelocateJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
23323
23685
|
kind: "mutation",
|
|
23324
23686
|
auth: "admin"
|
|
23687
|
+
}), method(RelocateFootageInputSchema, object({ jobId: string() }), {
|
|
23688
|
+
kind: "mutation",
|
|
23689
|
+
auth: "admin"
|
|
23690
|
+
}), method(object({}), array(RelocateJobSchema).readonly(), {
|
|
23691
|
+
kind: "query",
|
|
23692
|
+
auth: "admin"
|
|
23693
|
+
}), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
|
|
23694
|
+
kind: "mutation",
|
|
23695
|
+
auth: "admin"
|
|
23696
|
+
}), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
|
|
23697
|
+
kind: "query",
|
|
23698
|
+
auth: "admin"
|
|
23699
|
+
}), method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
|
|
23700
|
+
kind: "mutation",
|
|
23701
|
+
auth: "admin"
|
|
23325
23702
|
});
|
|
23326
23703
|
/**
|
|
23327
|
-
* `
|
|
23704
|
+
* `recording-export` cap — render a footage time range into a single downloadable
|
|
23328
23705
|
* MP4 (regular / accelerated / decelerated / timelapse, ± audio), kept for a
|
|
23329
23706
|
* bounded lifetime with a durable history, auto-expiry, and optional
|
|
23330
23707
|
* delete-after-download.
|
|
@@ -23339,10 +23716,42 @@ method(object({
|
|
|
23339
23716
|
*/
|
|
23340
23717
|
/** Playback-speed multiplier for the render (1 = realtime). */
|
|
23341
23718
|
var ExportSpeedSchema = number().min(.25).max(32);
|
|
23719
|
+
/**
|
|
23720
|
+
* One dense interval, in SECONDS FROM THE EXPORT'S OWN `fromMs`.
|
|
23721
|
+
*
|
|
23722
|
+
* Relative and not absolute epoch on purpose: the renderer's frame-select
|
|
23723
|
+
* expression sees ffmpeg's `t`, which starts at 0 for the export's source
|
|
23724
|
+
* playlist. Handing it absolute epochs would make every call site responsible
|
|
23725
|
+
* for the same subtraction, and the one that forgot would emit a filter that
|
|
23726
|
+
* selects nothing — silently, as a uniform timelapse.
|
|
23727
|
+
*/
|
|
23728
|
+
var ExportDenseRangeSchema = object({
|
|
23729
|
+
fromSec: number().nonnegative(),
|
|
23730
|
+
toSec: number().nonnegative()
|
|
23731
|
+
}).refine((r) => r.toSec > r.fromSec, { message: "dense range must have toSec > fromSec" });
|
|
23732
|
+
/**
|
|
23733
|
+
* Dense-interval overlay for a timelapse: sample at `dense.everyMs` INSIDE the
|
|
23734
|
+
* listed ranges and at the base `everyMs` everywhere else.
|
|
23735
|
+
*
|
|
23736
|
+
* `everyMs` must be strictly smaller than the base cadence — a dense rate that
|
|
23737
|
+
* is not denser renders a uniform timelapse the operator believes is two-rate.
|
|
23738
|
+
*/
|
|
23739
|
+
var ExportDenseSchema = object({
|
|
23740
|
+
everyMs: number().int().positive(),
|
|
23741
|
+
ranges: array(ExportDenseRangeSchema).min(1).max(200)
|
|
23742
|
+
});
|
|
23342
23743
|
/** Timelapse cadence — sample one source frame per `everyMs`, output at `outputFps`. */
|
|
23343
23744
|
var ExportTimelapseSchema = object({
|
|
23344
23745
|
everyMs: number().int().positive(),
|
|
23345
|
-
outputFps: number().int().min(1).max(60).optional()
|
|
23746
|
+
outputFps: number().int().min(1).max(60).optional(),
|
|
23747
|
+
/** Optional second, FASTER rate over the intervals that matter. */
|
|
23748
|
+
dense: ExportDenseSchema.optional()
|
|
23749
|
+
}).superRefine((v, ctx) => {
|
|
23750
|
+
if (v.dense !== void 0 && v.dense.everyMs >= v.everyMs) ctx.addIssue({
|
|
23751
|
+
code: ZodIssueCode.custom,
|
|
23752
|
+
message: "dense.everyMs must be strictly smaller than the base everyMs",
|
|
23753
|
+
path: ["dense", "everyMs"]
|
|
23754
|
+
});
|
|
23346
23755
|
});
|
|
23347
23756
|
/**
|
|
23348
23757
|
* Render options. `speed` and `timelapse` are mutually exclusive. `includeAudio`
|
|
@@ -23400,6 +23809,19 @@ var ExportDownloadSchema = object({
|
|
|
23400
23809
|
url: string(),
|
|
23401
23810
|
endpoints: array(string())
|
|
23402
23811
|
});
|
|
23812
|
+
/**
|
|
23813
|
+
* A finished export's bytes, inline.
|
|
23814
|
+
*
|
|
23815
|
+
* `bytes` is the DECODED length — the number the caller bounds and logs
|
|
23816
|
+
* against, so nobody has to infer it from the base64 length.
|
|
23817
|
+
*/
|
|
23818
|
+
var ExportBytesSchema = object({
|
|
23819
|
+
base64: string(),
|
|
23820
|
+
contentType: string(),
|
|
23821
|
+
/** Suggested filename, extension included. */
|
|
23822
|
+
name: string(),
|
|
23823
|
+
bytes: number().int().nonnegative()
|
|
23824
|
+
});
|
|
23403
23825
|
method(object({
|
|
23404
23826
|
deviceId: number(),
|
|
23405
23827
|
profile: string(),
|
|
@@ -23424,6 +23846,9 @@ method(object({
|
|
|
23424
23846
|
}), method(object({ exportId: string() }), ExportDownloadSchema, {
|
|
23425
23847
|
kind: "query",
|
|
23426
23848
|
auth: "protected"
|
|
23849
|
+
}), method(object({ exportId: string() }), ExportBytesSchema, {
|
|
23850
|
+
kind: "query",
|
|
23851
|
+
auth: "protected"
|
|
23427
23852
|
});
|
|
23428
23853
|
/**
|
|
23429
23854
|
* scene-monitor — device-scoped reference-region state cap. An operator marks
|
|
@@ -28617,6 +29042,12 @@ Object.freeze({
|
|
|
28617
29042
|
addonId: null,
|
|
28618
29043
|
access: "create"
|
|
28619
29044
|
},
|
|
29045
|
+
"recording.cancelRelocateJob": {
|
|
29046
|
+
capName: "recording",
|
|
29047
|
+
capScope: "system",
|
|
29048
|
+
addonId: null,
|
|
29049
|
+
access: "create"
|
|
29050
|
+
},
|
|
28620
29051
|
"recording.cancelStorageMigrationMove": {
|
|
28621
29052
|
capName: "recording",
|
|
28622
29053
|
capScope: "system",
|
|
@@ -28671,6 +29102,12 @@ Object.freeze({
|
|
|
28671
29102
|
addonId: null,
|
|
28672
29103
|
access: "view"
|
|
28673
29104
|
},
|
|
29105
|
+
"recording.listRelocateJobs": {
|
|
29106
|
+
capName: "recording",
|
|
29107
|
+
capScope: "system",
|
|
29108
|
+
addonId: null,
|
|
29109
|
+
access: "view"
|
|
29110
|
+
},
|
|
28674
29111
|
"recording.locateSegment": {
|
|
28675
29112
|
capName: "recording",
|
|
28676
29113
|
capScope: "system",
|
|
@@ -28683,6 +29120,12 @@ Object.freeze({
|
|
|
28683
29120
|
addonId: null,
|
|
28684
29121
|
access: "create"
|
|
28685
29122
|
},
|
|
29123
|
+
"recording.planStorageRebalance": {
|
|
29124
|
+
capName: "recording",
|
|
29125
|
+
capScope: "system",
|
|
29126
|
+
addonId: null,
|
|
29127
|
+
access: "view"
|
|
29128
|
+
},
|
|
28686
29129
|
"recording.pruneFootage": {
|
|
28687
29130
|
capName: "recording",
|
|
28688
29131
|
capScope: "system",
|
|
@@ -28707,6 +29150,12 @@ Object.freeze({
|
|
|
28707
29150
|
addonId: null,
|
|
28708
29151
|
access: "create"
|
|
28709
29152
|
},
|
|
29153
|
+
"recording.relocateFootage": {
|
|
29154
|
+
capName: "recording",
|
|
29155
|
+
capScope: "system",
|
|
29156
|
+
addonId: null,
|
|
29157
|
+
access: "create"
|
|
29158
|
+
},
|
|
28710
29159
|
"recording.renderClip": {
|
|
28711
29160
|
capName: "recording",
|
|
28712
29161
|
capScope: "system",
|
|
@@ -28743,38 +29192,50 @@ Object.freeze({
|
|
|
28743
29192
|
addonId: null,
|
|
28744
29193
|
access: "create"
|
|
28745
29194
|
},
|
|
29195
|
+
"recording.startStorageRebalance": {
|
|
29196
|
+
capName: "recording",
|
|
29197
|
+
capScope: "system",
|
|
29198
|
+
addonId: null,
|
|
29199
|
+
access: "create"
|
|
29200
|
+
},
|
|
28746
29201
|
"recordingExport.cancelExport": {
|
|
28747
|
-
capName: "
|
|
29202
|
+
capName: "recording-export",
|
|
28748
29203
|
capScope: "system",
|
|
28749
29204
|
addonId: null,
|
|
28750
29205
|
access: "create"
|
|
28751
29206
|
},
|
|
28752
29207
|
"recordingExport.createExport": {
|
|
28753
|
-
capName: "
|
|
29208
|
+
capName: "recording-export",
|
|
28754
29209
|
capScope: "system",
|
|
28755
29210
|
addonId: null,
|
|
28756
29211
|
access: "create"
|
|
28757
29212
|
},
|
|
28758
29213
|
"recordingExport.deleteExport": {
|
|
28759
|
-
capName: "
|
|
29214
|
+
capName: "recording-export",
|
|
28760
29215
|
capScope: "system",
|
|
28761
29216
|
addonId: null,
|
|
28762
29217
|
access: "delete"
|
|
28763
29218
|
},
|
|
28764
29219
|
"recordingExport.getDownloadUrl": {
|
|
28765
|
-
capName: "
|
|
29220
|
+
capName: "recording-export",
|
|
28766
29221
|
capScope: "system",
|
|
28767
29222
|
addonId: null,
|
|
28768
29223
|
access: "view"
|
|
28769
29224
|
},
|
|
28770
29225
|
"recordingExport.getExport": {
|
|
28771
|
-
capName: "
|
|
29226
|
+
capName: "recording-export",
|
|
28772
29227
|
capScope: "system",
|
|
28773
29228
|
addonId: null,
|
|
28774
29229
|
access: "view"
|
|
28775
29230
|
},
|
|
28776
29231
|
"recordingExport.listExports": {
|
|
28777
|
-
capName: "
|
|
29232
|
+
capName: "recording-export",
|
|
29233
|
+
capScope: "system",
|
|
29234
|
+
addonId: null,
|
|
29235
|
+
access: "view"
|
|
29236
|
+
},
|
|
29237
|
+
"recordingExport.readExportBytes": {
|
|
29238
|
+
capName: "recording-export",
|
|
28778
29239
|
capScope: "system",
|
|
28779
29240
|
addonId: null,
|
|
28780
29241
|
access: "view"
|
|
@@ -30151,6 +30612,104 @@ var FramerateField = number().int().min(1).max(60);
|
|
|
30151
30612
|
var TargetsField = array(NcRuleTargetSchema).min(1);
|
|
30152
30613
|
var PriorityField = number().int().min(1).max(5);
|
|
30153
30614
|
/**
|
|
30615
|
+
* Explicit override of the DENSE sampling cadence, seconds.
|
|
30616
|
+
*
|
|
30617
|
+
* Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
|
|
30618
|
+
* 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
|
|
30619
|
+
* made that same base 3 s and rendered a person pass as two frames.)
|
|
30620
|
+
*
|
|
30621
|
+
* THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
|
|
30622
|
+
* `denseCadenceSec` and played at `framerate` occupies
|
|
30623
|
+
*
|
|
30624
|
+
* outputSeconds = (rangeSec / denseCadenceSec) / framerate
|
|
30625
|
+
*
|
|
30626
|
+
* 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.
|
|
30627
|
+
* Halving this field doubles the frames INSIDE ranges only — the base cadence,
|
|
30628
|
+
* and therefore the length of a quiet night, does not move.
|
|
30629
|
+
*
|
|
30630
|
+
* Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
|
|
30631
|
+
* the recording has them returns the same frames, requested twice. Must be
|
|
30632
|
+
* STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
|
|
30633
|
+
* a uniform video the operator believes is two-rate — and upsert refuses it
|
|
30634
|
+
* rather than letting the export cap reject the render hours after the window.
|
|
30635
|
+
*/
|
|
30636
|
+
var DenseCadenceSecField = number().min(.1).max(3600);
|
|
30637
|
+
/**
|
|
30638
|
+
* Minimum seconds of OUTPUT video each detection range must occupy.
|
|
30639
|
+
*
|
|
30640
|
+
* The operator-facing form of the arithmetic above: instead of solving for a
|
|
30641
|
+
* cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
|
|
30642
|
+
* 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
|
|
30643
|
+
* that range every ~583 ms.
|
|
30644
|
+
*
|
|
30645
|
+
* ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
|
|
30646
|
+
* ranges are terms of a single ffmpeg `select` expression that cannot vary rate
|
|
30647
|
+
* per term — so the MOST DEMANDING (shortest) range sets the rate and longer
|
|
30648
|
+
* ranges are sampled denser than they need. Per-range cadences require a cap
|
|
30649
|
+
* schema change and are the tracked follow-up.
|
|
30650
|
+
*
|
|
30651
|
+
* A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
|
|
30652
|
+
* is rendered with every frame that EXISTS and no more: the guarantee is capped
|
|
30653
|
+
* by real footage, never met by duplicating frames into motion that never
|
|
30654
|
+
* happened.
|
|
30655
|
+
*/
|
|
30656
|
+
var MinDwellSecField = number().min(0).max(60);
|
|
30657
|
+
/**
|
|
30658
|
+
* Caption burned into the notification's preview frame.
|
|
30659
|
+
*
|
|
30660
|
+
* Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
|
|
30661
|
+
* `rule`, `from`, `to`) and rendered by the SAME renderer — a second
|
|
30662
|
+
* templating dialect for one field would be a second thing to explain.
|
|
30663
|
+
*
|
|
30664
|
+
* Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
|
|
30665
|
+
* operator saying "the frame, no caption" — a distinct, reachable answer, and
|
|
30666
|
+
* the reason this is not `.min(1)`.
|
|
30667
|
+
*/
|
|
30668
|
+
var PreviewTextField = string().max(200);
|
|
30669
|
+
/**
|
|
30670
|
+
* Whether the notification's preview is a STILL or a short animation.
|
|
30671
|
+
*
|
|
30672
|
+
* The operator's ask, verbatim: *"inviato come gif o video (come per le altre
|
|
30673
|
+
* rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
|
|
30674
|
+
* night reads better as three seconds of motion than as one frame of it. Both
|
|
30675
|
+
* modes get the SAME treatment (blurred frame, large centred title); `'gif'`
|
|
30676
|
+
* simply applies it to a dozen frames sampled across the render and assembles
|
|
30677
|
+
* them.
|
|
30678
|
+
*
|
|
30679
|
+
* `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
|
|
30680
|
+
* seeks and a palette pass, and no rule that never asked for one should start
|
|
30681
|
+
* paying that on the deploy that shipped it.
|
|
30682
|
+
*
|
|
30683
|
+
* A GIF that cannot be assembled DEGRADES to the still — never to nothing.
|
|
30684
|
+
*/
|
|
30685
|
+
var PreviewModeField = _enum(["image", "gif"]);
|
|
30686
|
+
/**
|
|
30687
|
+
* Which detection classes the notification reports counts for.
|
|
30688
|
+
*
|
|
30689
|
+
* The counts come from the tracks the render ALREADY fetched for its dense-range
|
|
30690
|
+
* plan — no second query — aggregated per class. Absent or empty means "every
|
|
30691
|
+
* class the window actually contained", which is what an operator who never
|
|
30692
|
+
* opened the field wants; a list narrows it (`['person']` on a driveway that
|
|
30693
|
+
* counts cars all night).
|
|
30694
|
+
*
|
|
30695
|
+
* Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
|
|
30696
|
+
* …). An unknown name simply never matches and reports nothing — it is not an
|
|
30697
|
+
* error, because a rule may legitimately name a class this camera's model does
|
|
30698
|
+
* not emit.
|
|
30699
|
+
*
|
|
30700
|
+
* The counts are exposed to {@link TimelapseTemplateSchema} as:
|
|
30701
|
+
* - `{{detections}}` — total over the reported classes
|
|
30702
|
+
* - `{{detectionSummary}}` — `2 persone, 1 veicolo`
|
|
30703
|
+
* - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
|
|
30704
|
+
* one per class, `count_` + the class name
|
|
30705
|
+
*
|
|
30706
|
+
* With NO custom body template the summary is appended to the derived body, and
|
|
30707
|
+
* only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
|
|
30708
|
+
* reads. With a custom template the operator owns every word — nothing is
|
|
30709
|
+
* appended, so `{{detectionSummary}}` is how he asks for it.
|
|
30710
|
+
*/
|
|
30711
|
+
var ReportClassesField = array(string().min(1).max(40)).max(20);
|
|
30712
|
+
/**
|
|
30154
30713
|
* Client-supplied timelapse-rule fields. The server stamps id / createdBy /
|
|
30155
30714
|
* createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
|
|
30156
30715
|
* here (see the ownership note above).
|
|
@@ -30170,9 +30729,30 @@ var TimelapseRuleInputSchema = object({
|
|
|
30170
30729
|
cadenceSec: CadenceSecField.default(15),
|
|
30171
30730
|
/** Output frames per second of the assembled mp4 (predecessor parity). */
|
|
30172
30731
|
framerate: FramerateField.default(10),
|
|
30732
|
+
/**
|
|
30733
|
+
* Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
|
|
30734
|
+
* as `max(1s, cadenceSec / 30)`, which is what every rule written before this
|
|
30735
|
+
* field gets.
|
|
30736
|
+
*/
|
|
30737
|
+
denseCadenceSec: DenseCadenceSecField.optional(),
|
|
30738
|
+
/** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
|
|
30739
|
+
minDwellSec: MinDwellSecField.optional(),
|
|
30173
30740
|
/** `notification-output` targets the finished video/thumbnail is sent to. */
|
|
30174
30741
|
targets: TargetsField,
|
|
30175
30742
|
template: TimelapseTemplateSchema.optional(),
|
|
30743
|
+
/**
|
|
30744
|
+
* Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
|
|
30745
|
+
* and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
|
|
30746
|
+
*
|
|
30747
|
+
* Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
|
|
30748
|
+
* the notification's title/body, and clearing it (`template: null`) must not
|
|
30749
|
+
* silently clear the caption too.
|
|
30750
|
+
*/
|
|
30751
|
+
previewText: PreviewTextField.optional(),
|
|
30752
|
+
/** Still or animation — see {@link PreviewModeField}. */
|
|
30753
|
+
previewMode: PreviewModeField.default("image"),
|
|
30754
|
+
/** Classes the notification counts — see {@link ReportClassesField}. */
|
|
30755
|
+
reportClasses: ReportClassesField.optional(),
|
|
30176
30756
|
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
30177
30757
|
priority: PriorityField.default(3)
|
|
30178
30758
|
});
|
|
@@ -30183,8 +30763,13 @@ object({
|
|
|
30183
30763
|
schedule: NcScheduleSchema.optional(),
|
|
30184
30764
|
cadenceSec: CadenceSecField.optional(),
|
|
30185
30765
|
framerate: FramerateField.optional(),
|
|
30766
|
+
denseCadenceSec: DenseCadenceSecField.optional(),
|
|
30767
|
+
minDwellSec: MinDwellSecField.optional(),
|
|
30186
30768
|
targets: TargetsField.optional(),
|
|
30187
30769
|
template: TimelapseTemplateSchema.nullable().optional(),
|
|
30770
|
+
previewText: PreviewTextField.optional(),
|
|
30771
|
+
previewMode: PreviewModeField.optional(),
|
|
30772
|
+
reportClasses: ReportClassesField.optional(),
|
|
30188
30773
|
priority: PriorityField.optional()
|
|
30189
30774
|
});
|
|
30190
30775
|
TimelapseRuleInputSchema.extend({
|
|
@@ -30196,10 +30781,28 @@ TimelapseRuleInputSchema.extend({
|
|
|
30196
30781
|
*/
|
|
30197
30782
|
ownerUserId: string().optional(),
|
|
30198
30783
|
/**
|
|
30199
|
-
* Epoch-ms of the
|
|
30200
|
-
*
|
|
30784
|
+
* Epoch-ms of the NEWEST successful generation across every camera of this
|
|
30785
|
+
* rule. What a UI shows, and the compatibility floor for
|
|
30786
|
+
* {@link readTimelapseGeneratedAt}. Absent = never generated.
|
|
30201
30787
|
*/
|
|
30202
30788
|
lastGeneratedAt: number().optional(),
|
|
30789
|
+
/**
|
|
30790
|
+
* PER-CAMERA generation state, keyed by `String(deviceId)` — the
|
|
30791
|
+
* re-generation guard's real durable state.
|
|
30792
|
+
*
|
|
30793
|
+
* One rule covers several cameras and each renders its own video, so a rule
|
|
30794
|
+
* -wide stamp is wrong in the direction that DESTROYS work: camera A
|
|
30795
|
+
* succeeding at 06:05 tells camera B, whose render failed, that it is
|
|
30796
|
+
* already done — and B's night is gone for good, because the window will not
|
|
30797
|
+
* come back.
|
|
30798
|
+
*
|
|
30799
|
+
* ADDITIVE, so the migration is free: a row written before this field simply
|
|
30800
|
+
* has no map, and {@link readTimelapseGeneratedAt} falls back to
|
|
30801
|
+
* {@link TimelapseRuleSchema.shape.lastGeneratedAt}. Reading an old row as
|
|
30802
|
+
* "never generated" would re-render and re-notify every camera of every rule
|
|
30803
|
+
* once, on the deploy that shipped the map.
|
|
30804
|
+
*/
|
|
30805
|
+
generatedByDevice: record(string(), number()).optional(),
|
|
30203
30806
|
/** userId of the caller who created the rule (server-stamped). */
|
|
30204
30807
|
createdBy: string(),
|
|
30205
30808
|
createdAt: number(),
|
|
@@ -31973,10 +32576,10 @@ async function assembleAi(deps) {
|
|
|
31973
32576
|
registrations,
|
|
31974
32577
|
runtimeProvider
|
|
31975
32578
|
};
|
|
31976
|
-
const { UsageStore } = await Promise.resolve().then(() => require("./usage-store-
|
|
32579
|
+
const { UsageStore } = await Promise.resolve().then(() => require("./usage-store-8hfWI98H.js")).then((n) => n.usage_store_exports);
|
|
31977
32580
|
const store = new ProfileStore(deps.settingsPort);
|
|
31978
32581
|
const defaults = new DefaultsStore(deps.settingsPort);
|
|
31979
|
-
const usage = new UsageStore(deps.settingsPort);
|
|
32582
|
+
const usage = new UsageStore(deps.settingsPort, Date.now, deps.logger.child("llm-usage"));
|
|
31980
32583
|
await store.init();
|
|
31981
32584
|
await defaults.init();
|
|
31982
32585
|
await usage.init();
|