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