@camstack/addon-provider-amcrest 0.2.79 → 0.2.81

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.
@@ -8888,6 +8787,111 @@ var DecoderSessionConfigSchema = object({
8888
8787
  */
8889
8788
  debug: boolean().optional()
8890
8789
  });
8790
+ /**
8791
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8792
+ * an addon declares its channels in.
8793
+ *
8794
+ * ## Two axes, deliberately separated
8795
+ *
8796
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8797
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8798
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8799
+ * and rots silently. So a channel is declared where it is consulted, and the
8800
+ * `log-channels` capability enumerates the declarations.
8801
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8802
+ * thing: the logging settings document on the `system` cap. Two authorities
8803
+ * over the values is the exact defect
8804
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8805
+ * remove; re-introducing it from the cure side would be grotesque.
8806
+ *
8807
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8808
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8809
+ * the hot path with a value somebody actually read, and by
8810
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8811
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8812
+ * disarmed one (D49).
8813
+ *
8814
+ * ## The canonical call shape
8815
+ *
8816
+ * ```ts
8817
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8818
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8819
+ * }
8820
+ * ```
8821
+ *
8822
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8823
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8824
+ * object literal is never constructed because it lives inside the branch. It
8825
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8826
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8827
+ * destination floor (measured at 1.93 ns/call when off).
8828
+ *
8829
+ * ## Why a channel emits at `info`
8830
+ *
8831
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8832
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8833
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8834
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8835
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8836
+ * emits at the channel's declared level, whose schema floor is `info`.
8837
+ */
8838
+ /**
8839
+ * The level a channel writes at once armed.
8840
+ *
8841
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8842
+ * not leave the process for Loki, and the whole point of arming a channel is
8843
+ * to read it later.
8844
+ */
8845
+ var LogChannelLevelSchema = _enum([
8846
+ "info",
8847
+ "warn",
8848
+ "error"
8849
+ ]);
8850
+ /**
8851
+ * What an addon declares about one channel. No value, no state — a
8852
+ * declaration is inert.
8853
+ */
8854
+ var LogChannelDescriptorSchema = object({
8855
+ /**
8856
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8857
+ * the addon's short name so an operator reading a channel list can tell who
8858
+ * owns it without a second lookup.
8859
+ */
8860
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8861
+ /** One sentence: what the operator will SEE after arming it. */
8862
+ description: string().min(1),
8863
+ /** The level its lines are emitted at. Never below `info`. */
8864
+ defaultLevel: LogChannelLevelSchema,
8865
+ /**
8866
+ * Whether this channel can be narrowed to a camera.
8867
+ *
8868
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8869
+ * consulted with the numeric device id, AND every line the channel admits
8870
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8871
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8872
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8873
+ * the body is the only way to filter.
8874
+ *
8875
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8876
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8877
+ * the operator narrows to one camera, sees nothing, and concludes the code
8878
+ * path was never taken.
8879
+ */
8880
+ perDevice: boolean()
8881
+ });
8882
+ /**
8883
+ * An armed window over one channel, as the document hands it to a mirror.
8884
+ *
8885
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8886
+ * expires by itself, which is the one failure a boolean cannot avoid.
8887
+ */
8888
+ var LogChannelWindowSchema = object({
8889
+ channel: string().min(1),
8890
+ /** Epoch ms the window closes at. */
8891
+ armedUntilMs: number(),
8892
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8893
+ deviceIds: array(number().int()).readonly().nullable()
8894
+ });
8891
8895
  var MODEL_FORMATS = [
8892
8896
  "onnx",
8893
8897
  "coreml",
@@ -10544,12 +10548,30 @@ var BackupDestinationInfoSchema = object({
10544
10548
  lastSuccessAt: number().optional(),
10545
10549
  /** Newest-archive size from `manifests.json`, or undefined. */
10546
10550
  lastSuccessSizeBytes: number().optional(),
10547
- /** Per-destination cron expression. Empty = manual-only (no schedule). */
10551
+ /**
10552
+ * Cron cadence(s) of the ENABLED schedules that fan out to this
10553
+ * destination, comma-joined. Absent when no enabled schedule targets it
10554
+ * — a destination nothing is scheduled to write to must not advertise a
10555
+ * cadence (D384). This is never the `backup_destination_policies.cron`
10556
+ * column: that per-location cron has scheduled nothing since 2026-07-28
10557
+ * and reading it made a destination with a DISABLED schedule claim a
10558
+ * nightly run.
10559
+ */
10548
10560
  cron: string().optional(),
10549
- /** ms-epoch of next computed firing for this destination's cron, if any. */
10561
+ /** ms-epoch of the next firing across those schedules (earliest), if any. */
10550
10562
  nextRunAt: number().optional(),
10551
- /** ms-epoch of last successful scheduled run (mirrors policy.lastRunAt). */
10552
- lastRunAt: number().optional()
10563
+ /**
10564
+ * ms-epoch of the last time a run ATTEMPTED to write here — success or
10565
+ * failure. Never a success stamp: pair it with `lastSuccessAt` (the
10566
+ * newest archive that actually landed) and `lastError`.
10567
+ */
10568
+ lastAttemptAt: number().optional(),
10569
+ /**
10570
+ * Why the last attempt failed, verbatim. Absent when the last attempt
10571
+ * landed the archive. A destination that has never been written to has
10572
+ * neither this nor `lastAttemptAt`.
10573
+ */
10574
+ lastError: string().optional()
10553
10575
  });
10554
10576
  /**
10555
10577
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
@@ -10712,8 +10734,16 @@ var BackupScheduleSchema = object({
10712
10734
  retentionCount: number().int().min(1).max(1e3),
10713
10735
  /** Optional subset of source locations to include; omitted = all. */
10714
10736
  dataSources: array(string()).readonly().optional(),
10715
- /** ms-epoch of last successful run. */
10716
- lastRunAt: number().optional(),
10737
+ /**
10738
+ * ms-epoch of the last tick that FIRED this schedule. Stamped before the
10739
+ * archive runs (it is the dedupe anchor), so it says "attempted", never
10740
+ * "succeeded" — a run refused by every destination stamps it too.
10741
+ */
10742
+ lastAttemptAt: number().optional(),
10743
+ /** ms-epoch of the last run of this schedule that landed at ≥1 destination. */
10744
+ lastSuccessAt: number().optional(),
10745
+ /** Why the last fired run failed, verbatim. Absent when it succeeded. */
10746
+ lastError: string().optional(),
10717
10747
  /** ms-epoch of next computed firing (read-only, filled on list). */
10718
10748
  nextRunAt: number().optional()
10719
10749
  });
@@ -10762,14 +10792,7 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
10762
10792
  locationId: string(),
10763
10793
  enabled: boolean(),
10764
10794
  retentionCount: number().int().min(1).max(1e3),
10765
- label: string().optional(),
10766
- /**
10767
- * Per-destination cron expression. Empty string clears the
10768
- * schedule (manual-only). Validated server-side via croner;
10769
- * malformed expressions reject the upsert with an actionable
10770
- * message.
10771
- */
10772
- cron: string().optional()
10795
+ label: string().optional()
10773
10796
  }), _void(), {
10774
10797
  kind: "mutation",
10775
10798
  auth: "admin"
@@ -22005,7 +22028,7 @@ method(object({
22005
22028
  downloadId: string(),
22006
22029
  offset: number(),
22007
22030
  length: number()
22008
- }), _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({
22031
+ }), _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({
22009
22032
  createdAt: true,
22010
22033
  updatedAt: true
22011
22034
  }), StorageLocationSchema, {
@@ -39362,12 +39385,6 @@ Object.freeze({
39362
39385
  addonId: null,
39363
39386
  access: "view"
39364
39387
  },
39365
- "storage.getDefaultLocation": {
39366
- capName: "storage",
39367
- capScope: "system",
39368
- addonId: null,
39369
- access: "view"
39370
- },
39371
39388
  "storage.list": {
39372
39389
  capName: "storage",
39373
39390
  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.
@@ -8889,6 +8788,111 @@ var DecoderSessionConfigSchema = object({
8889
8788
  */
8890
8789
  debug: boolean().optional()
8891
8790
  });
8791
+ /**
8792
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8793
+ * an addon declares its channels in.
8794
+ *
8795
+ * ## Two axes, deliberately separated
8796
+ *
8797
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8798
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8799
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8800
+ * and rots silently. So a channel is declared where it is consulted, and the
8801
+ * `log-channels` capability enumerates the declarations.
8802
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8803
+ * thing: the logging settings document on the `system` cap. Two authorities
8804
+ * over the values is the exact defect
8805
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8806
+ * remove; re-introducing it from the cure side would be grotesque.
8807
+ *
8808
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8809
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8810
+ * the hot path with a value somebody actually read, and by
8811
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8812
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8813
+ * disarmed one (D49).
8814
+ *
8815
+ * ## The canonical call shape
8816
+ *
8817
+ * ```ts
8818
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8819
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8820
+ * }
8821
+ * ```
8822
+ *
8823
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8824
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8825
+ * object literal is never constructed because it lives inside the branch. It
8826
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8827
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8828
+ * destination floor (measured at 1.93 ns/call when off).
8829
+ *
8830
+ * ## Why a channel emits at `info`
8831
+ *
8832
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8833
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8834
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8835
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8836
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8837
+ * emits at the channel's declared level, whose schema floor is `info`.
8838
+ */
8839
+ /**
8840
+ * The level a channel writes at once armed.
8841
+ *
8842
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8843
+ * not leave the process for Loki, and the whole point of arming a channel is
8844
+ * to read it later.
8845
+ */
8846
+ var LogChannelLevelSchema = _enum([
8847
+ "info",
8848
+ "warn",
8849
+ "error"
8850
+ ]);
8851
+ /**
8852
+ * What an addon declares about one channel. No value, no state — a
8853
+ * declaration is inert.
8854
+ */
8855
+ var LogChannelDescriptorSchema = object({
8856
+ /**
8857
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8858
+ * the addon's short name so an operator reading a channel list can tell who
8859
+ * owns it without a second lookup.
8860
+ */
8861
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8862
+ /** One sentence: what the operator will SEE after arming it. */
8863
+ description: string().min(1),
8864
+ /** The level its lines are emitted at. Never below `info`. */
8865
+ defaultLevel: LogChannelLevelSchema,
8866
+ /**
8867
+ * Whether this channel can be narrowed to a camera.
8868
+ *
8869
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8870
+ * consulted with the numeric device id, AND every line the channel admits
8871
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8872
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8873
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8874
+ * the body is the only way to filter.
8875
+ *
8876
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8877
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8878
+ * the operator narrows to one camera, sees nothing, and concludes the code
8879
+ * path was never taken.
8880
+ */
8881
+ perDevice: boolean()
8882
+ });
8883
+ /**
8884
+ * An armed window over one channel, as the document hands it to a mirror.
8885
+ *
8886
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8887
+ * expires by itself, which is the one failure a boolean cannot avoid.
8888
+ */
8889
+ var LogChannelWindowSchema = object({
8890
+ channel: string().min(1),
8891
+ /** Epoch ms the window closes at. */
8892
+ armedUntilMs: number(),
8893
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8894
+ deviceIds: array(number().int()).readonly().nullable()
8895
+ });
8892
8896
  var MODEL_FORMATS = [
8893
8897
  "onnx",
8894
8898
  "coreml",
@@ -10545,12 +10549,30 @@ var BackupDestinationInfoSchema = object({
10545
10549
  lastSuccessAt: number().optional(),
10546
10550
  /** Newest-archive size from `manifests.json`, or undefined. */
10547
10551
  lastSuccessSizeBytes: number().optional(),
10548
- /** Per-destination cron expression. Empty = manual-only (no schedule). */
10552
+ /**
10553
+ * Cron cadence(s) of the ENABLED schedules that fan out to this
10554
+ * destination, comma-joined. Absent when no enabled schedule targets it
10555
+ * — a destination nothing is scheduled to write to must not advertise a
10556
+ * cadence (D384). This is never the `backup_destination_policies.cron`
10557
+ * column: that per-location cron has scheduled nothing since 2026-07-28
10558
+ * and reading it made a destination with a DISABLED schedule claim a
10559
+ * nightly run.
10560
+ */
10549
10561
  cron: string().optional(),
10550
- /** ms-epoch of next computed firing for this destination's cron, if any. */
10562
+ /** ms-epoch of the next firing across those schedules (earliest), if any. */
10551
10563
  nextRunAt: number().optional(),
10552
- /** ms-epoch of last successful scheduled run (mirrors policy.lastRunAt). */
10553
- lastRunAt: number().optional()
10564
+ /**
10565
+ * ms-epoch of the last time a run ATTEMPTED to write here — success or
10566
+ * failure. Never a success stamp: pair it with `lastSuccessAt` (the
10567
+ * newest archive that actually landed) and `lastError`.
10568
+ */
10569
+ lastAttemptAt: number().optional(),
10570
+ /**
10571
+ * Why the last attempt failed, verbatim. Absent when the last attempt
10572
+ * landed the archive. A destination that has never been written to has
10573
+ * neither this nor `lastAttemptAt`.
10574
+ */
10575
+ lastError: string().optional()
10554
10576
  });
10555
10577
  /**
10556
10578
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
@@ -10713,8 +10735,16 @@ var BackupScheduleSchema = object({
10713
10735
  retentionCount: number().int().min(1).max(1e3),
10714
10736
  /** Optional subset of source locations to include; omitted = all. */
10715
10737
  dataSources: array(string()).readonly().optional(),
10716
- /** ms-epoch of last successful run. */
10717
- lastRunAt: number().optional(),
10738
+ /**
10739
+ * ms-epoch of the last tick that FIRED this schedule. Stamped before the
10740
+ * archive runs (it is the dedupe anchor), so it says "attempted", never
10741
+ * "succeeded" — a run refused by every destination stamps it too.
10742
+ */
10743
+ lastAttemptAt: number().optional(),
10744
+ /** ms-epoch of the last run of this schedule that landed at ≥1 destination. */
10745
+ lastSuccessAt: number().optional(),
10746
+ /** Why the last fired run failed, verbatim. Absent when it succeeded. */
10747
+ lastError: string().optional(),
10718
10748
  /** ms-epoch of next computed firing (read-only, filled on list). */
10719
10749
  nextRunAt: number().optional()
10720
10750
  });
@@ -10763,14 +10793,7 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
10763
10793
  locationId: string(),
10764
10794
  enabled: boolean(),
10765
10795
  retentionCount: number().int().min(1).max(1e3),
10766
- label: string().optional(),
10767
- /**
10768
- * Per-destination cron expression. Empty string clears the
10769
- * schedule (manual-only). Validated server-side via croner;
10770
- * malformed expressions reject the upsert with an actionable
10771
- * message.
10772
- */
10773
- cron: string().optional()
10796
+ label: string().optional()
10774
10797
  }), _void(), {
10775
10798
  kind: "mutation",
10776
10799
  auth: "admin"
@@ -22006,7 +22029,7 @@ method(object({
22006
22029
  downloadId: string(),
22007
22030
  offset: number(),
22008
22031
  length: number()
22009
- }), _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({
22032
+ }), _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({
22010
22033
  createdAt: true,
22011
22034
  updatedAt: true
22012
22035
  }), StorageLocationSchema, {
@@ -39363,12 +39386,6 @@ Object.freeze({
39363
39386
  addonId: null,
39364
39387
  access: "view"
39365
39388
  },
39366
- "storage.getDefaultLocation": {
39367
- capName: "storage",
39368
- capScope: "system",
39369
- addonId: null,
39370
- access: "view"
39371
- },
39372
39389
  "storage.list": {
39373
39390
  capName: "storage",
39374
39391
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.2.79",
3
+ "version": "0.2.81",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",