@camstack/addon-provider-tuya 0.2.77 → 0.2.79

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
@@ -8435,111 +8435,6 @@ var CameraSwitchGroupSchema = object({
8435
8435
  fetchedAt: number()
8436
8436
  });
8437
8437
  /**
8438
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
8439
- * an addon declares its channels in.
8440
- *
8441
- * ## Two axes, deliberately separated
8442
- *
8443
- * - **DECLARATION** — which channels exist. Only the addon knows:
8444
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8445
- * baichuan/handshake. A hand-wired central list rots at the first addition,
8446
- * and rots silently. So a channel is declared where it is consulted, and the
8447
- * `log-channels` capability enumerates the declarations.
8448
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
8449
- * thing: the logging settings document on the `system` cap. Two authorities
8450
- * over the values is the exact defect
8451
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8452
- * remove; re-introducing it from the cure side would be grotesque.
8453
- *
8454
- * Nothing in this file reads a clock, an env var or a store. The registry is
8455
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8456
- * the hot path with a value somebody actually read, and by
8457
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8458
- * never reaches here, so it can neither disarm an armed channel nor arm a
8459
- * disarmed one (D49).
8460
- *
8461
- * ## The canonical call shape
8462
- *
8463
- * ```ts
8464
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8465
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8466
- * }
8467
- * ```
8468
- *
8469
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8470
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
8471
- * object literal is never constructed because it lives inside the branch. It
8472
- * is the same shape already proven in production at `stream-broker.ts:1650`,
8473
- * and the same discipline `LoggingGate.allowsDestination` uses for the
8474
- * destination floor (measured at 1.93 ns/call when off).
8475
- *
8476
- * ## Why a channel emits at `info`
8477
- *
8478
- * `loki-logging.addon.ts` pins the destination default at `info` and
8479
- * `loki-destination.ts` drops everything below it, so a line emitted at
8480
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8481
- * minutes. A diagnostic that cannot be read an hour later is worse than no
8482
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8483
- * emits at the channel's declared level, whose schema floor is `info`.
8484
- */
8485
- /**
8486
- * The level a channel writes at once armed.
8487
- *
8488
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8489
- * not leave the process for Loki, and the whole point of arming a channel is
8490
- * to read it later.
8491
- */
8492
- var LogChannelLevelSchema = _enum([
8493
- "info",
8494
- "warn",
8495
- "error"
8496
- ]);
8497
- /**
8498
- * What an addon declares about one channel. No value, no state — a
8499
- * declaration is inert.
8500
- */
8501
- var LogChannelDescriptorSchema = object({
8502
- /**
8503
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8504
- * the addon's short name so an operator reading a channel list can tell who
8505
- * owns it without a second lookup.
8506
- */
8507
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8508
- /** One sentence: what the operator will SEE after arming it. */
8509
- description: string().min(1),
8510
- /** The level its lines are emitted at. Never below `info`. */
8511
- defaultLevel: LogChannelLevelSchema,
8512
- /**
8513
- * Whether this channel can be narrowed to a camera.
8514
- *
8515
- * `true` is a PROMISE with two halves, and both must hold: the gate is
8516
- * consulted with the numeric device id, AND every line the channel admits
8517
- * carries `tags: { deviceId }` with that same numeric id. The second half is
8518
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8519
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8520
- * the body is the only way to filter.
8521
- *
8522
- * A channel whose lines carry the device only in `meta` (or not at all) is
8523
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8524
- * the operator narrows to one camera, sees nothing, and concludes the code
8525
- * path was never taken.
8526
- */
8527
- perDevice: boolean()
8528
- });
8529
- /**
8530
- * An armed window over one channel, as the document hands it to a mirror.
8531
- *
8532
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8533
- * expires by itself, which is the one failure a boolean cannot avoid.
8534
- */
8535
- var LogChannelWindowSchema = object({
8536
- channel: string().min(1),
8537
- /** Epoch ms the window closes at. */
8538
- armedUntilMs: number(),
8539
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8540
- deviceIds: array(number().int()).readonly().nullable()
8541
- });
8542
- /**
8543
8438
  * Ops-log — the durable, append-only operations audit shared by the
8544
8439
  * recordings and events management surfaces.
8545
8440
  *
@@ -9485,8 +9380,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
9485
9380
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
9486
9381
  *
9487
9382
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
9488
- * The default location for a type uses `id === <type>:default` by
9489
- * convention (the bare type ref like `'backups'` resolves to it).
9383
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
9384
+ * There is no default location any more (D383): `enabled` is the whole write
9385
+ * model, and a bare type ref resolves to the sole location of the type, or —
9386
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
9387
+ * slug is `default`.
9490
9388
  *
9491
9389
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
9492
9390
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -9507,21 +9405,20 @@ var StorageLocationSchema = object({
9507
9405
  * flag at upsert time, not here (the schema is provider-agnostic).
9508
9406
  */
9509
9407
  nodeId: string().optional(),
9510
- isDefault: boolean().default(false),
9511
9408
  isSystem: boolean().default(false),
9512
9409
  /**
9513
- * Operator opt-in: whether consumers that BALANCE across several locations
9514
- * of a type may write here. Recordings reads it today; event media and
9515
- * backups are the next consumers, which is why the flag lives on the
9516
- * location rather than in any one addon's store — nothing has to be
9517
- * extended to add the next consumer.
9410
+ * THE write switch, and the only one (D383). `enabled: true` means every
9411
+ * consumer that chooses a write target for this type may write here, and all
9412
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
9413
+ * still read, still played back, still age-swept, still drained, never
9414
+ * written.
9518
9415
  *
9519
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
9520
- * flag existed reads back with no flag and keeps working exactly as before;
9521
- * that is the whole compat story, and it is why no migration ships with it.
9522
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
9523
- * disk must not silently start writing to it); the default of a type is
9524
- * always stamped `true`.
9416
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
9417
+ * stored" on an update and "born inert unless it is the first location of its
9418
+ * type" on a create. On a PERSISTED row absence is legacy and it means
9419
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
9420
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
9421
+ * stops existing rather than being re-derived on every read.
9525
9422
  */
9526
9423
  enabled: boolean().optional(),
9527
9424
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
@@ -9534,10 +9431,12 @@ var StorageLocationSchema = object({
9534
9431
  createdAt: number(),
9535
9432
  updatedAt: number()
9536
9433
  });
9434
+ object({ isDefault: boolean().optional() });
9537
9435
  /**
9538
9436
  * Reference accepted by consumer-facing `api.storage.*` calls.
9539
9437
  * Either:
9540
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
9438
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
9439
+ * (transitionally, the `<type>:default`-slugged row when several exist)
9541
9440
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
9542
9441
  *
9543
9442
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -9713,6 +9612,111 @@ var DecoderSessionConfigSchema = object({
9713
9612
  */
9714
9613
  debug: boolean().optional()
9715
9614
  });
9615
+ /**
9616
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
9617
+ * an addon declares its channels in.
9618
+ *
9619
+ * ## Two axes, deliberately separated
9620
+ *
9621
+ * - **DECLARATION** — which channels exist. Only the addon knows:
9622
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
9623
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
9624
+ * and rots silently. So a channel is declared where it is consulted, and the
9625
+ * `log-channels` capability enumerates the declarations.
9626
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
9627
+ * thing: the logging settings document on the `system` cap. Two authorities
9628
+ * over the values is the exact defect
9629
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
9630
+ * remove; re-introducing it from the cure side would be grotesque.
9631
+ *
9632
+ * Nothing in this file reads a clock, an env var or a store. The registry is
9633
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
9634
+ * the hot path with a value somebody actually read, and by
9635
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
9636
+ * never reaches here, so it can neither disarm an armed channel nor arm a
9637
+ * disarmed one (D49).
9638
+ *
9639
+ * ## The canonical call shape
9640
+ *
9641
+ * ```ts
9642
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
9643
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
9644
+ * }
9645
+ * ```
9646
+ *
9647
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
9648
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
9649
+ * object literal is never constructed because it lives inside the branch. It
9650
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
9651
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
9652
+ * destination floor (measured at 1.93 ns/call when off).
9653
+ *
9654
+ * ## Why a channel emits at `info`
9655
+ *
9656
+ * `loki-logging.addon.ts` pins the destination default at `info` and
9657
+ * `loki-destination.ts` drops everything below it, so a line emitted at
9658
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
9659
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
9660
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
9661
+ * emits at the channel's declared level, whose schema floor is `info`.
9662
+ */
9663
+ /**
9664
+ * The level a channel writes at once armed.
9665
+ *
9666
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
9667
+ * not leave the process for Loki, and the whole point of arming a channel is
9668
+ * to read it later.
9669
+ */
9670
+ var LogChannelLevelSchema = _enum([
9671
+ "info",
9672
+ "warn",
9673
+ "error"
9674
+ ]);
9675
+ /**
9676
+ * What an addon declares about one channel. No value, no state — a
9677
+ * declaration is inert.
9678
+ */
9679
+ var LogChannelDescriptorSchema = object({
9680
+ /**
9681
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
9682
+ * the addon's short name so an operator reading a channel list can tell who
9683
+ * owns it without a second lookup.
9684
+ */
9685
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9686
+ /** One sentence: what the operator will SEE after arming it. */
9687
+ description: string().min(1),
9688
+ /** The level its lines are emitted at. Never below `info`. */
9689
+ defaultLevel: LogChannelLevelSchema,
9690
+ /**
9691
+ * Whether this channel can be narrowed to a camera.
9692
+ *
9693
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9694
+ * consulted with the numeric device id, AND every line the channel admits
9695
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9696
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9697
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9698
+ * the body is the only way to filter.
9699
+ *
9700
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9701
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9702
+ * the operator narrows to one camera, sees nothing, and concludes the code
9703
+ * path was never taken.
9704
+ */
9705
+ perDevice: boolean()
9706
+ });
9707
+ /**
9708
+ * An armed window over one channel, as the document hands it to a mirror.
9709
+ *
9710
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9711
+ * expires by itself, which is the one failure a boolean cannot avoid.
9712
+ */
9713
+ var LogChannelWindowSchema = object({
9714
+ channel: string().min(1),
9715
+ /** Epoch ms the window closes at. */
9716
+ armedUntilMs: number(),
9717
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9718
+ deviceIds: array(number().int()).readonly().nullable()
9719
+ });
9716
9720
  var MODEL_FORMATS = [
9717
9721
  "onnx",
9718
9722
  "coreml",
@@ -11369,12 +11373,30 @@ var BackupDestinationInfoSchema = object({
11369
11373
  lastSuccessAt: number().optional(),
11370
11374
  /** Newest-archive size from `manifests.json`, or undefined. */
11371
11375
  lastSuccessSizeBytes: number().optional(),
11372
- /** Per-destination cron expression. Empty = manual-only (no schedule). */
11376
+ /**
11377
+ * Cron cadence(s) of the ENABLED schedules that fan out to this
11378
+ * destination, comma-joined. Absent when no enabled schedule targets it
11379
+ * — a destination nothing is scheduled to write to must not advertise a
11380
+ * cadence (D384). This is never the `backup_destination_policies.cron`
11381
+ * column: that per-location cron has scheduled nothing since 2026-07-28
11382
+ * and reading it made a destination with a DISABLED schedule claim a
11383
+ * nightly run.
11384
+ */
11373
11385
  cron: string().optional(),
11374
- /** ms-epoch of next computed firing for this destination's cron, if any. */
11386
+ /** ms-epoch of the next firing across those schedules (earliest), if any. */
11375
11387
  nextRunAt: number().optional(),
11376
- /** ms-epoch of last successful scheduled run (mirrors policy.lastRunAt). */
11377
- lastRunAt: number().optional()
11388
+ /**
11389
+ * ms-epoch of the last time a run ATTEMPTED to write here — success or
11390
+ * failure. Never a success stamp: pair it with `lastSuccessAt` (the
11391
+ * newest archive that actually landed) and `lastError`.
11392
+ */
11393
+ lastAttemptAt: number().optional(),
11394
+ /**
11395
+ * Why the last attempt failed, verbatim. Absent when the last attempt
11396
+ * landed the archive. A destination that has never been written to has
11397
+ * neither this nor `lastAttemptAt`.
11398
+ */
11399
+ lastError: string().optional()
11378
11400
  });
11379
11401
  /**
11380
11402
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
@@ -11537,8 +11559,16 @@ var BackupScheduleSchema = object({
11537
11559
  retentionCount: number().int().min(1).max(1e3),
11538
11560
  /** Optional subset of source locations to include; omitted = all. */
11539
11561
  dataSources: array(string()).readonly().optional(),
11540
- /** ms-epoch of last successful run. */
11541
- lastRunAt: number().optional(),
11562
+ /**
11563
+ * ms-epoch of the last tick that FIRED this schedule. Stamped before the
11564
+ * archive runs (it is the dedupe anchor), so it says "attempted", never
11565
+ * "succeeded" — a run refused by every destination stamps it too.
11566
+ */
11567
+ lastAttemptAt: number().optional(),
11568
+ /** ms-epoch of the last run of this schedule that landed at ≥1 destination. */
11569
+ lastSuccessAt: number().optional(),
11570
+ /** Why the last fired run failed, verbatim. Absent when it succeeded. */
11571
+ lastError: string().optional(),
11542
11572
  /** ms-epoch of next computed firing (read-only, filled on list). */
11543
11573
  nextRunAt: number().optional()
11544
11574
  });
@@ -11587,14 +11617,7 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
11587
11617
  locationId: string(),
11588
11618
  enabled: boolean(),
11589
11619
  retentionCount: number().int().min(1).max(1e3),
11590
- label: string().optional(),
11591
- /**
11592
- * Per-destination cron expression. Empty string clears the
11593
- * schedule (manual-only). Validated server-side via croner;
11594
- * malformed expressions reject the upsert with an actionable
11595
- * message.
11596
- */
11597
- cron: string().optional()
11620
+ label: string().optional()
11598
11621
  }), _void(), {
11599
11622
  kind: "mutation",
11600
11623
  auth: "admin"
@@ -22743,7 +22766,7 @@ method(object({
22743
22766
  downloadId: string(),
22744
22767
  offset: number(),
22745
22768
  length: number()
22746
- }), _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({
22769
+ }), _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({
22747
22770
  createdAt: true,
22748
22771
  updatedAt: true
22749
22772
  }), StorageLocationSchema, {
@@ -39596,12 +39619,6 @@ Object.freeze({
39596
39619
  addonId: null,
39597
39620
  access: "view"
39598
39621
  },
39599
- "storage.getDefaultLocation": {
39600
- capName: "storage",
39601
- capScope: "system",
39602
- addonId: null,
39603
- access: "view"
39604
- },
39605
39622
  "storage.list": {
39606
39623
  capName: "storage",
39607
39624
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8434,111 +8434,6 @@ var CameraSwitchGroupSchema = object({
8434
8434
  fetchedAt: number()
8435
8435
  });
8436
8436
  /**
8437
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
8438
- * an addon declares its channels in.
8439
- *
8440
- * ## Two axes, deliberately separated
8441
- *
8442
- * - **DECLARATION** — which channels exist. Only the addon knows:
8443
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8444
- * baichuan/handshake. A hand-wired central list rots at the first addition,
8445
- * and rots silently. So a channel is declared where it is consulted, and the
8446
- * `log-channels` capability enumerates the declarations.
8447
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
8448
- * thing: the logging settings document on the `system` cap. Two authorities
8449
- * over the values is the exact defect
8450
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8451
- * remove; re-introducing it from the cure side would be grotesque.
8452
- *
8453
- * Nothing in this file reads a clock, an env var or a store. The registry is
8454
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8455
- * the hot path with a value somebody actually read, and by
8456
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8457
- * never reaches here, so it can neither disarm an armed channel nor arm a
8458
- * disarmed one (D49).
8459
- *
8460
- * ## The canonical call shape
8461
- *
8462
- * ```ts
8463
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8464
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8465
- * }
8466
- * ```
8467
- *
8468
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8469
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
8470
- * object literal is never constructed because it lives inside the branch. It
8471
- * is the same shape already proven in production at `stream-broker.ts:1650`,
8472
- * and the same discipline `LoggingGate.allowsDestination` uses for the
8473
- * destination floor (measured at 1.93 ns/call when off).
8474
- *
8475
- * ## Why a channel emits at `info`
8476
- *
8477
- * `loki-logging.addon.ts` pins the destination default at `info` and
8478
- * `loki-destination.ts` drops everything below it, so a line emitted at
8479
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8480
- * minutes. A diagnostic that cannot be read an hour later is worse than no
8481
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8482
- * emits at the channel's declared level, whose schema floor is `info`.
8483
- */
8484
- /**
8485
- * The level a channel writes at once armed.
8486
- *
8487
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8488
- * not leave the process for Loki, and the whole point of arming a channel is
8489
- * to read it later.
8490
- */
8491
- var LogChannelLevelSchema = _enum([
8492
- "info",
8493
- "warn",
8494
- "error"
8495
- ]);
8496
- /**
8497
- * What an addon declares about one channel. No value, no state — a
8498
- * declaration is inert.
8499
- */
8500
- var LogChannelDescriptorSchema = object({
8501
- /**
8502
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8503
- * the addon's short name so an operator reading a channel list can tell who
8504
- * owns it without a second lookup.
8505
- */
8506
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8507
- /** One sentence: what the operator will SEE after arming it. */
8508
- description: string().min(1),
8509
- /** The level its lines are emitted at. Never below `info`. */
8510
- defaultLevel: LogChannelLevelSchema,
8511
- /**
8512
- * Whether this channel can be narrowed to a camera.
8513
- *
8514
- * `true` is a PROMISE with two halves, and both must hold: the gate is
8515
- * consulted with the numeric device id, AND every line the channel admits
8516
- * carries `tags: { deviceId }` with that same numeric id. The second half is
8517
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8518
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8519
- * the body is the only way to filter.
8520
- *
8521
- * A channel whose lines carry the device only in `meta` (or not at all) is
8522
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8523
- * the operator narrows to one camera, sees nothing, and concludes the code
8524
- * path was never taken.
8525
- */
8526
- perDevice: boolean()
8527
- });
8528
- /**
8529
- * An armed window over one channel, as the document hands it to a mirror.
8530
- *
8531
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8532
- * expires by itself, which is the one failure a boolean cannot avoid.
8533
- */
8534
- var LogChannelWindowSchema = object({
8535
- channel: string().min(1),
8536
- /** Epoch ms the window closes at. */
8537
- armedUntilMs: number(),
8538
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8539
- deviceIds: array(number().int()).readonly().nullable()
8540
- });
8541
- /**
8542
8437
  * Ops-log — the durable, append-only operations audit shared by the
8543
8438
  * recordings and events management surfaces.
8544
8439
  *
@@ -9484,8 +9379,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
9484
9379
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
9485
9380
  *
9486
9381
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
9487
- * The default location for a type uses `id === <type>:default` by
9488
- * convention (the bare type ref like `'backups'` resolves to it).
9382
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
9383
+ * There is no default location any more (D383): `enabled` is the whole write
9384
+ * model, and a bare type ref resolves to the sole location of the type, or —
9385
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
9386
+ * slug is `default`.
9489
9387
  *
9490
9388
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
9491
9389
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -9506,21 +9404,20 @@ var StorageLocationSchema = object({
9506
9404
  * flag at upsert time, not here (the schema is provider-agnostic).
9507
9405
  */
9508
9406
  nodeId: string().optional(),
9509
- isDefault: boolean().default(false),
9510
9407
  isSystem: boolean().default(false),
9511
9408
  /**
9512
- * Operator opt-in: whether consumers that BALANCE across several locations
9513
- * of a type may write here. Recordings reads it today; event media and
9514
- * backups are the next consumers, which is why the flag lives on the
9515
- * location rather than in any one addon's store — nothing has to be
9516
- * extended to add the next consumer.
9409
+ * THE write switch, and the only one (D383). `enabled: true` means every
9410
+ * consumer that chooses a write target for this type may write here, and all
9411
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
9412
+ * still read, still played back, still age-swept, still drained, never
9413
+ * written.
9517
9414
  *
9518
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
9519
- * flag existed reads back with no flag and keeps working exactly as before;
9520
- * that is the whole compat story, and it is why no migration ships with it.
9521
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
9522
- * disk must not silently start writing to it); the default of a type is
9523
- * always stamped `true`.
9415
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
9416
+ * stored" on an update and "born inert unless it is the first location of its
9417
+ * type" on a create. On a PERSISTED row absence is legacy and it means
9418
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
9419
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
9420
+ * stops existing rather than being re-derived on every read.
9524
9421
  */
9525
9422
  enabled: boolean().optional(),
9526
9423
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
@@ -9533,10 +9430,12 @@ var StorageLocationSchema = object({
9533
9430
  createdAt: number(),
9534
9431
  updatedAt: number()
9535
9432
  });
9433
+ object({ isDefault: boolean().optional() });
9536
9434
  /**
9537
9435
  * Reference accepted by consumer-facing `api.storage.*` calls.
9538
9436
  * Either:
9539
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
9437
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
9438
+ * (transitionally, the `<type>:default`-slugged row when several exist)
9540
9439
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
9541
9440
  *
9542
9441
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -9712,6 +9611,111 @@ var DecoderSessionConfigSchema = object({
9712
9611
  */
9713
9612
  debug: boolean().optional()
9714
9613
  });
9614
+ /**
9615
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
9616
+ * an addon declares its channels in.
9617
+ *
9618
+ * ## Two axes, deliberately separated
9619
+ *
9620
+ * - **DECLARATION** — which channels exist. Only the addon knows:
9621
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
9622
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
9623
+ * and rots silently. So a channel is declared where it is consulted, and the
9624
+ * `log-channels` capability enumerates the declarations.
9625
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
9626
+ * thing: the logging settings document on the `system` cap. Two authorities
9627
+ * over the values is the exact defect
9628
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
9629
+ * remove; re-introducing it from the cure side would be grotesque.
9630
+ *
9631
+ * Nothing in this file reads a clock, an env var or a store. The registry is
9632
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
9633
+ * the hot path with a value somebody actually read, and by
9634
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
9635
+ * never reaches here, so it can neither disarm an armed channel nor arm a
9636
+ * disarmed one (D49).
9637
+ *
9638
+ * ## The canonical call shape
9639
+ *
9640
+ * ```ts
9641
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
9642
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
9643
+ * }
9644
+ * ```
9645
+ *
9646
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
9647
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
9648
+ * object literal is never constructed because it lives inside the branch. It
9649
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
9650
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
9651
+ * destination floor (measured at 1.93 ns/call when off).
9652
+ *
9653
+ * ## Why a channel emits at `info`
9654
+ *
9655
+ * `loki-logging.addon.ts` pins the destination default at `info` and
9656
+ * `loki-destination.ts` drops everything below it, so a line emitted at
9657
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
9658
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
9659
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
9660
+ * emits at the channel's declared level, whose schema floor is `info`.
9661
+ */
9662
+ /**
9663
+ * The level a channel writes at once armed.
9664
+ *
9665
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
9666
+ * not leave the process for Loki, and the whole point of arming a channel is
9667
+ * to read it later.
9668
+ */
9669
+ var LogChannelLevelSchema = _enum([
9670
+ "info",
9671
+ "warn",
9672
+ "error"
9673
+ ]);
9674
+ /**
9675
+ * What an addon declares about one channel. No value, no state — a
9676
+ * declaration is inert.
9677
+ */
9678
+ var LogChannelDescriptorSchema = object({
9679
+ /**
9680
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
9681
+ * the addon's short name so an operator reading a channel list can tell who
9682
+ * owns it without a second lookup.
9683
+ */
9684
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9685
+ /** One sentence: what the operator will SEE after arming it. */
9686
+ description: string().min(1),
9687
+ /** The level its lines are emitted at. Never below `info`. */
9688
+ defaultLevel: LogChannelLevelSchema,
9689
+ /**
9690
+ * Whether this channel can be narrowed to a camera.
9691
+ *
9692
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9693
+ * consulted with the numeric device id, AND every line the channel admits
9694
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9695
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9696
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9697
+ * the body is the only way to filter.
9698
+ *
9699
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9700
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9701
+ * the operator narrows to one camera, sees nothing, and concludes the code
9702
+ * path was never taken.
9703
+ */
9704
+ perDevice: boolean()
9705
+ });
9706
+ /**
9707
+ * An armed window over one channel, as the document hands it to a mirror.
9708
+ *
9709
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9710
+ * expires by itself, which is the one failure a boolean cannot avoid.
9711
+ */
9712
+ var LogChannelWindowSchema = object({
9713
+ channel: string().min(1),
9714
+ /** Epoch ms the window closes at. */
9715
+ armedUntilMs: number(),
9716
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9717
+ deviceIds: array(number().int()).readonly().nullable()
9718
+ });
9715
9719
  var MODEL_FORMATS = [
9716
9720
  "onnx",
9717
9721
  "coreml",
@@ -11368,12 +11372,30 @@ var BackupDestinationInfoSchema = object({
11368
11372
  lastSuccessAt: number().optional(),
11369
11373
  /** Newest-archive size from `manifests.json`, or undefined. */
11370
11374
  lastSuccessSizeBytes: number().optional(),
11371
- /** Per-destination cron expression. Empty = manual-only (no schedule). */
11375
+ /**
11376
+ * Cron cadence(s) of the ENABLED schedules that fan out to this
11377
+ * destination, comma-joined. Absent when no enabled schedule targets it
11378
+ * — a destination nothing is scheduled to write to must not advertise a
11379
+ * cadence (D384). This is never the `backup_destination_policies.cron`
11380
+ * column: that per-location cron has scheduled nothing since 2026-07-28
11381
+ * and reading it made a destination with a DISABLED schedule claim a
11382
+ * nightly run.
11383
+ */
11372
11384
  cron: string().optional(),
11373
- /** ms-epoch of next computed firing for this destination's cron, if any. */
11385
+ /** ms-epoch of the next firing across those schedules (earliest), if any. */
11374
11386
  nextRunAt: number().optional(),
11375
- /** ms-epoch of last successful scheduled run (mirrors policy.lastRunAt). */
11376
- lastRunAt: number().optional()
11387
+ /**
11388
+ * ms-epoch of the last time a run ATTEMPTED to write here — success or
11389
+ * failure. Never a success stamp: pair it with `lastSuccessAt` (the
11390
+ * newest archive that actually landed) and `lastError`.
11391
+ */
11392
+ lastAttemptAt: number().optional(),
11393
+ /**
11394
+ * Why the last attempt failed, verbatim. Absent when the last attempt
11395
+ * landed the archive. A destination that has never been written to has
11396
+ * neither this nor `lastAttemptAt`.
11397
+ */
11398
+ lastError: string().optional()
11377
11399
  });
11378
11400
  /**
11379
11401
  * Per-archive entry returned by `backup.listArchives({ destinationId })`.
@@ -11536,8 +11558,16 @@ var BackupScheduleSchema = object({
11536
11558
  retentionCount: number().int().min(1).max(1e3),
11537
11559
  /** Optional subset of source locations to include; omitted = all. */
11538
11560
  dataSources: array(string()).readonly().optional(),
11539
- /** ms-epoch of last successful run. */
11540
- lastRunAt: number().optional(),
11561
+ /**
11562
+ * ms-epoch of the last tick that FIRED this schedule. Stamped before the
11563
+ * archive runs (it is the dedupe anchor), so it says "attempted", never
11564
+ * "succeeded" — a run refused by every destination stamps it too.
11565
+ */
11566
+ lastAttemptAt: number().optional(),
11567
+ /** ms-epoch of the last run of this schedule that landed at ≥1 destination. */
11568
+ lastSuccessAt: number().optional(),
11569
+ /** Why the last fired run failed, verbatim. Absent when it succeeded. */
11570
+ lastError: string().optional(),
11541
11571
  /** ms-epoch of next computed firing (read-only, filled on list). */
11542
11572
  nextRunAt: number().optional()
11543
11573
  });
@@ -11586,14 +11616,7 @@ method(_void(), array(BackupDestinationInfoSchema).readonly(), { auth: "admin" }
11586
11616
  locationId: string(),
11587
11617
  enabled: boolean(),
11588
11618
  retentionCount: number().int().min(1).max(1e3),
11589
- label: string().optional(),
11590
- /**
11591
- * Per-destination cron expression. Empty string clears the
11592
- * schedule (manual-only). Validated server-side via croner;
11593
- * malformed expressions reject the upsert with an actionable
11594
- * message.
11595
- */
11596
- cron: string().optional()
11619
+ label: string().optional()
11597
11620
  }), _void(), {
11598
11621
  kind: "mutation",
11599
11622
  auth: "admin"
@@ -22742,7 +22765,7 @@ method(object({
22742
22765
  downloadId: string(),
22743
22766
  offset: number(),
22744
22767
  length: number()
22745
- }), _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({
22768
+ }), _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({
22746
22769
  createdAt: true,
22747
22770
  updatedAt: true
22748
22771
  }), StorageLocationSchema, {
@@ -39595,12 +39618,6 @@ Object.freeze({
39595
39618
  addonId: null,
39596
39619
  access: "view"
39597
39620
  },
39598
- "storage.getDefaultLocation": {
39599
- capName: "storage",
39600
- capScope: "system",
39601
- addonId: null,
39602
- access: "view"
39603
- },
39604
39621
  "storage.list": {
39605
39622
  capName: "storage",
39606
39623
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-tuya",
3
- "version": "0.2.77",
3
+ "version": "0.2.79",
4
4
  "description": "Tuya / Smart Life device-provider addon for CamStack — account-onboarded (Tuya IoT cloud fetch of device localKeys) + LOCAL DP control via the @apocaliss92/nodetuya encrypted-LAN client, exposing switch / water-heater-family kettle entities",
5
5
  "keywords": [
6
6
  "camstack",