@camstack/system 1.2.278 → 1.2.280

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 (55) hide show
  1. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  2. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  3. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/alerts/alerts.addon.js +1 -1
  6. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  7. package/dist/builtins/autotrack/index.js +1 -1
  8. package/dist/builtins/autotrack/index.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/camera-grid/index.js +1 -1
  12. package/dist/builtins/camera-grid/index.mjs +1 -1
  13. package/dist/builtins/console-logging/index.js +1 -1
  14. package/dist/builtins/console-logging/index.mjs +1 -1
  15. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  16. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  17. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  18. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  19. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  20. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  21. package/dist/builtins/hub-forwarder/index.js +1 -1
  22. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  23. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  24. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  25. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  26. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  27. package/dist/builtins/local-network/local-network.addon.js +1 -1
  28. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  29. package/dist/builtins/loki-logging/index.js +1 -1
  30. package/dist/builtins/loki-logging/index.mjs +1 -1
  31. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  32. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  33. package/dist/builtins/platform-probe/index.js +1 -1
  34. package/dist/builtins/platform-probe/index.mjs +1 -1
  35. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  36. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  37. package/dist/builtins/snapshot/index.js +1 -1
  38. package/dist/builtins/snapshot/index.mjs +1 -1
  39. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  40. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  41. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  42. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  43. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  44. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  45. package/dist/builtins/system-config/system-config.addon.js +1 -1
  46. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  47. package/dist/builtins/winston-logging/index.js +1 -1
  48. package/dist/builtins/winston-logging/index.mjs +1 -1
  49. package/dist/{dist-BWz_gZ5l.js → dist-BgY90Yex.js} +362 -19
  50. package/dist/{dist-D1atncyi.mjs → dist-CmWZ6vlL.mjs} +362 -19
  51. package/dist/index.js +1 -1
  52. package/dist/index.mjs +1 -1
  53. package/dist/{retired-settings-keys-Ek9MPzCi.js → retired-settings-keys-BAp4yjKK.js} +1 -1
  54. package/dist/{retired-settings-keys-rG_QVMT3.mjs → retired-settings-keys-DPtUY3oF.mjs} +1 -1
  55. package/package.json +1 -1
@@ -691,7 +691,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
691
691
  return EventCategory;
692
692
  }({});
693
693
  //#endregion
694
- //#region ../types/dist/sleep-CaB_hL5g.mjs
694
+ //#region ../types/dist/sleep-BVhJDJka.mjs
695
695
  /**
696
696
  * The audio chunk plane's byte format, and the ONE expansion from a coded
697
697
  * window to float samples (D455).
@@ -2853,6 +2853,18 @@ function systemMethod(input, output, options) {
2853
2853
  systemOnly: true
2854
2854
  };
2855
2855
  }
2856
+ /**
2857
+ * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
2858
+ * on `InferProvider`. The `providerOptional: true` literal is what
2859
+ * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
2860
+ * for when this is the honest answer and when it is a soft stub.
2861
+ */
2862
+ function optionalMethod(input, output, options) {
2863
+ return {
2864
+ ...method(input, output, options),
2865
+ providerOptional: true
2866
+ };
2867
+ }
2856
2868
  /** Shorthand to define an event schema */
2857
2869
  function event(data) {
2858
2870
  return { data };
@@ -26214,6 +26226,59 @@ var ClipPlaybackSchema = z.object({
26214
26226
  * which days it asked for and got nothing — "no clips" would be a lie about a
26215
26227
  * card that is full of them.
26216
26228
  */
26229
+ /**
26230
+ * The operator's authorisation to WAKE a sleeping camera for one clip read.
26231
+ *
26232
+ * ONE value, absent by default, and it is a `force`-shaped operator signal in
26233
+ * exactly the sense `snapshot-wake-gate.ts` uses the word: *"`snapshot.getSnapshot`'s
26234
+ * `force` flag, and nothing else… a background caller must never set it…
26235
+ * Stale but honest beats woken"*. A scheduler, a retry, a reconcile and a
26236
+ * prefetch never set it; a surface sets it only behind the same confirm the
26237
+ * "Wake and refresh" gesture uses, and it is refused below 15 % battery
26238
+ * exactly as that gesture is.
26239
+ *
26240
+ * The gate is decided BEFORE `getApi()`, because on UDP the login IS the wake
26241
+ * (D549) — a read that opened a session and then checked would have woken the
26242
+ * camera to find out it was not allowed to.
26243
+ *
26244
+ * **One authorised yes is one wake.** `next-natural` — take the clip the next
26245
+ * time the camera is awake for its own reasons — is deliberately not a member:
26246
+ * it was proposed, it is free on the battery, and the operator declined it on
26247
+ * 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."*,
26248
+ * D558 "Considered and not taken").
26249
+ */
26250
+ var ClipWakeSchema = z.enum(["authorised"]);
26251
+ /**
26252
+ * A clip's finished bytes, inline — the twin of `recordingExport.readExportBytes`.
26253
+ *
26254
+ * `bytes` is the DECODED length, so nobody infers it from the base64 length,
26255
+ * and `served` says which twin the caller actually got.
26256
+ */
26257
+ var ClipBytesSchema = z.object({
26258
+ base64: z.string(),
26259
+ contentType: z.string(),
26260
+ /** Suggested filename, extension included. */
26261
+ name: z.string(),
26262
+ bytes: z.number().int().nonnegative(),
26263
+ /**
26264
+ * Which twin was actually served — the same contract
26265
+ * {@link ClipPlaybackSchema.served} carries, and REQUIRED here because the
26266
+ * export record persists it: a row read a week later must say the same thing
26267
+ * the panel said at the moment of the tap. A missing main twin is never
26268
+ * served silently as if it were the asked-for quality (D549 15).
26269
+ */
26270
+ served: CamProfileSchema,
26271
+ /**
26272
+ * The DECODED duration of the delivered file, when the fetch measured one.
26273
+ *
26274
+ * A clip fetch verifies its own completion against the catalog row and
26275
+ * retries a materially short pass (D568); this is that measurement, carried
26276
+ * so a consumer can say the same thing rather than re-deriving it. Absent
26277
+ * when the producer did not measure — never zero, which would say the file
26278
+ * is empty.
26279
+ */
26280
+ durationMs: z.number().positive().optional()
26281
+ });
26217
26282
  var ClipSourceAvailabilitySchema = z.object({
26218
26283
  state: z.enum([
26219
26284
  "ok",
@@ -26315,22 +26380,40 @@ var videoclipsCapability = {
26315
26380
  limit: z.number().int().positive().optional(),
26316
26381
  /**
26317
26382
  * WHICH provider to ask — the `addonId` a {@link ClipSourceSchema} row
26318
- * carries, never a source id and never a list.
26383
+ * carries, never a source id and never a list. **Required** (D554 amended).
26384
+ *
26385
+ * A provider the device is not bound to is refused by name rather than
26386
+ * answered by another one (D552's `rejectUnresolvedAddonPin` rule).
26387
+ *
26388
+ * It was optional, documented as "absent means the device's BOUND
26389
+ * provider, which is CamStack on every camera". No code implemented
26390
+ * that. Measured on the live hub 2026-09-20 — device 592, bound to
26391
+ * `recorder` AND `provider-reolink` — a bare call with `limit: 3`
26392
+ * answered SIX rows, three from each source, merged newest-first:
26393
+ * `device-collection-dispatch.ts` simply left the fan-out un-narrowed,
26394
+ * so absence bought the union this method exists not to be, and
26395
+ * `limit` meant `limit × sources`.
26319
26396
  *
26320
- * Absent means the device's BOUND provider, which is CamStack on every
26321
- * camera today because that is what `deviceManager.getBindings`
26322
- * answers with. A provider the device is not bound to is refused by
26323
- * name rather than answered by another one (D552's
26324
- * `rejectUnresolvedAddonPin` rule).
26397
+ * There is nothing to restore the default to. `getBindings` answers a
26398
+ * collection cap with a DERIVED, PLURAL set (D554 amended, step 0);
26399
+ * `setWrapperActive` — the singleton authority that could name one —
26400
+ * throws for a collection cap by design. Naming CamStack here instead
26401
+ * would privilege one addon by id inside a surface whose premise is
26402
+ * that sources are peers, and would be wrong on the first camera with
26403
+ * no recorder binding. So absence is REFUSED, in the schema, where the
26404
+ * generated types make it unomittable rather than merely discouraged.
26405
+ *
26406
+ * The default belongs to the SURFACE, which has the `listSources` rows
26407
+ * and can say which one it picked (D569 § 1–3; the viewer already
26408
+ * always sends this).
26325
26409
  *
26326
26410
  * It replaced `sources?: string[]`, a VIEW filter over source ids that
26327
26411
  * assumed the answer was a fan-out over everything a camera has. The
26328
- * operator settled otherwise on 2026-09-20 — *"il get videoclips
26329
- * prendere un provider opzionale, di default va su camstack"*,
26330
- * *"l'utilizzatore è uno solo"* — so the list is asked of one provider
26331
- * at a time and there is nothing to filter out of it.
26412
+ * operator settled otherwise on 2026-09-20 — *"l'utilizzatore è uno
26413
+ * solo"* — so the list is asked of one provider at a time and there is
26414
+ * nothing to filter out of it.
26332
26415
  */
26333
- provider: z.string().optional()
26416
+ provider: z.string().min(1)
26334
26417
  }), z.array(ClipSchema).readonly(), {
26335
26418
  kind: "query",
26336
26419
  auth: "protected"
@@ -26367,6 +26450,68 @@ var videoclipsCapability = {
26367
26450
  }), ClipPlaybackSchema, {
26368
26451
  kind: "query",
26369
26452
  auth: "protected"
26453
+ }),
26454
+ /**
26455
+ * This clip's BYTES, base64, bounded — the by-handle read a clip EXPORT
26456
+ * pulls once (D558).
26457
+ *
26458
+ * `getClipPlayback` is the right answer for a player: it hands back a URL
26459
+ * on a plane the hub serves `access:'authenticated'`, which a browser and a
26460
+ * viewer session satisfy. It is the wrong answer for another ADDON. There
26461
+ * is no addon→addon byte transport in this framework — `AddonDataPlane`
26462
+ * only lets an addon SERVE, on `127.0.0.1` behind a per-listener secret
26463
+ * only the hub may present — so a recorder that wants a camera's clip
26464
+ * cannot fetch that URL. This method is the one seam that exists for it,
26465
+ * and it is deliberately the same shape (and the same bound) as
26466
+ * `recordingExport.readExportBytes`, which exists for the mirror-image
26467
+ * reason.
26468
+ *
26469
+ * Routing needs no `provider` pin: the id is source-prefixed and
26470
+ * self-contained, so `device-collection-dispatch.ts` rule 3 hands the call
26471
+ * to the source that claims it — and an id nobody claims is REFUSED rather
26472
+ * than answered by another source.
26473
+ *
26474
+ * The producer reuses the fetch path it already has, completion rules
26475
+ * included: a clip is taken by cmd 5 and finished on a short idle window
26476
+ * whose result is PROVED against the catalog row's own span, retried once
26477
+ * when it comes up materially short, and served-and-named when it is still
26478
+ * short (D568). A second fetch with different completion rules is exactly
26479
+ * the second authority D558 refuses to create.
26480
+ *
26481
+ * Every refusal THROWS with its reason and none of them is silent — the
26482
+ * sleep gate (decided before `getApi()`, liftable only by
26483
+ * {@link ClipWakeSchema}), a catalog row nobody claims, a clip with no
26484
+ * bytes behind it, a mux that failed, and the size bound. The caller turns
26485
+ * that reason into an operator-facing one; a truncated file is never an
26486
+ * answer.
26487
+ */
26488
+ readClipBytes: optionalMethod(z.object({
26489
+ deviceId: z.number(),
26490
+ clipId: z.string().min(1),
26491
+ /**
26492
+ * Which twin to fetch, on the mapping D549 15 already fixed:
26493
+ * `low | mid` → the sub file, `high` → the main twin. `auto` is not
26494
+ * accepted here for the same reason it is not accepted by
26495
+ * `getClipPlayback` — a stored file has no broker session, so the
26496
+ * adaptive tier cannot be resolved for it.
26497
+ */
26498
+ profile: CamProfileSchema.optional(),
26499
+ /**
26500
+ * The CALLER's byte bound, so an over-size clip is refused before it is
26501
+ * read and encoded rather than after. Capped by
26502
+ * {@link VIDEOCLIPS_MAX_READ_BYTES} whatever is passed; absent means
26503
+ * that ceiling.
26504
+ */
26505
+ maxBytes: z.number().int().positive().optional(),
26506
+ /**
26507
+ * The operator's authorisation to wake a sleeping camera for this
26508
+ * read. Absent — the default — means a sleeping standalone battery
26509
+ * camera is REFUSED by name, before any session is opened.
26510
+ */
26511
+ wake: ClipWakeSchema.optional()
26512
+ }), ClipBytesSchema, {
26513
+ kind: "query",
26514
+ auth: "protected"
26370
26515
  })
26371
26516
  }
26372
26517
  };
@@ -35443,13 +35588,135 @@ var ExportStateSchema = z.enum([
35443
35588
  "expired",
35444
35589
  "deleted"
35445
35590
  ]);
35446
- /** One export job / history row. */
35591
+ /**
35592
+ * A stretch of footage THIS system recorded — the only thing `createExport`
35593
+ * could export before D558, and still the shape every legacy caller sends.
35594
+ */
35595
+ var ExportFootageSubjectSchema = z.object({
35596
+ kind: z.literal("footage"),
35597
+ deviceId: z.number(),
35598
+ profiles: z.array(z.string()).min(1),
35599
+ fromMs: z.number(),
35600
+ toMs: z.number()
35601
+ });
35602
+ /**
35603
+ * A CLIP — a finished file with boundaries the camera chose, listed by one of
35604
+ * the device's `videoclips` sources.
35605
+ *
35606
+ * There is deliberately **no `fromMs`/`toMs` here**. The camera chose them,
35607
+ * no surface on this path asks for them (there is no drag and no
35608
+ * `datetime-local` pair — D558 § 5.4.3), and they reach the record only as the
35609
+ * projection. A range in the subject would be a second place the boundaries
35610
+ * live and the one a caller could get wrong.
35611
+ *
35612
+ * `provider` is the **addonId** of the source's serving addon — the `provider`
35613
+ * pin `videoclips.listClips` REQUIRES since D554 was amended on 2026-09-20.
35614
+ * There was never a default: a bare call fanned out and returned the union of
35615
+ * every source with `limit` meaning `limit × sources`. The catalog check that
35616
+ * validates this subject names it, so it asks exactly the source the operator
35617
+ * picked.
35618
+ *
35619
+ * `source` is that source's id (the namespace `clipId` is prefixed with), and
35620
+ * `sourceLabel` is its operator-facing name FROZEN at creation — a history row
35621
+ * still reads "SD card" after the source is unbound.
35622
+ *
35623
+ * `profile` is exactly ONE, and it is what was ASKED. What was SERVED lands on
35624
+ * the record's top-level `profile`, so a clip with no main twin renders the
35625
+ * divergence instead of hiding it (D549 15; measured on 592, 17 of 546 clips
35626
+ * had no main twin, so a silent fallback would be right 96.9 % of the time).
35627
+ * `auto` is not a member: a stored file has no broker session, so the adaptive
35628
+ * tier cannot be resolved for it.
35629
+ */
35630
+ var ExportClipSubjectSchema = z.object({
35631
+ kind: z.literal("clip"),
35632
+ deviceId: z.number(),
35633
+ provider: z.string().min(1),
35634
+ source: z.string().min(1),
35635
+ sourceLabel: z.string().min(1),
35636
+ clipId: z.string().min(1),
35637
+ /**
35638
+ * WHERE IN THE CATALOG to confirm this clip — the day window the surface was
35639
+ * already listing when the operator picked the segment.
35640
+ *
35641
+ * It is **not** a time range control and it never becomes one: the record's
35642
+ * `fromMs`/`toMs` come from the catalog ROW and from nothing a caller
35643
+ * supplied (D558 § 5.4.3), and a window that does not contain the clip is a
35644
+ * `catalog-miss`, not a silently wider search. It exists because
35645
+ * `videoclips.listClips` takes `since`/`until` and has no by-handle twin:
35646
+ * the catalog check D558 asks for is literally that call, and a call needs a
35647
+ * window. The surface has one — `ClipsBrowser`'s `dayWindow`, one local
35648
+ * wall-clock day, which is also the only width measured to be cheap (one
35649
+ * day on 592 lists 171 clips in 712 ms, a busy day 546 in 2.0 s; twenty days
35650
+ * of one child's events took 3.6–5.4 s).
35651
+ */
35652
+ catalogWindow: z.object({
35653
+ sinceMs: z.number(),
35654
+ untilMs: z.number()
35655
+ }),
35656
+ profile: z.enum([
35657
+ "high",
35658
+ "mid",
35659
+ "low"
35660
+ ]),
35661
+ /**
35662
+ * The operator's authorisation to wake a sleeping camera for this export.
35663
+ * ONE definition, in the cap that owns the clip read ({@link ClipWakeSchema}),
35664
+ * because the gate that honours it is the clip provider's sleep gate — a
35665
+ * second enum here would be a second contract. Absent by default; never
35666
+ * settable by a scheduler or a retry.
35667
+ *
35668
+ * **One authorised yes is ONE wake.** A failed clip export is retried only by
35669
+ * an operator act that asks again; a queued job that outlived its wake fails
35670
+ * with a reason rather than waking on its turn; and this subject carries
35671
+ * exactly one profile precisely so one tap is never two fetches (D558 § 5.2).
35672
+ */
35673
+ wake: ClipWakeSchema.optional()
35674
+ });
35675
+ /**
35676
+ * WHAT an export is — the authority, as opposed to the four top-level fields
35677
+ * the Library sorts and labels on (D558 § 2.2).
35678
+ *
35679
+ * Read it through {@link exportSubjectOf}, never off the record directly: the
35680
+ * field is optional for the history rows written before it existed, and that
35681
+ * absence has exactly one interpreter.
35682
+ */
35683
+ var ExportSubjectSchema = z.discriminatedUnion("kind", [ExportFootageSubjectSchema, ExportClipSubjectSchema]);
35684
+ /**
35685
+ * One export job / history row.
35686
+ *
35687
+ * **`subject` is the AUTHORITY on what was exported. `deviceId`, `profile`,
35688
+ * `fromMs` and `toMs` are its PROJECTION** — kept top-level because the whole
35689
+ * Library sorts and labels on them (`library-items.ts` orders an export by
35690
+ * `fromMs`; `export-format.ts` draws `rangeLabel` from the pair), and a row
35691
+ * that did not fill them would sort under the epoch and render a blank range.
35692
+ * Write to the subject and read from the projection and the two will disagree;
35693
+ * the projection is derived at creation and never edited afterwards.
35694
+ *
35695
+ * And they mean DIFFERENT FACTS for the two kinds, which is the part a reader
35696
+ * who knows only the recording export will get wrong:
35697
+ *
35698
+ * | field | `kind:'footage'` | `kind:'clip'` |
35699
+ * | --- | --- | --- |
35700
+ * | `fromMs`/`toMs` | the stretch the operator ASKED for | the camera's own boundaries, always `clip.timeRange`, never anything a caller supplied |
35701
+ * | `profile` | the stream rendered | the twin actually SERVED (`subject.profile` is the one asked for) |
35702
+ *
35703
+ * Same type, different fact — the shape this repo keeps getting wrong (D385's
35704
+ * two authorities, D224's second copy).
35705
+ */
35447
35706
  var ExportRecordSchema = z.object({
35448
35707
  id: z.string(),
35449
35708
  deviceId: z.number(),
35450
35709
  profile: z.string(),
35451
35710
  fromMs: z.number(),
35452
35711
  toMs: z.number(),
35712
+ /**
35713
+ * What this export IS. Optional ONLY for the rows written before D558: the
35714
+ * store parses every row through this schema on every read, so a required
35715
+ * field would make the export AUDIT — which is the whole reason rows survive
35716
+ * file deletion — unreadable in one release. Absence means `footage`, and
35717
+ * {@link exportSubjectOf} is the one place that says so.
35718
+ */
35719
+ subject: ExportSubjectSchema.optional(),
35453
35720
  options: ExportOptionsSchema,
35454
35721
  state: ExportStateSchema,
35455
35722
  /** 0–100 while rendering; null otherwise. */
@@ -35466,6 +35733,18 @@ var ExportRecordSchema = z.object({
35466
35733
  /** Failure reason when state is 'failed'; null otherwise. */
35467
35734
  error: z.string().nullable()
35468
35735
  });
35736
+ z.enum([
35737
+ "catalog-miss",
35738
+ "catalog-unreachable",
35739
+ "no-file-for-window",
35740
+ "clip-in-progress",
35741
+ "unsupported-option",
35742
+ "sleeping",
35743
+ "camera-refused",
35744
+ "fetch-failed",
35745
+ "too-large-to-transfer",
35746
+ "wake-expired"
35747
+ ]);
35469
35748
  /** Candidate download URLs (LAN first, then operator extra hosts). */
35470
35749
  var ExportDownloadSchema = z.object({
35471
35750
  url: z.string(),
@@ -35484,24 +35763,77 @@ var ExportBytesSchema = z.object({
35484
35763
  name: z.string(),
35485
35764
  bytes: z.number().int().nonnegative()
35486
35765
  });
35766
+ /** Canonical `profiles[]`, falling back to the legacy singular `profile`. */
35767
+ function resolveExportProfiles(input) {
35768
+ if (input.profiles !== void 0 && input.profiles.length > 0) return [...input.profiles];
35769
+ if (typeof input.profile === "string" && input.profile.length > 0) return [input.profile];
35770
+ return [];
35771
+ }
35487
35772
  var recordingExportCapability = {
35488
35773
  name: "recording-export",
35489
35774
  scope: "system",
35490
35775
  mode: "singleton",
35491
35776
  methods: {
35492
- /** Queue a render of `[fromMs,toMs)` for `deviceId`/`profiles` (legacy
35493
- * singular `profile` still accepted). Fails fast when no footage covers
35494
- * the range. One job per profile; returns the first queued record. */
35777
+ /**
35778
+ * Queue an export of {@link ExportSubjectSchema}.
35779
+ *
35780
+ * `kind:'footage'` — a render of `[fromMs,toMs)` for `deviceId`/`profiles`
35781
+ * (legacy flat input, singular `profile` included, still accepted and
35782
+ * rewritten). Fails fast when no footage covers the range. One job per
35783
+ * profile; **returns the first queued record and the others are reachable
35784
+ * only through `listExports`** — a defect named in D558 § 6.3 and the
35785
+ * reason a clip subject carries exactly ONE profile.
35786
+ *
35787
+ * `kind:'clip'` — a finished file the camera holds, validated against the
35788
+ * device's clip CATALOG (`videoclips.listClips`, at the subject's
35789
+ * `provider`) instead of the recording index, and fetched once by handle
35790
+ * under a bound. Its `fromMs`/`toMs` come from the catalog row and from
35791
+ * nowhere else; a caller supplying a range is refused.
35792
+ *
35793
+ * A clip export reuses the six {@link ExportStateSchema} members and adds
35794
+ * none: the viewer maps an unknown state string to `failed`, so a seventh
35795
+ * member renders every live export — of both kinds — as FAILED on every
35796
+ * installed app (D558 § 6.1, pinned by `export-state-members.spec.ts`).
35797
+ * `subject.kind` is what tells a surface what `rendering` means.
35798
+ */
35495
35799
  createExport: method(z.object({
35496
35800
  deviceId: z.number(),
35497
35801
  /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
35498
35802
  profile: z.string().optional(),
35499
35803
  profiles: z.array(z.string()).min(1).optional(),
35500
- fromMs: z.number(),
35501
- toMs: z.number(),
35804
+ /** Footage only — a clip's boundaries are the camera's. */
35805
+ fromMs: z.number().optional(),
35806
+ toMs: z.number().optional(),
35807
+ /** What to export. Absent means the legacy flat footage request. */
35808
+ subject: ExportSubjectSchema.optional(),
35502
35809
  options: ExportOptionsSchema
35503
35810
  }).superRefine((v, ctx) => {
35504
- if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
35811
+ if (v.subject?.kind === "clip") {
35812
+ if (v.subject.deviceId !== v.deviceId) ctx.addIssue({
35813
+ code: z.ZodIssueCode.custom,
35814
+ message: `subject.deviceId (${v.subject.deviceId}) must equal deviceId (${v.deviceId}) — the top-level field is what per-device scope enforcement reads`,
35815
+ path: ["subject", "deviceId"]
35816
+ });
35817
+ if (v.fromMs !== void 0 || v.toMs !== void 0) ctx.addIssue({
35818
+ code: z.ZodIssueCode.custom,
35819
+ message: "a clip export asks for no time range: the camera chose the boundaries and they are read from the catalog row",
35820
+ path: ["fromMs"]
35821
+ });
35822
+ return;
35823
+ }
35824
+ if (v.subject?.kind === "footage" && v.subject.deviceId !== v.deviceId) ctx.addIssue({
35825
+ code: z.ZodIssueCode.custom,
35826
+ message: `subject.deviceId (${v.subject.deviceId}) must equal deviceId (${v.deviceId})`,
35827
+ path: ["subject", "deviceId"]
35828
+ });
35829
+ const fromMs = v.subject?.kind === "footage" ? v.subject.fromMs : v.fromMs;
35830
+ const toMs = v.subject?.kind === "footage" ? v.subject.toMs : v.toMs;
35831
+ if (typeof fromMs !== "number" || typeof toMs !== "number") ctx.addIssue({
35832
+ code: z.ZodIssueCode.custom,
35833
+ message: "a footage export needs fromMs and toMs",
35834
+ path: ["fromMs"]
35835
+ });
35836
+ if ((v.subject?.kind === "footage" ? [...v.subject.profiles] : resolveExportProfiles(v)).length < 1) ctx.addIssue({
35505
35837
  code: z.ZodIssueCode.custom,
35506
35838
  message: "pass profiles[] (min 1) or legacy profile",
35507
35839
  path: ["profiles"]
@@ -46358,6 +46690,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
46358
46690
  addonId: null,
46359
46691
  access: "view"
46360
46692
  },
46693
+ "videoclips.readClipBytes": {
46694
+ capName: "videoclips",
46695
+ capScope: "device",
46696
+ addonId: null,
46697
+ access: "view"
46698
+ },
46361
46699
  "viewerUi.getStaticDir": {
46362
46700
  capName: "viewer-ui",
46363
46701
  capScope: "system",
@@ -48376,6 +48714,11 @@ Object.freeze({
48376
48714
  form: "single",
48377
48715
  optional: false
48378
48716
  }],
48717
+ "videoclips.readClipBytes": [{
48718
+ name: "deviceId",
48719
+ form: "single",
48720
+ optional: false
48721
+ }],
48379
48722
  "waterHeater.setAway": [{
48380
48723
  name: "deviceId",
48381
48724
  form: "single",
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
- const require_dist = require("./dist-BWz_gZ5l.js");
3
+ const require_dist = require("./dist-BgY90Yex.js");
4
4
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
5
5
  require("./builtins/alerts/index.js");
6
6
  const require_formatter = require("./formatter-DqAKDlvN.js");
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM$1, r as __exportAll, t as __commonJSMin$1 } from "./chunk-CNf5ZN-e.mjs";
2
- import { An as parseJsonUnknown, F as addonSettingsCapability, Fn as EventCategory$1, Gt as scopesAllowDeviceCap, Ht as resolveMethodAuth, It as procedureAuthKey, Mn as resolveCapMount, Mt as objectInputDeclaresAddonId, Nn as scopeKey, Nt as objectInputDeclaresRequiredDeviceId, S as RUNTIME_DEFAULTS, Sn as emitDownForOwnedCaps, Tt as looseSchema, Wt as scopesAllowAddon, _t as isVoidInput, bn as asString$1, bt as lifecycleJobSchema, dn as DEVICE_STATUS_METHOD, dt as isArrayOutputSchema, ft as isCollectionArrayMethod, g as LOG_LEVEL_RANK, gn as ReadinessTimeoutError, hn as ReadinessRegistry, jn as readinessKey, kn as parseJsonObject, ln as DATAPLANE_SECRET_HEADER$1, mt as isObjectInput, on as errMsg$1, st as extractNestedAddonId, t as ALL_CAPABILITY_DEFINITIONS, un as DEVICE_SETTINGS_CONTRIBUTION_METHODS, vn as asJsonObject$1, vt as kebabToCamel, wn as expandCapMethods, wt as logLevelAtMost, xn as createEvent, y as METHOD_ACCESS_MAP, yn as asNumber } from "./dist-D1atncyi.mjs";
2
+ import { An as parseJsonUnknown, F as addonSettingsCapability, Fn as EventCategory$1, Gt as scopesAllowDeviceCap, Ht as resolveMethodAuth, It as procedureAuthKey, Mn as resolveCapMount, Mt as objectInputDeclaresAddonId, Nn as scopeKey, Nt as objectInputDeclaresRequiredDeviceId, S as RUNTIME_DEFAULTS, Sn as emitDownForOwnedCaps, Tt as looseSchema, Wt as scopesAllowAddon, _t as isVoidInput, bn as asString$1, bt as lifecycleJobSchema, dn as DEVICE_STATUS_METHOD, dt as isArrayOutputSchema, ft as isCollectionArrayMethod, g as LOG_LEVEL_RANK, gn as ReadinessTimeoutError, hn as ReadinessRegistry, jn as readinessKey, kn as parseJsonObject, ln as DATAPLANE_SECRET_HEADER$1, mt as isObjectInput, on as errMsg$1, st as extractNestedAddonId, t as ALL_CAPABILITY_DEFINITIONS, un as DEVICE_SETTINGS_CONTRIBUTION_METHODS, vn as asJsonObject$1, vt as kebabToCamel, wn as expandCapMethods, wt as logLevelAtMost, xn as createEvent, y as METHOD_ACCESS_MAP, yn as asNumber } from "./dist-CmWZ6vlL.mjs";
3
3
  import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
4
4
  import "./builtins/alerts/index.mjs";
5
5
  import { t as formatLogLine } from "./formatter-B7qW8bPJ.mjs";
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-BWz_gZ5l.js");
1
+ const require_dist = require("./dist-BgY90Yex.js");
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
@@ -1,4 +1,4 @@
1
- import { vn as asJsonObject } from "./dist-D1atncyi.mjs";
1
+ import { vn as asJsonObject } from "./dist-CmWZ6vlL.mjs";
2
2
  //#region src/builtins/sqlite-storage/retired-settings-keys.ts
3
3
  /**
4
4
  * Is THIS node the one whose settings store is the cluster's authority?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/system",
3
- "version": "1.2.278",
3
+ "version": "1.2.280",
4
4
  "description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
5
5
  "keywords": [
6
6
  "camstack",