@camstack/system 1.2.83 → 1.2.85

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.
Files changed (66) hide show
  1. package/dist/addon-runner.js +1 -1
  2. package/dist/addon-runner.mjs +1 -1
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  14. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  15. package/dist/builtins/device-manager/device-manager.addon.js +32 -2
  16. package/dist/builtins/device-manager/device-manager.addon.mjs +32 -2
  17. package/dist/builtins/device-manager/device-meta-actions.d.ts +12 -0
  18. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  19. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  20. package/dist/builtins/hub-forwarder/index.js +1 -1
  21. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  22. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  23. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  24. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  25. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  26. package/dist/builtins/local-network/local-network.addon.js +1 -1
  27. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  28. package/dist/builtins/loki-logging/index.js +1 -1
  29. package/dist/builtins/loki-logging/index.mjs +1 -1
  30. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  31. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  32. package/dist/builtins/platform-probe/index.js +1 -1
  33. package/dist/builtins/platform-probe/index.mjs +1 -1
  34. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  35. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  36. package/dist/builtins/snapshot/index.js +66 -11
  37. package/dist/builtins/snapshot/index.mjs +66 -11
  38. package/dist/builtins/snapshot/snapshot.addon.d.ts +39 -3
  39. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +30 -10
  40. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +31 -11
  41. package/dist/builtins/sqlite-storage/path-guard.d.ts +8 -1
  42. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +1 -1
  43. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +1 -1
  44. package/dist/builtins/storage-orchestrator/index.d.ts +5 -6
  45. package/dist/builtins/storage-orchestrator/index.mjs +1 -1
  46. package/dist/builtins/storage-orchestrator/provider-discovery.d.ts +1 -1
  47. package/dist/builtins/storage-orchestrator/storage-migration-coordinator.d.ts +1 -1
  48. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +1 -1
  49. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1252 -1191
  50. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1253 -1192
  51. package/dist/builtins/system-config/system-config.addon.js +1 -1
  52. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  53. package/dist/builtins/winston-logging/index.js +1 -1
  54. package/dist/builtins/winston-logging/index.mjs +1 -1
  55. package/dist/{dist-EAvNJD24.mjs → dist-DWuNENzg.mjs} +527 -11
  56. package/dist/{dist-CqiMPPs0.js → dist-DiScsb8j.js} +527 -11
  57. package/dist/index.js +83 -18
  58. package/dist/index.mjs +84 -19
  59. package/dist/kernel/addon-installer.d.ts +58 -6
  60. package/dist/kernel/moleculer/event-bus-core.d.ts +47 -1
  61. package/dist/kernel/transport/child-cap-protocol.d.ts +32 -0
  62. package/dist/kernel/transport/hub-cap-forward.d.ts +8 -0
  63. package/dist/kernel/transport/parent-unowned-call.d.ts +19 -0
  64. package/dist/{manifest-python-deps-DG_LLcZF.js → manifest-python-deps-C0zkl1Ae.js} +133 -53
  65. package/dist/{manifest-python-deps-C1DMs1J9.mjs → manifest-python-deps-fWzdEasI.mjs} +133 -53
  66. package/package.json +6 -1
@@ -3710,7 +3710,15 @@ var RecordingConfigSchema = z.object({
3710
3710
  * Each completed/failed run also lands one durable ops-log row on its owning
3711
3711
  * addon surface.
3712
3712
  */
3713
+ /**
3714
+ * `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
3715
+ * rebalance enqueues one job per (camera, profile). Refusing the second job —
3716
+ * what the engine did before — turned a fifteen-camera rebalance into fifteen
3717
+ * manual retries. Queued jobs run FIFO; a queued job that is cancelled never
3718
+ * runs at all.
3719
+ */
3713
3720
  var RelocateJobStateSchema = z.enum([
3721
+ "queued",
3714
3722
  "running",
3715
3723
  "done",
3716
3724
  "failed",
@@ -3745,6 +3753,15 @@ var RelocateFootageInputSchema = z.object({
3745
3753
  /** Limits relocation to the logical profile class. Omit only for the
3746
3754
  * pre-orchestration compatibility path. */
3747
3755
  footageClass: RelocateFootageClassSchema.optional(),
3756
+ /** Scope the move to ONE camera. Absent = every camera on the source, which
3757
+ * is what a whole-disk drain means. The rebalance path always sets it: its
3758
+ * unit is a (camera, profile) pile, not a disk. */
3759
+ deviceId: z.number().int().optional(),
3760
+ /** Scope the move to specific segment profiles (`high` / `mid` / `low`).
3761
+ * Finer than `footageClass`, which cannot separate high from mid — and the
3762
+ * placement plan assigns those two independently, so a rebalance that could
3763
+ * only say "recordings" would move footage the plan never asked to move. */
3764
+ profiles: z.array(z.string()).optional(),
3748
3765
  /** Copy throttle in MB/s (default 40) — the drain is a background chore,
3749
3766
  * never allowed to starve live writers. */
3750
3767
  throttleMbps: z.number().min(1).max(1e3).optional()
@@ -3880,6 +3897,21 @@ var StorageLocationSchema = z.object({
3880
3897
  nodeId: z.string().optional(),
3881
3898
  isDefault: z.boolean().default(false),
3882
3899
  isSystem: z.boolean().default(false),
3900
+ /**
3901
+ * Operator opt-in: whether consumers that BALANCE across several locations
3902
+ * of a type may write here. Recordings reads it today; event media and
3903
+ * backups are the next consumers, which is why the flag lives on the
3904
+ * location rather than in any one addon's store — nothing has to be
3905
+ * extended to add the next consumer.
3906
+ *
3907
+ * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
3908
+ * flag existed reads back with no flag and keeps working exactly as before;
3909
+ * that is the whole compat story, and it is why no migration ships with it.
3910
+ * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
3911
+ * disk must not silently start writing to it); the default of a type is
3912
+ * always stamped `true`.
3913
+ */
3914
+ enabled: z.boolean().optional(),
3883
3915
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
3884
3916
  * for node-local locations it can reach) — never persisted, absent when the
3885
3917
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -9958,7 +9990,8 @@ var embeddingEncoderCapability = {
9958
9990
  };
9959
9991
  /**
9960
9992
  * filesystem-browse — per-node capability for browsing the node's local
9961
- * filesystem, sandboxed to operator-configured allowed roots. Used by the
9993
+ * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
9994
+ * are sandboxed to operator-configured allowed roots (D115). Used by the
9962
9995
  * admin "Add filesystem location" flow to pick a node + path. `mode:'per-node'`
9963
9996
  * (one provider per node); the hub calls it with `{nodeId}` so the codegen
9964
9997
  * routes to that exact node (default `nodeIdMode:'routing'`).
@@ -9979,9 +10012,9 @@ var filesystemBrowseCapability = {
9979
10012
  mode: "singleton",
9980
10013
  internal: true,
9981
10014
  methods: {
9982
- /** The allowed roots browsing is sandboxed to on this node. */
10015
+ /** The roots `createDir` is sandboxed to on this node. Browsing is not confined to them. */
9983
10016
  listAllowedRoots: method(z.void(), z.array(z.string()).readonly(), { auth: "admin" }),
9984
- /** Immediate subdirectories of `path` (must be within an allowed root) + free/total bytes. */
10017
+ /** Immediate subdirectories of any absolute `path` + free/total bytes. Read-only. */
9985
10018
  browse: method(z.object({ path: z.string() }), BrowseResultSchema, { auth: "admin" }),
9986
10019
  /** Create a subdirectory (within an allowed root). Returns its absolute path. */
9987
10020
  createDir: method(z.object({ path: z.string() }), z.object({ path: z.string() }), {
@@ -12038,6 +12071,13 @@ var MaskGridDimsSchema = z.object({
12038
12071
  * `package-event` are pure trigger kinds (no urgency dimension). Extending
12039
12072
  * this one field keeps the schema additive — a rule still declares exactly
12040
12073
  * one trigger.
12074
+ *
12075
+ * AUDIO rules add no member here, for the reason occupancy added none: the
12076
+ * enum is mirrored by hand in the viewer (`scripts/check-viewer-condition-
12077
+ * mirror.ts` fails the build on a member the app cannot render) and every
12078
+ * member costs a release train. A sustained-sound rule is therefore an
12079
+ * `immediate` rule carrying {@link NcConditions.audio} — the condition is the
12080
+ * trigger discriminator, exactly as `occupancy` is on `device-event`.
12041
12081
  */
12042
12082
  var NcDeliverySchema = z.enum([
12043
12083
  "immediate",
@@ -12052,15 +12092,32 @@ var NcDeliverySchema = z.enum([
12052
12092
  * depend on a provider's raw event name or payload shape.
12053
12093
  */
12054
12094
  var NcSystemEventKindSchema = z.enum([
12055
- "camera-online",
12056
- "camera-offline",
12095
+ "device-online",
12096
+ "device-offline",
12097
+ "device-disabled",
12098
+ "device-enabled",
12057
12099
  "stream-online",
12058
12100
  "stream-offline",
12059
12101
  "node-online",
12060
12102
  "node-offline",
12061
12103
  "addon-update-available",
12062
- "server-update-available"
12104
+ "server-update-available",
12105
+ "alarm-triggered",
12106
+ "alarm-armed",
12107
+ "alarm-disarmed",
12108
+ "camera-online",
12109
+ "camera-offline",
12110
+ "camera-disabled",
12111
+ "camera-enabled"
12112
+ ]);
12113
+ /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
12114
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
12115
+ "camera-online",
12116
+ "camera-offline",
12117
+ "camera-disabled",
12118
+ "camera-enabled"
12063
12119
  ]);
12120
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
12064
12121
  /**
12065
12122
  * One coherent system-event condition. `kinds` is the required opt-in safety
12066
12123
  * gate; the remaining lists are optional narrowing filters relevant to the
@@ -12069,6 +12126,18 @@ var NcSystemEventKindSchema = z.enum([
12069
12126
  var NcSystemEventConditionSchema = z.object({
12070
12127
  kinds: z.array(NcSystemEventKindSchema).min(1),
12071
12128
  deviceIds: z.array(z.number().int()).min(1).optional(),
12129
+ /**
12130
+ * Narrow a `device-*` kind to these device TYPES (`DeviceType` values —
12131
+ * `camera`, `switch`, `sensor`, `container`, …). Absent = every type, which
12132
+ * is what a liveness rule means when nobody said otherwise.
12133
+ *
12134
+ * This is where "only my cameras" is expressed, and it lives on the rule for
12135
+ * one reason: the intake cannot know which devices this household cares
12136
+ * about, and a producer-side filter is one no operator can change. Fails
12137
+ * CLOSED — a subject whose device type is unknown (an id the device mirror
12138
+ * does not carry) matches no `deviceTypes` list.
12139
+ */
12140
+ deviceTypes: z.array(z.string().min(1)).min(1).optional(),
12072
12141
  nodeIds: z.array(z.string().min(1)).min(1).optional(),
12073
12142
  packageNames: z.array(z.string().min(1)).min(1).optional()
12074
12143
  });
@@ -12121,6 +12190,47 @@ var NcOccupancyConditionSchema = z.object({
12121
12190
  sustainSeconds: z.number().int().min(0).max(3600).default(15)
12122
12191
  });
12123
12192
  /**
12193
+ * Audio condition (IMMEDIATE trigger) — a rule on SOUND, not on a picture.
12194
+ *
12195
+ * Operator-approved vocabulary (2026-08-12, option A — the same one the
12196
+ * reference notifier uses, so an operator moving between them re-uses what
12197
+ * they already know): a rule matches when, over a sampling window of
12198
+ * `samplingSeconds`, at least `hitPercent`% of the audio samples in that
12199
+ * window are HITS. A sample is a hit when it satisfies BOTH present filters:
12200
+ *
12201
+ * - `dbThreshold` — its level is at or above this many dBFS (see
12202
+ * {@link NC_AUDIO_DBFS_FLOOR}: negative-going, `0` = full scale);
12203
+ * - `labels` — the classifier put at least one of these labels on it.
12204
+ *
12205
+ * Both are OPTIONAL and independent, which is the point of the shape: a
12206
+ * loudness rule ("something loud at 3am") needs no model to be right, and a
12207
+ * label rule ("a dog barked") needs no threshold. **Fail-closed when NEITHER
12208
+ * is given** — a window in which every sample is trivially a hit would fire on
12209
+ * silence, so the engine refuses such a condition rather than notifying on
12210
+ * nothing (the schema cannot express "at least one of" without becoming a
12211
+ * ZodEffects the cap path would have to special-case).
12212
+ *
12213
+ * `hitPercent` is over the samples the window actually HOLDS, and the window
12214
+ * must be FULL before it can match — a window that has been open for two
12215
+ * seconds of its ten is 100% of nothing, and firing on it would make
12216
+ * `samplingSeconds` decorative.
12217
+ *
12218
+ * Labels are the audio macro classes (`AUDIO_MACRO_LABELS` / the NC taxonomy's
12219
+ * `audio-*` ids). Both spellings are accepted — the matcher normalizes the
12220
+ * `audio-` prefix away on both sides, so a picker that offers taxonomy ids and
12221
+ * an operator who typed `dog` mean the same thing.
12222
+ */
12223
+ var NcAudioConditionSchema = z.object({
12224
+ /** Audio macro labels; absent = any sound (level-only rule). */
12225
+ labels: z.array(z.string().min(1)).min(1).optional(),
12226
+ /** Level floor in dBFS (negative-going, `0` = full scale); absent = any level. */
12227
+ dbThreshold: z.number().min(-96).max(0).optional(),
12228
+ /** Percentage of the window's samples that must be hits (1–100). */
12229
+ hitPercent: z.number().int().min(1).max(100).default(60),
12230
+ /** Length of the sampling window in seconds. */
12231
+ samplingSeconds: z.number().int().min(1).max(300).default(10)
12232
+ });
12233
+ /**
12124
12234
  * Which zone-crossing DIRECTION a rule accepts (`ObjectEvent.zoneCrossing`).
12125
12235
  *
12126
12236
  * The values are not symmetric, and deliberately so — the absent value has to
@@ -12404,7 +12514,33 @@ var NcConditionsSchema = z.object({
12404
12514
  * threshold and holds for `sustainSeconds`. Fail-closed on missing
12405
12515
  * substrate (no snapshot / missing zone). See {@link NcOccupancyCondition}.
12406
12516
  */
12407
- occupancy: NcOccupancyConditionSchema.optional()
12517
+ occupancy: NcOccupancyConditionSchema.optional(),
12518
+ /**
12519
+ * IMMEDIATE only. Sustained-sound matcher — `hitPercent` of the samples in a
12520
+ * `samplingSeconds` window clear the optional `dbThreshold` and carry one of
12521
+ * the optional `labels`. Fail-closed on missing substrate (no audio samples,
12522
+ * a window that is not full yet, neither filter given). See
12523
+ * {@link NcAudioCondition}.
12524
+ *
12525
+ * Presence of this key is what makes a rule an AUDIO rule: the engine fires
12526
+ * it ONLY on a confirmed audio window, and a rule carrying it never fires on
12527
+ * a detection, a track or a device event (the same fail-closed pairing
12528
+ * `occupancy` has with the `device-event` trigger). That is how audio labels
12529
+ * leave `classes`: an audio rule names its sounds HERE, and the legacy path
12530
+ * (an `immediate` rule naming an `audio-*` class, one notification per
12531
+ * classified sample) stays exactly as it was for rules that already use it.
12532
+ *
12533
+ * NOT in {@link NC_CONDITION_CATALOG} yet, and that is the sequencing rule
12534
+ * rather than an oversight: the viewer mirrors the descriptor enums BY HAND
12535
+ * (`camstack/src/data/notification-center.ts`, guarded by
12536
+ * `scripts/check-viewer-condition-mirror.ts`) and its rule editor STRIPS the
12537
+ * condition fields it does not know when a rule is saved from the phone.
12538
+ * Publishing an editor for a condition the app cannot round-trip is how an
12539
+ * operator loses a rule's conditions by opening it — so the descriptor, the
12540
+ * admin widget and the viewer mirror land together (P2 + P3), and only then
12541
+ * does an audio rule become authorable.
12542
+ */
12543
+ audio: NcAudioConditionSchema.optional()
12408
12544
  });
12409
12545
  /** One delivery target: a `notification-output` Target ref + passthrough params. */
12410
12546
  var NcRuleTargetSchema = z.object({
@@ -12518,6 +12654,73 @@ var NcThrottleSchema = z.object({
12518
12654
  */
12519
12655
  granularity: NcThrottleGranularitySchema.optional()
12520
12656
  });
12657
+ /**
12658
+ * How long the confirm gate may hold ONE notification, and how big the picture
12659
+ * it judges may be.
12660
+ *
12661
+ * The clamp is the product decision, not a coincidence of the model: p50 was
12662
+ * 4.9 s warm and 15.3 s cold against qwen3-vl-8b, and a notification that
12663
+ * arrives after the visitor has gone is not a notification. 448 px was enough
12664
+ * to score 16/16 on the operator's parking scenario — bigger costs latency and
12665
+ * tokens for pixels the model pools away.
12666
+ */
12667
+ var NC_CONFIRM_MIN_TIMEOUT_MS = 1e3;
12668
+ var NC_CONFIRM_MAX_TIMEOUT_MS = 2e4;
12669
+ var NC_CONFIRM_DEFAULT_TIMEOUT_MS = 8e3;
12670
+ /** Comparison the model's COUNT must satisfy for the notification to fire. */
12671
+ var NcConfirmExpectSchema = z.object({
12672
+ op: z.enum([
12673
+ ">=",
12674
+ ">",
12675
+ "<=",
12676
+ "<",
12677
+ "=="
12678
+ ]),
12679
+ count: z.number().int().min(0).max(1e3)
12680
+ });
12681
+ /**
12682
+ * AI CONFIRM — a vision model looks at the picture this notification is about
12683
+ * to ship and says whether it agrees with the rule.
12684
+ *
12685
+ * It runs AFTER the attachments resolve, deliberately: the crop JUDGED is the
12686
+ * crop SHIPPED (D52). A verdict about a different pixel rectangle than the one
12687
+ * on the operator's phone is not a verdict about this notification.
12688
+ *
12689
+ * FAIL-OPEN is the only safe default. A gate that cannot reach its model, or
12690
+ * whose model is cold, must not silence a camera — so `onTimeout: 'fire'` is
12691
+ * the default and every fail-open is COUNTED, because a gate that always fails
12692
+ * open looks in the log exactly like a gate that works.
12693
+ *
12694
+ * Every field is `.optional()` rather than relied on as a Zod default at the
12695
+ * runtime seam: a Zod default does NOT run on the addon→addon cap path (three
12696
+ * production failures in one day), so the gate reads absent as the constant
12697
+ * above rather than trusting a parse it may never have seen.
12698
+ */
12699
+ var NcConfirmSchema = z.object({
12700
+ /** Off unless asked for. An absent `confirm` and `enabled:false` are the
12701
+ * same thing, and both mean "deliver exactly as before". */
12702
+ enabled: z.boolean().default(false),
12703
+ /** Explicit vision profile; absent = the `purpose:'vision'` cluster default. */
12704
+ profileId: z.string().optional(),
12705
+ /**
12706
+ * The operator's question, in his own words. Absent = a question derived
12707
+ * from the rule (its class and its expectation).
12708
+ *
12709
+ * NEVER composed with text READ OUT OF THE FRAME. The model reads OSD
12710
+ * banners, signage and plates as instructions if you let them reach the
12711
+ * prompt — proven live — so the authoritative contract stays in the system
12712
+ * turn and only rule-authored words land here.
12713
+ */
12714
+ prompt: z.string().max(1e3).optional(),
12715
+ /** Fire only when the model's count satisfies this. Absent = the model's
12716
+ * own boolean verdict decides. */
12717
+ expect: NcConfirmExpectSchema.optional(),
12718
+ timeoutMs: z.number().int().min(NC_CONFIRM_MIN_TIMEOUT_MS).max(NC_CONFIRM_MAX_TIMEOUT_MS).default(NC_CONFIRM_DEFAULT_TIMEOUT_MS),
12719
+ /** What a timeout / unreachable model MEANS. `fire` (default) = fail-open. */
12720
+ onTimeout: z.enum(["fire", "suppress"]).default("fire"),
12721
+ /** Longest edge the judged image is downscaled to before it is sent. */
12722
+ maxImagePx: z.number().int().min(64).max(2048).default(448)
12723
+ });
12521
12724
  /** Client-supplied rule fields (server stamps id/createdBy/createdAt/updatedAt). */
12522
12725
  var NcRuleInputSchema = z.object({
12523
12726
  name: z.string().min(1).max(200),
@@ -12578,7 +12781,13 @@ var NcRuleInputSchema = z.object({
12578
12781
  * `{ cap: 'alarm-panel', method: 'arm', args: { mode: 'away' } }`, the same
12579
12782
  * shape as every other actuation.
12580
12783
  */
12581
- actions: NcRuleActionsSchema.optional()
12784
+ actions: NcRuleActionsSchema.optional(),
12785
+ /**
12786
+ * AI CONFIRM — see {@link NcConfirmSchema}. `.optional()`, never defaulted:
12787
+ * a rule that predates the gate must keep delivering byte-for-byte as it
12788
+ * did, and absent is the only way to say that without a migration.
12789
+ */
12790
+ confirm: NcConfirmSchema.optional()
12582
12791
  });
12583
12792
  /**
12584
12793
  * Partial patch for `updateRule` — any subset of the input fields, plus the
@@ -12589,7 +12798,37 @@ var NcRuleInputSchema = z.object({
12589
12798
  * still flow through `nc.setRuleTargetEnabled` (owner-checked), never a raw
12590
12799
  * `updateRule` patch.
12591
12800
  */
12592
- var NcRulePatchSchema = NcRuleInputSchema.partial().extend({ disabledTargetIds: z.array(z.string()).optional() });
12801
+ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
12802
+ disabledTargetIds: z.array(z.string()).optional(),
12803
+ /**
12804
+ * `.partial()` DOES NOT REMOVE A FIELD'S `.default()`.
12805
+ *
12806
+ * It makes the key optional to SUPPLY; the parse still materialises the
12807
+ * default when the key is absent. And `NcRuleStore.update` merges with
12808
+ * `{ ...existing, ...patch }`, so a materialised key OVERWRITES the stored
12809
+ * one — which made every partial edit destructive:
12810
+ *
12811
+ * nc.updateRule({ throttle }) → conditions reset to `{}`
12812
+ * nc.setRuleTargetEnabled(...) → conditions reset to `{}`
12813
+ * setEnabled(ruleId, false) → conditions reset to `{}`
12814
+ *
12815
+ * A rule scoped to one camera and one zone silently became a rule that
12816
+ * matches EVERY event on EVERY camera, and lost its `media` policy
12817
+ * (zoneCrop / gif / clip / frame) and its `priority` at the same time. Seen
12818
+ * live on 2026-08-12: a rule scoped to device 617 fired on 590 and 615
12819
+ * within a minute of a two-field patch.
12820
+ *
12821
+ * So every defaulted field is re-declared here WITHOUT its default. The
12822
+ * inner defaults still apply when the caller DOES send the key — `{}` for
12823
+ * conditions remains a real instruction ("clear them") — and only the
12824
+ * absent key is now genuinely absent.
12825
+ */
12826
+ enabled: z.boolean().optional(),
12827
+ conditions: NcConditionsSchema.optional(),
12828
+ media: NcMediaPolicySchema.optional(),
12829
+ throttle: NcThrottleSchema.optional(),
12830
+ priority: z.number().int().min(1).max(5).optional()
12831
+ });
12593
12832
  /** A persisted rule. */
12594
12833
  var NcRuleSchema = NcRuleInputSchema.extend({
12595
12834
  id: z.string(),
@@ -12890,6 +13129,25 @@ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
12890
13129
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
12891
13130
  * copy would lie the first time a rule is disabled.
12892
13131
  */
13132
+ /**
13133
+ * Why a device a mode NAMES is nonetheless not armed by it.
13134
+ *
13135
+ * Each value is an existing authority, never a new flag (D62): `muted` is the
13136
+ * per-camera notification switch the Notification Center already owns,
13137
+ * `detection-off` is the device's own detection binding being inactive, and
13138
+ * `offline` is the device manager's liveness. A fourth reason would mean a
13139
+ * fourth authority, and inventing one here is how a panel starts disagreeing
13140
+ * with the switches the operator actually used.
13141
+ */
13142
+ var NcAlarmSkipReasonSchema = z.enum([
13143
+ "muted",
13144
+ "detection-off",
13145
+ "offline"
13146
+ ]);
13147
+ var NcAlarmSkippedDeviceSchema = z.object({
13148
+ deviceId: z.number().int(),
13149
+ reason: NcAlarmSkipReasonSchema
13150
+ });
12893
13151
  var NcAlarmModeCoverageSchema = z.object({
12894
13152
  mode: AlarmArmModeSchema,
12895
13153
  /** Enabled rules gated on `armed_<mode>`. Zero means the mode does nothing. */
@@ -12897,7 +13155,18 @@ var NcAlarmModeCoverageSchema = z.object({
12897
13155
  /** At least one covering rule has no device scope, so the mode covers all. */
12898
13156
  allDevices: z.boolean(),
12899
13157
  /** Ids named by the covering rules. A SUBSET when `allDevices` is true. */
12900
- deviceIds: z.array(z.number().int())
13158
+ deviceIds: z.array(z.number().int()),
13159
+ /**
13160
+ * Devices this mode NAMES but cannot actually arm, each with the switch that
13161
+ * excludes it.
13162
+ *
13163
+ * "Away armed — 12 cameras" is a promise, and a muted camera among those
13164
+ * twelve makes it false in exactly the way nobody notices until an incident.
13165
+ * Defaulted to `[]` so a coverage answer computed before this field existed
13166
+ * still parses as "nothing known to be skipped" rather than failing the whole
13167
+ * alarm tab.
13168
+ */
13169
+ skippedDevices: z.array(NcAlarmSkippedDeviceSchema).default([])
12901
13170
  });
12902
13171
  var NcAlarmConfigSchema = z.object({
12903
13172
  /**
@@ -24998,7 +25267,19 @@ var RecordingManifestSchema = z.object({
24998
25267
  * profiles/subtrees/locations on this node). */
24999
25268
  var RecordingDeviceUsageSchema = z.object({
25000
25269
  deviceId: z.number(),
25001
- usedBytes: z.number()
25270
+ usedBytes: z.number(),
25271
+ /**
25272
+ * Start of this camera's OLDEST indexed segment, across every profile and
25273
+ * location — the "Oldest footage" column in Recordings → Storage, and the
25274
+ * only honest answer to "is retention actually holding?" per camera.
25275
+ *
25276
+ * `null` = the camera has no footage. OPTIONAL because a recorder that
25277
+ * predates this field omits it entirely, and a hub whose types carry the
25278
+ * field must keep validating that older provider's payload: the framework
25279
+ * (types) and the addon ship on different trains, and the addon is usually
25280
+ * the later of the two.
25281
+ */
25282
+ oldestMs: z.number().nullable().optional()
25002
25283
  });
25003
25284
  /** Recording storage usage + capacity for one storage location. */
25004
25285
  var RecordingLocationUsageSchema = z.object({
@@ -25026,6 +25307,57 @@ var RecordingStorageUsageSchema = z.object({
25026
25307
  locations: z.array(RecordingLocationUsageSchema)
25027
25308
  });
25028
25309
  /**
25310
+ * The OPERATOR-ARMED half of multi-location recordings (D116).
25311
+ *
25312
+ * The placement plan decides where NEW writes go and moves nothing. A rebalance
25313
+ * is the operator asking for the EXISTING archive to be brought into line with
25314
+ * that plan: one relocate job per (camera, profile) pile that sits on the wrong
25315
+ * location, run FIFO behind the single-flight mover.
25316
+ *
25317
+ * `plan…` and `start…` return the SAME shape deliberately — what the operator
25318
+ * confirms is exactly what gets enqueued, and `jobIds` is the only difference
25319
+ * (empty on the plan).
25320
+ */
25321
+ var RecordingRebalanceMoveSchema = z.object({
25322
+ deviceId: z.number(),
25323
+ profile: z.string(),
25324
+ fromLocationId: z.string(),
25325
+ toLocationId: z.string(),
25326
+ bytes: z.number(),
25327
+ files: z.number().int()
25328
+ });
25329
+ /** Why a pile that is out of place is staying there. Every refusal is
25330
+ * reported: a rebalance that silently drops a camera reads exactly like one
25331
+ * that had nothing to do. */
25332
+ var RecordingRebalanceSkipReasonSchema = z.enum([
25333
+ "unassigned",
25334
+ "target-not-writable",
25335
+ "below-threshold",
25336
+ "no-headroom"
25337
+ ]);
25338
+ var RecordingRebalanceSkipSchema = z.object({
25339
+ deviceId: z.number(),
25340
+ profile: z.string(),
25341
+ fromLocationId: z.string(),
25342
+ /** The location the plan wants; null when the camera has no assignment. */
25343
+ toLocationId: z.string().nullable(),
25344
+ bytes: z.number(),
25345
+ reason: RecordingRebalanceSkipReasonSchema
25346
+ });
25347
+ var RecordingRebalancePlanSchema = z.object({
25348
+ moves: z.array(RecordingRebalanceMoveSchema),
25349
+ skipped: z.array(RecordingRebalanceSkipSchema),
25350
+ bytesToMove: z.number(),
25351
+ /** Relocate job ids enqueued. Always empty for the plan (dry-run) call. */
25352
+ jobIds: z.array(z.string())
25353
+ });
25354
+ var RecordingRebalanceInputSchema = z.object({
25355
+ /** Copy throttle in MB/s (default 40) — a rebalance is a background chore. */
25356
+ throttleMbps: z.number().min(1).max(1e3).optional(),
25357
+ /** Ignore piles smaller than this (default 1 GB). */
25358
+ minMoveGb: z.number().min(0).optional()
25359
+ });
25360
+ /**
25029
25361
  * Result of locating footage at a wall-clock instant for one device/profile.
25030
25362
  * `segment` carries the covering segment's window; `gap` reports the forward
25031
25363
  * nearest covered edge (`null` past the end of footage / when none exists)
@@ -25269,6 +25601,36 @@ var recordingCapability = {
25269
25601
  cancelStorageMigrationMove: method(z.object({ jobId: z.string() }), z.object({ cancelled: z.boolean() }), {
25270
25602
  kind: "mutation",
25271
25603
  auth: "admin"
25604
+ }),
25605
+ /**
25606
+ * Move footage between locations — the OPERATOR's mover, scoped to one
25607
+ * camera (and optionally to specific profiles) rather than a whole disk.
25608
+ * Queued FIFO behind the single-flight engine, so arming several is safe.
25609
+ */
25610
+ relocateFootage: method(RelocateFootageInputSchema, z.object({ jobId: z.string() }), {
25611
+ kind: "mutation",
25612
+ auth: "admin"
25613
+ }),
25614
+ /** Every relocate job this recorder knows about, newest first (in RAM: the
25615
+ * move is resumable, so a lost list costs nothing but the display). */
25616
+ listRelocateJobs: method(z.object({}), z.array(RelocateJobSchema).readonly(), {
25617
+ kind: "query",
25618
+ auth: "admin"
25619
+ }),
25620
+ /** Cancel a running or queued relocate job. A queued job never runs. */
25621
+ cancelRelocateJob: method(z.object({ jobId: z.string() }), z.object({ cancelled: z.boolean() }), {
25622
+ kind: "mutation",
25623
+ auth: "admin"
25624
+ }),
25625
+ /** What a rebalance WOULD move, and what it would refuse. Moves nothing. */
25626
+ planStorageRebalance: method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25627
+ kind: "query",
25628
+ auth: "admin"
25629
+ }),
25630
+ /** Arm the rebalance: enqueue one relocate job per planned move. */
25631
+ startStorageRebalance: method(RecordingRebalanceInputSchema, RecordingRebalancePlanSchema, {
25632
+ kind: "mutation",
25633
+ auth: "admin"
25272
25634
  })
25273
25635
  }
25274
25636
  };
@@ -32015,6 +32377,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32015
32377
  addonId: null,
32016
32378
  access: "create"
32017
32379
  },
32380
+ "recording.cancelRelocateJob": {
32381
+ capName: "recording",
32382
+ capScope: "system",
32383
+ addonId: null,
32384
+ access: "create"
32385
+ },
32018
32386
  "recording.cancelStorageMigrationMove": {
32019
32387
  capName: "recording",
32020
32388
  capScope: "system",
@@ -32069,6 +32437,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32069
32437
  addonId: null,
32070
32438
  access: "view"
32071
32439
  },
32440
+ "recording.listRelocateJobs": {
32441
+ capName: "recording",
32442
+ capScope: "system",
32443
+ addonId: null,
32444
+ access: "view"
32445
+ },
32072
32446
  "recording.locateSegment": {
32073
32447
  capName: "recording",
32074
32448
  capScope: "system",
@@ -32081,6 +32455,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32081
32455
  addonId: null,
32082
32456
  access: "create"
32083
32457
  },
32458
+ "recording.planStorageRebalance": {
32459
+ capName: "recording",
32460
+ capScope: "system",
32461
+ addonId: null,
32462
+ access: "view"
32463
+ },
32084
32464
  "recording.pruneFootage": {
32085
32465
  capName: "recording",
32086
32466
  capScope: "system",
@@ -32105,6 +32485,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32105
32485
  addonId: null,
32106
32486
  access: "create"
32107
32487
  },
32488
+ "recording.relocateFootage": {
32489
+ capName: "recording",
32490
+ capScope: "system",
32491
+ addonId: null,
32492
+ access: "create"
32493
+ },
32108
32494
  "recording.renderClip": {
32109
32495
  capName: "recording",
32110
32496
  capScope: "system",
@@ -32141,6 +32527,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
32141
32527
  addonId: null,
32142
32528
  access: "create"
32143
32529
  },
32530
+ "recording.startStorageRebalance": {
32531
+ capName: "recording",
32532
+ capScope: "system",
32533
+ addonId: null,
32534
+ access: "create"
32535
+ },
32144
32536
  "recordingExport.cancelExport": {
32145
32537
  capName: "recording-export",
32146
32538
  capScope: "system",
@@ -33555,6 +33947,104 @@ var FramerateField = z.number().int().min(1).max(60);
33555
33947
  var TargetsField = z.array(NcRuleTargetSchema).min(1);
33556
33948
  var PriorityField = z.number().int().min(1).max(5);
33557
33949
  /**
33950
+ * Explicit override of the DENSE sampling cadence, seconds.
33951
+ *
33952
+ * Absent ⇒ derived as `max(1s, cadenceSec / 30)` — a 30 s base samples every
33953
+ * 1 s inside a detection range. (It was `base / 10` until 2026-08-12, which
33954
+ * made that same base 3 s and rendered a person pass as two frames.)
33955
+ *
33956
+ * THE ARITHMETIC. A detection range of `rangeSec` seconds sampled every
33957
+ * `denseCadenceSec` and played at `framerate` occupies
33958
+ *
33959
+ * outputSeconds = (rangeSec / denseCadenceSec) / framerate
33960
+ *
33961
+ * 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.
33962
+ * Halving this field doubles the frames INSIDE ranges only — the base cadence,
33963
+ * and therefore the length of a quiet night, does not move.
33964
+ *
33965
+ * Floored at {@link TIMELAPSE_DENSE_FLOOR_SEC}: asking for frames faster than
33966
+ * the recording has them returns the same frames, requested twice. Must be
33967
+ * STRICTLY smaller than `cadenceSec` — a dense rate that is not denser renders
33968
+ * a uniform video the operator believes is two-rate — and upsert refuses it
33969
+ * rather than letting the export cap reject the render hours after the window.
33970
+ */
33971
+ var DenseCadenceSecField = z.number().min(.1).max(3600);
33972
+ /**
33973
+ * Minimum seconds of OUTPUT video each detection range must occupy.
33974
+ *
33975
+ * The operator-facing form of the arithmetic above: instead of solving for a
33976
+ * cadence, state the dwell and let the renderer solve. `minDwellSec: 1` on a
33977
+ * 30 s base at 12 fps turns a 7 s pass into a full second of video by sampling
33978
+ * that range every ~583 ms.
33979
+ *
33980
+ * ONE CADENCE SERVES EVERY RANGE. `ExportDenseSchema.everyMs` is global — the
33981
+ * ranges are terms of a single ffmpeg `select` expression that cannot vary rate
33982
+ * per term — so the MOST DEMANDING (shortest) range sets the rate and longer
33983
+ * ranges are sampled denser than they need. Per-range cadences require a cap
33984
+ * schema change and are the tracked follow-up.
33985
+ *
33986
+ * A range too short to reach the dwell even at {@link TIMELAPSE_DENSE_FLOOR_SEC}
33987
+ * is rendered with every frame that EXISTS and no more: the guarantee is capped
33988
+ * by real footage, never met by duplicating frames into motion that never
33989
+ * happened.
33990
+ */
33991
+ var MinDwellSecField = z.number().min(0).max(60);
33992
+ /**
33993
+ * Caption burned into the notification's preview frame.
33994
+ *
33995
+ * Same `{{var}}` vocabulary as {@link TimelapseTemplateSchema} (`camera`,
33996
+ * `rule`, `from`, `to`) and rendered by the SAME renderer — a second
33997
+ * templating dialect for one field would be a second thing to explain.
33998
+ *
33999
+ * Absent ⇒ {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}. An EMPTY STRING is the
34000
+ * operator saying "the frame, no caption" — a distinct, reachable answer, and
34001
+ * the reason this is not `.min(1)`.
34002
+ */
34003
+ var PreviewTextField = z.string().max(200);
34004
+ /**
34005
+ * Whether the notification's preview is a STILL or a short animation.
34006
+ *
34007
+ * The operator's ask, verbatim: *"inviato come gif o video (come per le altre
34008
+ * rule)"* — his Scrypted advanced-notifier has a `gifRule`, and a ten-hour
34009
+ * night reads better as three seconds of motion than as one frame of it. Both
34010
+ * modes get the SAME treatment (blurred frame, large centred title); `'gif'`
34011
+ * simply applies it to a dozen frames sampled across the render and assembles
34012
+ * them.
34013
+ *
34014
+ * `'image'` is the default and stays the default: a GIF costs a dozen ffmpeg
34015
+ * seeks and a palette pass, and no rule that never asked for one should start
34016
+ * paying that on the deploy that shipped it.
34017
+ *
34018
+ * A GIF that cannot be assembled DEGRADES to the still — never to nothing.
34019
+ */
34020
+ var PreviewModeField = z.enum(["image", "gif"]);
34021
+ /**
34022
+ * Which detection classes the notification reports counts for.
34023
+ *
34024
+ * The counts come from the tracks the render ALREADY fetched for its dense-range
34025
+ * plan — no second query — aggregated per class. Absent or empty means "every
34026
+ * class the window actually contained", which is what an operator who never
34027
+ * opened the field wants; a list narrows it (`['person']` on a driveway that
34028
+ * counts cars all night).
34029
+ *
34030
+ * Class names are the tracker's own (`person`, `vehicle`, `animal`, `package`,
34031
+ * …). An unknown name simply never matches and reports nothing — it is not an
34032
+ * error, because a rule may legitimately name a class this camera's model does
34033
+ * not emit.
34034
+ *
34035
+ * The counts are exposed to {@link TimelapseTemplateSchema} as:
34036
+ * - `{{detections}}` — total over the reported classes
34037
+ * - `{{detectionSummary}}` — `2 persone, 1 veicolo`
34038
+ * - `{{count_person}}` / `{{count_vehicle}}` / `{{count_animal}}` / … —
34039
+ * one per class, `count_` + the class name
34040
+ *
34041
+ * With NO custom body template the summary is appended to the derived body, and
34042
+ * only when the total is non-zero: a nightly `0 rilevamenti` is a line nobody
34043
+ * reads. With a custom template the operator owns every word — nothing is
34044
+ * appended, so `{{detectionSummary}}` is how he asks for it.
34045
+ */
34046
+ var ReportClassesField = z.array(z.string().min(1).max(40)).max(20);
34047
+ /**
33558
34048
  * Client-supplied timelapse-rule fields. The server stamps id / createdBy /
33559
34049
  * createdAt / updatedAt / ownerUserId / lastGeneratedAt — none of them appear
33560
34050
  * here (see the ownership note above).
@@ -33574,9 +34064,30 @@ var TimelapseRuleInputSchema = z.object({
33574
34064
  cadenceSec: CadenceSecField.default(15),
33575
34065
  /** Output frames per second of the assembled mp4 (predecessor parity). */
33576
34066
  framerate: FramerateField.default(10),
34067
+ /**
34068
+ * Explicit dense cadence — see {@link DenseCadenceSecField}. Absent ⇒ derived
34069
+ * as `max(1s, cadenceSec / 30)`, which is what every rule written before this
34070
+ * field gets.
34071
+ */
34072
+ denseCadenceSec: DenseCadenceSecField.optional(),
34073
+ /** Output-seconds guarantee per detection range — see {@link MinDwellSecField}. */
34074
+ minDwellSec: MinDwellSecField.optional(),
33577
34075
  /** `notification-output` targets the finished video/thumbnail is sent to. */
33578
34076
  targets: TargetsField,
33579
34077
  template: TimelapseTemplateSchema.optional(),
34078
+ /**
34079
+ * Caption on the notification's PREVIEW FRAME — see {@link PreviewTextField}
34080
+ * and {@link DEFAULT_TIMELAPSE_PREVIEW_TEXT}.
34081
+ *
34082
+ * Deliberately NOT part of {@link TimelapseTemplateSchema}: that object is
34083
+ * the notification's title/body, and clearing it (`template: null`) must not
34084
+ * silently clear the caption too.
34085
+ */
34086
+ previewText: PreviewTextField.optional(),
34087
+ /** Still or animation — see {@link PreviewModeField}. */
34088
+ previewMode: PreviewModeField.default("image"),
34089
+ /** Classes the notification counts — see {@link ReportClassesField}. */
34090
+ reportClasses: ReportClassesField.optional(),
33580
34091
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
33581
34092
  priority: PriorityField.default(3)
33582
34093
  });
@@ -33587,8 +34098,13 @@ z.object({
33587
34098
  schedule: NcScheduleSchema.optional(),
33588
34099
  cadenceSec: CadenceSecField.optional(),
33589
34100
  framerate: FramerateField.optional(),
34101
+ denseCadenceSec: DenseCadenceSecField.optional(),
34102
+ minDwellSec: MinDwellSecField.optional(),
33590
34103
  targets: TargetsField.optional(),
33591
34104
  template: TimelapseTemplateSchema.nullable().optional(),
34105
+ previewText: PreviewTextField.optional(),
34106
+ previewMode: PreviewModeField.optional(),
34107
+ reportClasses: ReportClassesField.optional(),
33592
34108
  priority: PriorityField.optional()
33593
34109
  });
33594
34110
  TimelapseRuleInputSchema.extend({