@camstack/addon-provider-hikvision 1.2.85 → 1.2.87

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 (3) hide show
  1. package/dist/addon.js +158 -141
  2. package/dist/addon.mjs +158 -141
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -7610,111 +7610,6 @@ var CameraSwitchGroupSchema = object({
7610
7610
  fetchedAt: number()
7611
7611
  });
7612
7612
  /**
7613
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7614
- * an addon declares its channels in.
7615
- *
7616
- * ## Two axes, deliberately separated
7617
- *
7618
- * - **DECLARATION** — which channels exist. Only the addon knows:
7619
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7620
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7621
- * and rots silently. So a channel is declared where it is consulted, and the
7622
- * `log-channels` capability enumerates the declarations.
7623
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7624
- * thing: the logging settings document on the `system` cap. Two authorities
7625
- * over the values is the exact defect
7626
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7627
- * remove; re-introducing it from the cure side would be grotesque.
7628
- *
7629
- * Nothing in this file reads a clock, an env var or a store. The registry is
7630
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7631
- * the hot path with a value somebody actually read, and by
7632
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7633
- * never reaches here, so it can neither disarm an armed channel nor arm a
7634
- * disarmed one (D49).
7635
- *
7636
- * ## The canonical call shape
7637
- *
7638
- * ```ts
7639
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7640
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7641
- * }
7642
- * ```
7643
- *
7644
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7645
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7646
- * object literal is never constructed because it lives inside the branch. It
7647
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7648
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7649
- * destination floor (measured at 1.93 ns/call when off).
7650
- *
7651
- * ## Why a channel emits at `info`
7652
- *
7653
- * `loki-logging.addon.ts` pins the destination default at `info` and
7654
- * `loki-destination.ts` drops everything below it, so a line emitted at
7655
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7656
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7657
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7658
- * emits at the channel's declared level, whose schema floor is `info`.
7659
- */
7660
- /**
7661
- * The level a channel writes at once armed.
7662
- *
7663
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7664
- * not leave the process for Loki, and the whole point of arming a channel is
7665
- * to read it later.
7666
- */
7667
- var LogChannelLevelSchema = _enum([
7668
- "info",
7669
- "warn",
7670
- "error"
7671
- ]);
7672
- /**
7673
- * What an addon declares about one channel. No value, no state — a
7674
- * declaration is inert.
7675
- */
7676
- var LogChannelDescriptorSchema = object({
7677
- /**
7678
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7679
- * the addon's short name so an operator reading a channel list can tell who
7680
- * owns it without a second lookup.
7681
- */
7682
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7683
- /** One sentence: what the operator will SEE after arming it. */
7684
- description: string().min(1),
7685
- /** The level its lines are emitted at. Never below `info`. */
7686
- defaultLevel: LogChannelLevelSchema,
7687
- /**
7688
- * Whether this channel can be narrowed to a camera.
7689
- *
7690
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7691
- * consulted with the numeric device id, AND every line the channel admits
7692
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7693
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7694
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7695
- * the body is the only way to filter.
7696
- *
7697
- * A channel whose lines carry the device only in `meta` (or not at all) is
7698
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7699
- * the operator narrows to one camera, sees nothing, and concludes the code
7700
- * path was never taken.
7701
- */
7702
- perDevice: boolean()
7703
- });
7704
- /**
7705
- * An armed window over one channel, as the document hands it to a mirror.
7706
- *
7707
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7708
- * expires by itself, which is the one failure a boolean cannot avoid.
7709
- */
7710
- var LogChannelWindowSchema = object({
7711
- channel: string().min(1),
7712
- /** Epoch ms the window closes at. */
7713
- armedUntilMs: number(),
7714
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7715
- deviceIds: array(number().int()).readonly().nullable()
7716
- });
7717
- /**
7718
7613
  * Ops-log — the durable, append-only operations audit shared by the
7719
7614
  * recordings and events management surfaces.
7720
7615
  *
@@ -8660,8 +8555,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8660
8555
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8661
8556
  *
8662
8557
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8663
- * The default location for a type uses `id === <type>:default` by
8664
- * convention (the bare type ref like `'backups'` resolves to it).
8558
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8559
+ * There is no default location any more (D383): `enabled` is the whole write
8560
+ * model, and a bare type ref resolves to the sole location of the type, or —
8561
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8562
+ * slug is `default`.
8665
8563
  *
8666
8564
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8667
8565
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8682,21 +8580,20 @@ var StorageLocationSchema = object({
8682
8580
  * flag at upsert time, not here (the schema is provider-agnostic).
8683
8581
  */
8684
8582
  nodeId: string().optional(),
8685
- isDefault: boolean().default(false),
8686
8583
  isSystem: boolean().default(false),
8687
8584
  /**
8688
- * Operator opt-in: whether consumers that BALANCE across several locations
8689
- * of a type may write here. Recordings reads it today; event media and
8690
- * backups are the next consumers, which is why the flag lives on the
8691
- * location rather than in any one addon's store — nothing has to be
8692
- * extended to add the next consumer.
8585
+ * THE write switch, and the only one (D383). `enabled: true` means every
8586
+ * consumer that chooses a write target for this type may write here, and all
8587
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
8588
+ * still read, still played back, still age-swept, still drained, never
8589
+ * written.
8693
8590
  *
8694
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8695
- * flag existed reads back with no flag and keeps working exactly as before;
8696
- * that is the whole compat story, and it is why no migration ships with it.
8697
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8698
- * disk must not silently start writing to it); the default of a type is
8699
- * always stamped `true`.
8591
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8592
+ * stored" on an update and "born inert unless it is the first location of its
8593
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8594
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
8595
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8596
+ * stops existing rather than being re-derived on every read.
8700
8597
  */
8701
8598
  enabled: boolean().optional(),
8702
8599
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
@@ -8709,10 +8606,12 @@ var StorageLocationSchema = object({
8709
8606
  createdAt: number(),
8710
8607
  updatedAt: number()
8711
8608
  });
8609
+ object({ isDefault: boolean().optional() });
8712
8610
  /**
8713
8611
  * Reference accepted by consumer-facing `api.storage.*` calls.
8714
8612
  * Either:
8715
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8613
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8614
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8716
8615
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8717
8616
  *
8718
8617
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -9064,6 +8963,111 @@ function findTimezone(id) {
9064
8963
  return TIMEZONES.find((tz) => tz.id === id);
9065
8964
  }
9066
8965
  /**
8966
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8967
+ * an addon declares its channels in.
8968
+ *
8969
+ * ## Two axes, deliberately separated
8970
+ *
8971
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8972
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8973
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8974
+ * and rots silently. So a channel is declared where it is consulted, and the
8975
+ * `log-channels` capability enumerates the declarations.
8976
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8977
+ * thing: the logging settings document on the `system` cap. Two authorities
8978
+ * over the values is the exact defect
8979
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8980
+ * remove; re-introducing it from the cure side would be grotesque.
8981
+ *
8982
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8983
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8984
+ * the hot path with a value somebody actually read, and by
8985
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8986
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8987
+ * disarmed one (D49).
8988
+ *
8989
+ * ## The canonical call shape
8990
+ *
8991
+ * ```ts
8992
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8993
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8994
+ * }
8995
+ * ```
8996
+ *
8997
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8998
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8999
+ * object literal is never constructed because it lives inside the branch. It
9000
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
9001
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
9002
+ * destination floor (measured at 1.93 ns/call when off).
9003
+ *
9004
+ * ## Why a channel emits at `info`
9005
+ *
9006
+ * `loki-logging.addon.ts` pins the destination default at `info` and
9007
+ * `loki-destination.ts` drops everything below it, so a line emitted at
9008
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
9009
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
9010
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
9011
+ * emits at the channel's declared level, whose schema floor is `info`.
9012
+ */
9013
+ /**
9014
+ * The level a channel writes at once armed.
9015
+ *
9016
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
9017
+ * not leave the process for Loki, and the whole point of arming a channel is
9018
+ * to read it later.
9019
+ */
9020
+ var LogChannelLevelSchema = _enum([
9021
+ "info",
9022
+ "warn",
9023
+ "error"
9024
+ ]);
9025
+ /**
9026
+ * What an addon declares about one channel. No value, no state — a
9027
+ * declaration is inert.
9028
+ */
9029
+ var LogChannelDescriptorSchema = object({
9030
+ /**
9031
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
9032
+ * the addon's short name so an operator reading a channel list can tell who
9033
+ * owns it without a second lookup.
9034
+ */
9035
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9036
+ /** One sentence: what the operator will SEE after arming it. */
9037
+ description: string().min(1),
9038
+ /** The level its lines are emitted at. Never below `info`. */
9039
+ defaultLevel: LogChannelLevelSchema,
9040
+ /**
9041
+ * Whether this channel can be narrowed to a camera.
9042
+ *
9043
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9044
+ * consulted with the numeric device id, AND every line the channel admits
9045
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9046
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9047
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9048
+ * the body is the only way to filter.
9049
+ *
9050
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9051
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9052
+ * the operator narrows to one camera, sees nothing, and concludes the code
9053
+ * path was never taken.
9054
+ */
9055
+ perDevice: boolean()
9056
+ });
9057
+ /**
9058
+ * An armed window over one channel, as the document hands it to a mirror.
9059
+ *
9060
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9061
+ * expires by itself, which is the one failure a boolean cannot avoid.
9062
+ */
9063
+ var LogChannelWindowSchema = object({
9064
+ channel: string().min(1),
9065
+ /** Epoch ms the window closes at. */
9066
+ armedUntilMs: number(),
9067
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9068
+ deviceIds: array(number().int()).readonly().nullable()
9069
+ });
9070
+ /**
9067
9071
  * Distinct (device, family, variant) counters one instance will hold.
9068
9072
  *
9069
9073
  * A large fleet x the handful of families any single addon reports, with
@@ -10825,12 +10829,30 @@ var BackupDestinationInfoSchema = object({
10825
10829
  lastSuccessAt: number().optional(),
10826
10830
  /** Newest-archive size from `manifests.json`, or undefined. */
10827
10831
  lastSuccessSizeBytes: number().optional(),
10828
- /** Per-destination cron expression. Empty = manual-only (no schedule). */
10832
+ /**
10833
+ * Cron cadence(s) of the ENABLED schedules that fan out to this
10834
+ * destination, comma-joined. Absent when no enabled schedule targets it
10835
+ * — a destination nothing is scheduled to write to must not advertise a
10836
+ * cadence (D384). This is never the `backup_destination_policies.cron`
10837
+ * column: that per-location cron has scheduled nothing since 2026-07-28
10838
+ * and reading it made a destination with a DISABLED schedule claim a
10839
+ * nightly run.
10840
+ */
10829
10841
  cron: string().optional(),
10830
- /** ms-epoch of next computed firing for this destination's cron, if any. */
10842
+ /** ms-epoch of the next firing across those schedules (earliest), if any. */
10831
10843
  nextRunAt: number().optional(),
10832
- /** ms-epoch of last successful scheduled run (mirrors policy.lastRunAt). */
10833
- lastRunAt: number().optional()
10844
+ /**
10845
+ * ms-epoch of the last time a run ATTEMPTED to write here — success or
10846
+ * failure. Never a success stamp: pair it with `lastSuccessAt` (the
10847
+ * newest archive that actually landed) and `lastError`.
10848
+ */
10849
+ lastAttemptAt: number().optional(),
10850
+ /**
10851
+ * Why the last attempt failed, verbatim. Absent when the last attempt
10852
+ * landed the archive. A destination that has never been written to has
10853
+ * neither this nor `lastAttemptAt`.
10854
+ */
10855
+ lastError: string().optional()
10834
10856
  });
10835
10857
  /**
10836
10858
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
@@ -10993,8 +11015,16 @@ var BackupScheduleSchema = object({
10993
11015
  retentionCount: number().int().min(1).max(1e3),
10994
11016
  /** Optional subset of source locations to include; omitted = all. */
10995
11017
  dataSources: array(string()).readonly().optional(),
10996
- /** ms-epoch of last successful run. */
10997
- lastRunAt: number().optional(),
11018
+ /**
11019
+ * ms-epoch of the last tick that FIRED this schedule. Stamped before the
11020
+ * archive runs (it is the dedupe anchor), so it says "attempted", never
11021
+ * "succeeded" — a run refused by every destination stamps it too.
11022
+ */
11023
+ lastAttemptAt: number().optional(),
11024
+ /** ms-epoch of the last run of this schedule that landed at ≥1 destination. */
11025
+ lastSuccessAt: number().optional(),
11026
+ /** Why the last fired run failed, verbatim. Absent when it succeeded. */
11027
+ lastError: string().optional(),
10998
11028
  /** ms-epoch of next computed firing (read-only, filled on list). */
10999
11029
  nextRunAt: number().optional()
11000
11030
  });
@@ -11043,14 +11073,7 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
11043
11073
  locationId: string(),
11044
11074
  enabled: boolean(),
11045
11075
  retentionCount: number().int().min(1).max(1e3),
11046
- label: string().optional(),
11047
- /**
11048
- * Per-destination cron expression. Empty string clears the
11049
- * schedule (manual-only). Validated server-side via croner;
11050
- * malformed expressions reject the upsert with an actionable
11051
- * message.
11052
- */
11053
- cron: string().optional()
11076
+ label: string().optional()
11054
11077
  }), _void(), {
11055
11078
  kind: "mutation",
11056
11079
  auth: "admin"
@@ -22317,7 +22340,7 @@ method(object({
22317
22340
  downloadId: string(),
22318
22341
  offset: number(),
22319
22342
  length: number()
22320
- }), _instanceof(Uint8Array)), method(object({ downloadId: string() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(object({ type: StorageLocationTypeSchema }), StorageLocationSchema.nullable()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
22343
+ }), _instanceof(Uint8Array)), method(object({ downloadId: string() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
22321
22344
  createdAt: true,
22322
22345
  updatedAt: true
22323
22346
  }), StorageLocationSchema, {
@@ -39726,12 +39749,6 @@ Object.freeze({
39726
39749
  addonId: null,
39727
39750
  access: "view"
39728
39751
  },
39729
- "storage.getDefaultLocation": {
39730
- capName: "storage",
39731
- capScope: "system",
39732
- addonId: null,
39733
- access: "view"
39734
- },
39735
39752
  "storage.list": {
39736
39753
  capName: "storage",
39737
39754
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -7611,111 +7611,6 @@ var CameraSwitchGroupSchema = object({
7611
7611
  fetchedAt: number()
7612
7612
  });
7613
7613
  /**
7614
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7615
- * an addon declares its channels in.
7616
- *
7617
- * ## Two axes, deliberately separated
7618
- *
7619
- * - **DECLARATION** — which channels exist. Only the addon knows:
7620
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7621
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7622
- * and rots silently. So a channel is declared where it is consulted, and the
7623
- * `log-channels` capability enumerates the declarations.
7624
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7625
- * thing: the logging settings document on the `system` cap. Two authorities
7626
- * over the values is the exact defect
7627
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7628
- * remove; re-introducing it from the cure side would be grotesque.
7629
- *
7630
- * Nothing in this file reads a clock, an env var or a store. The registry is
7631
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7632
- * the hot path with a value somebody actually read, and by
7633
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7634
- * never reaches here, so it can neither disarm an armed channel nor arm a
7635
- * disarmed one (D49).
7636
- *
7637
- * ## The canonical call shape
7638
- *
7639
- * ```ts
7640
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7641
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7642
- * }
7643
- * ```
7644
- *
7645
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7646
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7647
- * object literal is never constructed because it lives inside the branch. It
7648
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7649
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7650
- * destination floor (measured at 1.93 ns/call when off).
7651
- *
7652
- * ## Why a channel emits at `info`
7653
- *
7654
- * `loki-logging.addon.ts` pins the destination default at `info` and
7655
- * `loki-destination.ts` drops everything below it, so a line emitted at
7656
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7657
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7658
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7659
- * emits at the channel's declared level, whose schema floor is `info`.
7660
- */
7661
- /**
7662
- * The level a channel writes at once armed.
7663
- *
7664
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7665
- * not leave the process for Loki, and the whole point of arming a channel is
7666
- * to read it later.
7667
- */
7668
- var LogChannelLevelSchema = _enum([
7669
- "info",
7670
- "warn",
7671
- "error"
7672
- ]);
7673
- /**
7674
- * What an addon declares about one channel. No value, no state — a
7675
- * declaration is inert.
7676
- */
7677
- var LogChannelDescriptorSchema = object({
7678
- /**
7679
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7680
- * the addon's short name so an operator reading a channel list can tell who
7681
- * owns it without a second lookup.
7682
- */
7683
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7684
- /** One sentence: what the operator will SEE after arming it. */
7685
- description: string().min(1),
7686
- /** The level its lines are emitted at. Never below `info`. */
7687
- defaultLevel: LogChannelLevelSchema,
7688
- /**
7689
- * Whether this channel can be narrowed to a camera.
7690
- *
7691
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7692
- * consulted with the numeric device id, AND every line the channel admits
7693
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7694
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7695
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7696
- * the body is the only way to filter.
7697
- *
7698
- * A channel whose lines carry the device only in `meta` (or not at all) is
7699
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7700
- * the operator narrows to one camera, sees nothing, and concludes the code
7701
- * path was never taken.
7702
- */
7703
- perDevice: boolean()
7704
- });
7705
- /**
7706
- * An armed window over one channel, as the document hands it to a mirror.
7707
- *
7708
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7709
- * expires by itself, which is the one failure a boolean cannot avoid.
7710
- */
7711
- var LogChannelWindowSchema = object({
7712
- channel: string().min(1),
7713
- /** Epoch ms the window closes at. */
7714
- armedUntilMs: number(),
7715
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7716
- deviceIds: array(number().int()).readonly().nullable()
7717
- });
7718
- /**
7719
7614
  * Ops-log — the durable, append-only operations audit shared by the
7720
7615
  * recordings and events management surfaces.
7721
7616
  *
@@ -8661,8 +8556,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8661
8556
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8662
8557
  *
8663
8558
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8664
- * The default location for a type uses `id === <type>:default` by
8665
- * convention (the bare type ref like `'backups'` resolves to it).
8559
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8560
+ * There is no default location any more (D383): `enabled` is the whole write
8561
+ * model, and a bare type ref resolves to the sole location of the type, or —
8562
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8563
+ * slug is `default`.
8666
8564
  *
8667
8565
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8668
8566
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8683,21 +8581,20 @@ var StorageLocationSchema = object({
8683
8581
  * flag at upsert time, not here (the schema is provider-agnostic).
8684
8582
  */
8685
8583
  nodeId: string().optional(),
8686
- isDefault: boolean().default(false),
8687
8584
  isSystem: boolean().default(false),
8688
8585
  /**
8689
- * Operator opt-in: whether consumers that BALANCE across several locations
8690
- * of a type may write here. Recordings reads it today; event media and
8691
- * backups are the next consumers, which is why the flag lives on the
8692
- * location rather than in any one addon's store — nothing has to be
8693
- * extended to add the next consumer.
8586
+ * THE write switch, and the only one (D383). `enabled: true` means every
8587
+ * consumer that chooses a write target for this type may write here, and all
8588
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
8589
+ * still read, still played back, still age-swept, still drained, never
8590
+ * written.
8694
8591
  *
8695
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8696
- * flag existed reads back with no flag and keeps working exactly as before;
8697
- * that is the whole compat story, and it is why no migration ships with it.
8698
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8699
- * disk must not silently start writing to it); the default of a type is
8700
- * always stamped `true`.
8592
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8593
+ * stored" on an update and "born inert unless it is the first location of its
8594
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8595
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
8596
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8597
+ * stops existing rather than being re-derived on every read.
8701
8598
  */
8702
8599
  enabled: boolean().optional(),
8703
8600
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
@@ -8710,10 +8607,12 @@ var StorageLocationSchema = object({
8710
8607
  createdAt: number(),
8711
8608
  updatedAt: number()
8712
8609
  });
8610
+ object({ isDefault: boolean().optional() });
8713
8611
  /**
8714
8612
  * Reference accepted by consumer-facing `api.storage.*` calls.
8715
8613
  * Either:
8716
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8614
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8615
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8717
8616
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8718
8617
  *
8719
8618
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -9065,6 +8964,111 @@ function findTimezone(id) {
9065
8964
  return TIMEZONES.find((tz) => tz.id === id);
9066
8965
  }
9067
8966
  /**
8967
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8968
+ * an addon declares its channels in.
8969
+ *
8970
+ * ## Two axes, deliberately separated
8971
+ *
8972
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8973
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8974
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8975
+ * and rots silently. So a channel is declared where it is consulted, and the
8976
+ * `log-channels` capability enumerates the declarations.
8977
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8978
+ * thing: the logging settings document on the `system` cap. Two authorities
8979
+ * over the values is the exact defect
8980
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8981
+ * remove; re-introducing it from the cure side would be grotesque.
8982
+ *
8983
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8984
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8985
+ * the hot path with a value somebody actually read, and by
8986
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8987
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8988
+ * disarmed one (D49).
8989
+ *
8990
+ * ## The canonical call shape
8991
+ *
8992
+ * ```ts
8993
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8994
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8995
+ * }
8996
+ * ```
8997
+ *
8998
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8999
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
9000
+ * object literal is never constructed because it lives inside the branch. It
9001
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
9002
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
9003
+ * destination floor (measured at 1.93 ns/call when off).
9004
+ *
9005
+ * ## Why a channel emits at `info`
9006
+ *
9007
+ * `loki-logging.addon.ts` pins the destination default at `info` and
9008
+ * `loki-destination.ts` drops everything below it, so a line emitted at
9009
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
9010
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
9011
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
9012
+ * emits at the channel's declared level, whose schema floor is `info`.
9013
+ */
9014
+ /**
9015
+ * The level a channel writes at once armed.
9016
+ *
9017
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
9018
+ * not leave the process for Loki, and the whole point of arming a channel is
9019
+ * to read it later.
9020
+ */
9021
+ var LogChannelLevelSchema = _enum([
9022
+ "info",
9023
+ "warn",
9024
+ "error"
9025
+ ]);
9026
+ /**
9027
+ * What an addon declares about one channel. No value, no state — a
9028
+ * declaration is inert.
9029
+ */
9030
+ var LogChannelDescriptorSchema = object({
9031
+ /**
9032
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
9033
+ * the addon's short name so an operator reading a channel list can tell who
9034
+ * owns it without a second lookup.
9035
+ */
9036
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9037
+ /** One sentence: what the operator will SEE after arming it. */
9038
+ description: string().min(1),
9039
+ /** The level its lines are emitted at. Never below `info`. */
9040
+ defaultLevel: LogChannelLevelSchema,
9041
+ /**
9042
+ * Whether this channel can be narrowed to a camera.
9043
+ *
9044
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9045
+ * consulted with the numeric device id, AND every line the channel admits
9046
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9047
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9048
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9049
+ * the body is the only way to filter.
9050
+ *
9051
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9052
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9053
+ * the operator narrows to one camera, sees nothing, and concludes the code
9054
+ * path was never taken.
9055
+ */
9056
+ perDevice: boolean()
9057
+ });
9058
+ /**
9059
+ * An armed window over one channel, as the document hands it to a mirror.
9060
+ *
9061
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9062
+ * expires by itself, which is the one failure a boolean cannot avoid.
9063
+ */
9064
+ var LogChannelWindowSchema = object({
9065
+ channel: string().min(1),
9066
+ /** Epoch ms the window closes at. */
9067
+ armedUntilMs: number(),
9068
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9069
+ deviceIds: array(number().int()).readonly().nullable()
9070
+ });
9071
+ /**
9068
9072
  * Distinct (device, family, variant) counters one instance will hold.
9069
9073
  *
9070
9074
  * A large fleet x the handful of families any single addon reports, with
@@ -10826,12 +10830,30 @@ var BackupDestinationInfoSchema = object({
10826
10830
  lastSuccessAt: number().optional(),
10827
10831
  /** Newest-archive size from `manifests.json`, or undefined. */
10828
10832
  lastSuccessSizeBytes: number().optional(),
10829
- /** Per-destination cron expression. Empty = manual-only (no schedule). */
10833
+ /**
10834
+ * Cron cadence(s) of the ENABLED schedules that fan out to this
10835
+ * destination, comma-joined. Absent when no enabled schedule targets it
10836
+ * — a destination nothing is scheduled to write to must not advertise a
10837
+ * cadence (D384). This is never the `backup_destination_policies.cron`
10838
+ * column: that per-location cron has scheduled nothing since 2026-07-28
10839
+ * and reading it made a destination with a DISABLED schedule claim a
10840
+ * nightly run.
10841
+ */
10830
10842
  cron: string().optional(),
10831
- /** ms-epoch of next computed firing for this destination's cron, if any. */
10843
+ /** ms-epoch of the next firing across those schedules (earliest), if any. */
10832
10844
  nextRunAt: number().optional(),
10833
- /** ms-epoch of last successful scheduled run (mirrors policy.lastRunAt). */
10834
- lastRunAt: number().optional()
10845
+ /**
10846
+ * ms-epoch of the last time a run ATTEMPTED to write here — success or
10847
+ * failure. Never a success stamp: pair it with `lastSuccessAt` (the
10848
+ * newest archive that actually landed) and `lastError`.
10849
+ */
10850
+ lastAttemptAt: number().optional(),
10851
+ /**
10852
+ * Why the last attempt failed, verbatim. Absent when the last attempt
10853
+ * landed the archive. A destination that has never been written to has
10854
+ * neither this nor `lastAttemptAt`.
10855
+ */
10856
+ lastError: string().optional()
10835
10857
  });
10836
10858
  /**
10837
10859
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
@@ -10994,8 +11016,16 @@ var BackupScheduleSchema = object({
10994
11016
  retentionCount: number().int().min(1).max(1e3),
10995
11017
  /** Optional subset of source locations to include; omitted = all. */
10996
11018
  dataSources: array(string()).readonly().optional(),
10997
- /** ms-epoch of last successful run. */
10998
- lastRunAt: number().optional(),
11019
+ /**
11020
+ * ms-epoch of the last tick that FIRED this schedule. Stamped before the
11021
+ * archive runs (it is the dedupe anchor), so it says "attempted", never
11022
+ * "succeeded" — a run refused by every destination stamps it too.
11023
+ */
11024
+ lastAttemptAt: number().optional(),
11025
+ /** ms-epoch of the last run of this schedule that landed at ≥1 destination. */
11026
+ lastSuccessAt: number().optional(),
11027
+ /** Why the last fired run failed, verbatim. Absent when it succeeded. */
11028
+ lastError: string().optional(),
10999
11029
  /** ms-epoch of next computed firing (read-only, filled on list). */
11000
11030
  nextRunAt: number().optional()
11001
11031
  });
@@ -11044,14 +11074,7 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
11044
11074
  locationId: string(),
11045
11075
  enabled: boolean(),
11046
11076
  retentionCount: number().int().min(1).max(1e3),
11047
- label: string().optional(),
11048
- /**
11049
- * Per-destination cron expression. Empty string clears the
11050
- * schedule (manual-only). Validated server-side via croner;
11051
- * malformed expressions reject the upsert with an actionable
11052
- * message.
11053
- */
11054
- cron: string().optional()
11077
+ label: string().optional()
11055
11078
  }), _void(), {
11056
11079
  kind: "mutation",
11057
11080
  auth: "admin"
@@ -22318,7 +22341,7 @@ method(object({
22318
22341
  downloadId: string(),
22319
22342
  offset: number(),
22320
22343
  length: number()
22321
- }), _instanceof(Uint8Array)), method(object({ downloadId: string() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(object({ type: StorageLocationTypeSchema }), StorageLocationSchema.nullable()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
22344
+ }), _instanceof(Uint8Array)), method(object({ downloadId: string() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
22322
22345
  createdAt: true,
22323
22346
  updatedAt: true
22324
22347
  }), StorageLocationSchema, {
@@ -39727,12 +39750,6 @@ Object.freeze({
39727
39750
  addonId: null,
39728
39751
  access: "view"
39729
39752
  },
39730
- "storage.getDefaultLocation": {
39731
- capName: "storage",
39732
- capScope: "system",
39733
- addonId: null,
39734
- access: "view"
39735
- },
39736
39753
  "storage.list": {
39737
39754
  capName: "storage",
39738
39755
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-hikvision",
3
- "version": "1.2.85",
3
+ "version": "1.2.87",
4
4
  "description": "Hikvision camera device provider addon for CamStack — ISAPI over HTTP(S) with digest auth (snapshot, alarm stream, RTSP discovery)",
5
5
  "keywords": [
6
6
  "camstack",