@camstack/addon-pipeline 1.2.274 → 1.2.276

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 (32) hide show
  1. package/dist/audio-analyzer/index.js +2 -2
  2. package/dist/audio-analyzer/index.mjs +2 -2
  3. package/dist/{default-detection-model-CAWhHQo2.js → default-detection-model-6lCvep7n.js} +1 -1
  4. package/dist/{default-detection-model-BXwE-Dvo.mjs → default-detection-model-dQSwHHfx.mjs} +1 -1
  5. package/dist/detection-pipeline/index.js +4 -4
  6. package/dist/detection-pipeline/index.mjs +4 -4
  7. package/dist/{dist-g5MfpiBh.mjs → dist-C1pCVJk7.mjs} +440 -32
  8. package/dist/{dist-k6Vu-AhZ.js → dist-NYjn7hkE.js} +469 -31
  9. package/dist/motion-wasm/index.js +1 -1
  10. package/dist/motion-wasm/index.mjs +1 -1
  11. package/dist/{node-BXsHQH5h.mjs → node--UY0iepi.mjs} +1 -1
  12. package/dist/{node--u_jUObS.js → node-CVYY8a4y.js} +1 -1
  13. package/dist/pipeline-runner/index.js +3 -3
  14. package/dist/pipeline-runner/index.mjs +3 -3
  15. package/dist/{process-memory-Gl3EowL-.mjs → process-memory-BQOfL3Ig.mjs} +1 -1
  16. package/dist/{process-memory-DN7opum2.js → process-memory-DDvuSEMJ.js} +1 -1
  17. package/dist/recorder/index.js +572 -40
  18. package/dist/recorder/index.mjs +572 -40
  19. package/dist/{segment-demux-js-sYP_jndp.mjs → segment-demux-js-B0_aAzN0.mjs} +1 -1
  20. package/dist/{segment-demux-js-DHX8o8pI.js → segment-demux-js-DVupBBc4.js} +1 -1
  21. package/dist/stream-broker/_stub.js +2 -2
  22. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CEy8IryH.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-D0A4Ra4h.mjs} +2 -2
  23. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BV2tQ1w3.mjs +26 -0
  24. package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-MU3_q1MX.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BnLVuoDg.mjs} +1 -1
  25. package/dist/stream-broker/demux-worker-child.js +1 -1
  26. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  27. package/dist/stream-broker/{hostInit-UKNN4qes.mjs → hostInit-C8TnCvWj.mjs} +2 -2
  28. package/dist/stream-broker/index.js +526 -69
  29. package/dist/stream-broker/index.mjs +526 -69
  30. package/dist/stream-broker/remoteEntry.js +1 -1
  31. package/package.json +1 -1
  32. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BlXyfeXU.mjs +0 -26
@@ -5360,7 +5360,7 @@ var ZodIssueCode = {
5360
5360
  var ZodFirstPartyTypeKind;
5361
5361
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5362
5362
  //#endregion
5363
- //#region ../types/dist/sleep-CaB_hL5g.mjs
5363
+ //#region ../types/dist/sleep-BVhJDJka.mjs
5364
5364
  /**
5365
5365
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5366
5366
  * window to float samples (D455).
@@ -7102,6 +7102,18 @@ function systemMethod(input, output, options) {
7102
7102
  systemOnly: true
7103
7103
  };
7104
7104
  }
7105
+ /**
7106
+ * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
7107
+ * on `InferProvider`. The `providerOptional: true` literal is what
7108
+ * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
7109
+ * for when this is the honest answer and when it is a soft stub.
7110
+ */
7111
+ function optionalMethod(input, output, options) {
7112
+ return {
7113
+ ...method(input, output, options),
7114
+ providerOptional: true
7115
+ };
7116
+ }
7105
7117
  /** Shorthand to define an event schema */
7106
7118
  function event(data) {
7107
7119
  return { data };
@@ -27418,6 +27430,59 @@ var ClipPlaybackSchema = object({
27418
27430
  * which days it asked for and got nothing — "no clips" would be a lie about a
27419
27431
  * card that is full of them.
27420
27432
  */
27433
+ /**
27434
+ * The operator's authorisation to WAKE a sleeping camera for one clip read.
27435
+ *
27436
+ * ONE value, absent by default, and it is a `force`-shaped operator signal in
27437
+ * exactly the sense `snapshot-wake-gate.ts` uses the word: *"`snapshot.getSnapshot`'s
27438
+ * `force` flag, and nothing else… a background caller must never set it…
27439
+ * Stale but honest beats woken"*. A scheduler, a retry, a reconcile and a
27440
+ * prefetch never set it; a surface sets it only behind the same confirm the
27441
+ * "Wake and refresh" gesture uses, and it is refused below 15 % battery
27442
+ * exactly as that gesture is.
27443
+ *
27444
+ * The gate is decided BEFORE `getApi()`, because on UDP the login IS the wake
27445
+ * (D549) — a read that opened a session and then checked would have woken the
27446
+ * camera to find out it was not allowed to.
27447
+ *
27448
+ * **One authorised yes is one wake.** `next-natural` — take the clip the next
27449
+ * time the camera is awake for its own reasons — is deliberately not a member:
27450
+ * it was proposed, it is free on the battery, and the operator declined it on
27451
+ * 2026-09-20 (*"Quando un export viene richiesto si sveglia la camera."*,
27452
+ * D558 "Considered and not taken").
27453
+ */
27454
+ var ClipWakeSchema = _enum(["authorised"]);
27455
+ /**
27456
+ * A clip's finished bytes, inline — the twin of `recordingExport.readExportBytes`.
27457
+ *
27458
+ * `bytes` is the DECODED length, so nobody infers it from the base64 length,
27459
+ * and `served` says which twin the caller actually got.
27460
+ */
27461
+ var ClipBytesSchema = object({
27462
+ base64: string(),
27463
+ contentType: string(),
27464
+ /** Suggested filename, extension included. */
27465
+ name: string(),
27466
+ bytes: number().int().nonnegative(),
27467
+ /**
27468
+ * Which twin was actually served — the same contract
27469
+ * {@link ClipPlaybackSchema.served} carries, and REQUIRED here because the
27470
+ * export record persists it: a row read a week later must say the same thing
27471
+ * the panel said at the moment of the tap. A missing main twin is never
27472
+ * served silently as if it were the asked-for quality (D549 15).
27473
+ */
27474
+ served: CamProfileSchema,
27475
+ /**
27476
+ * The DECODED duration of the delivered file, when the fetch measured one.
27477
+ *
27478
+ * A clip fetch verifies its own completion against the catalog row and
27479
+ * retries a materially short pass (D568); this is that measurement, carried
27480
+ * so a consumer can say the same thing rather than re-deriving it. Absent
27481
+ * when the producer did not measure — never zero, which would say the file
27482
+ * is empty.
27483
+ */
27484
+ durationMs: number().positive().optional()
27485
+ });
27421
27486
  var ClipSourceAvailabilitySchema = object({
27422
27487
  state: _enum([
27423
27488
  "ok",
@@ -27519,22 +27584,40 @@ var videoclipsCapability = {
27519
27584
  limit: number().int().positive().optional(),
27520
27585
  /**
27521
27586
  * WHICH provider to ask — the `addonId` a {@link ClipSourceSchema} row
27522
- * carries, never a source id and never a list.
27587
+ * carries, never a source id and never a list. **Required** (D554 amended).
27588
+ *
27589
+ * A provider the device is not bound to is refused by name rather than
27590
+ * answered by another one (D552's `rejectUnresolvedAddonPin` rule).
27591
+ *
27592
+ * It was optional, documented as "absent means the device's BOUND
27593
+ * provider, which is CamStack on every camera". No code implemented
27594
+ * that. Measured on the live hub 2026-09-20 — device 592, bound to
27595
+ * `recorder` AND `provider-reolink` — a bare call with `limit: 3`
27596
+ * answered SIX rows, three from each source, merged newest-first:
27597
+ * `device-collection-dispatch.ts` simply left the fan-out un-narrowed,
27598
+ * so absence bought the union this method exists not to be, and
27599
+ * `limit` meant `limit × sources`.
27600
+ *
27601
+ * There is nothing to restore the default to. `getBindings` answers a
27602
+ * collection cap with a DERIVED, PLURAL set (D554 amended, step 0);
27603
+ * `setWrapperActive` — the singleton authority that could name one —
27604
+ * throws for a collection cap by design. Naming CamStack here instead
27605
+ * would privilege one addon by id inside a surface whose premise is
27606
+ * that sources are peers, and would be wrong on the first camera with
27607
+ * no recorder binding. So absence is REFUSED, in the schema, where the
27608
+ * generated types make it unomittable rather than merely discouraged.
27523
27609
  *
27524
- * Absent means the device's BOUND provider, which is CamStack on every
27525
- * camera today because that is what `deviceManager.getBindings`
27526
- * answers with. A provider the device is not bound to is refused by
27527
- * name rather than answered by another one (D552's
27528
- * `rejectUnresolvedAddonPin` rule).
27610
+ * The default belongs to the SURFACE, which has the `listSources` rows
27611
+ * and can say which one it picked (D569 § 1–3; the viewer already
27612
+ * always sends this).
27529
27613
  *
27530
27614
  * It replaced `sources?: string[]`, a VIEW filter over source ids that
27531
27615
  * assumed the answer was a fan-out over everything a camera has. The
27532
- * operator settled otherwise on 2026-09-20 — *"il get videoclips
27533
- * prendere un provider opzionale, di default va su camstack"*,
27534
- * *"l'utilizzatore è uno solo"* — so the list is asked of one provider
27535
- * at a time and there is nothing to filter out of it.
27616
+ * operator settled otherwise on 2026-09-20 — *"l'utilizzatore è uno
27617
+ * solo"* — so the list is asked of one provider at a time and there is
27618
+ * nothing to filter out of it.
27536
27619
  */
27537
- provider: string().optional()
27620
+ provider: string().min(1)
27538
27621
  }), array(ClipSchema).readonly(), {
27539
27622
  kind: "query",
27540
27623
  auth: "protected"
@@ -27571,6 +27654,68 @@ var videoclipsCapability = {
27571
27654
  }), ClipPlaybackSchema, {
27572
27655
  kind: "query",
27573
27656
  auth: "protected"
27657
+ }),
27658
+ /**
27659
+ * This clip's BYTES, base64, bounded — the by-handle read a clip EXPORT
27660
+ * pulls once (D558).
27661
+ *
27662
+ * `getClipPlayback` is the right answer for a player: it hands back a URL
27663
+ * on a plane the hub serves `access:'authenticated'`, which a browser and a
27664
+ * viewer session satisfy. It is the wrong answer for another ADDON. There
27665
+ * is no addon→addon byte transport in this framework — `AddonDataPlane`
27666
+ * only lets an addon SERVE, on `127.0.0.1` behind a per-listener secret
27667
+ * only the hub may present — so a recorder that wants a camera's clip
27668
+ * cannot fetch that URL. This method is the one seam that exists for it,
27669
+ * and it is deliberately the same shape (and the same bound) as
27670
+ * `recordingExport.readExportBytes`, which exists for the mirror-image
27671
+ * reason.
27672
+ *
27673
+ * Routing needs no `provider` pin: the id is source-prefixed and
27674
+ * self-contained, so `device-collection-dispatch.ts` rule 3 hands the call
27675
+ * to the source that claims it — and an id nobody claims is REFUSED rather
27676
+ * than answered by another source.
27677
+ *
27678
+ * The producer reuses the fetch path it already has, completion rules
27679
+ * included: a clip is taken by cmd 5 and finished on a short idle window
27680
+ * whose result is PROVED against the catalog row's own span, retried once
27681
+ * when it comes up materially short, and served-and-named when it is still
27682
+ * short (D568). A second fetch with different completion rules is exactly
27683
+ * the second authority D558 refuses to create.
27684
+ *
27685
+ * Every refusal THROWS with its reason and none of them is silent — the
27686
+ * sleep gate (decided before `getApi()`, liftable only by
27687
+ * {@link ClipWakeSchema}), a catalog row nobody claims, a clip with no
27688
+ * bytes behind it, a mux that failed, and the size bound. The caller turns
27689
+ * that reason into an operator-facing one; a truncated file is never an
27690
+ * answer.
27691
+ */
27692
+ readClipBytes: optionalMethod(object({
27693
+ deviceId: number(),
27694
+ clipId: string().min(1),
27695
+ /**
27696
+ * Which twin to fetch, on the mapping D549 15 already fixed:
27697
+ * `low | mid` → the sub file, `high` → the main twin. `auto` is not
27698
+ * accepted here for the same reason it is not accepted by
27699
+ * `getClipPlayback` — a stored file has no broker session, so the
27700
+ * adaptive tier cannot be resolved for it.
27701
+ */
27702
+ profile: CamProfileSchema.optional(),
27703
+ /**
27704
+ * The CALLER's byte bound, so an over-size clip is refused before it is
27705
+ * read and encoded rather than after. Capped by
27706
+ * {@link VIDEOCLIPS_MAX_READ_BYTES} whatever is passed; absent means
27707
+ * that ceiling.
27708
+ */
27709
+ maxBytes: number().int().positive().optional(),
27710
+ /**
27711
+ * The operator's authorisation to wake a sleeping camera for this
27712
+ * read. Absent — the default — means a sleeping standalone battery
27713
+ * camera is REFUSED by name, before any session is opened.
27714
+ */
27715
+ wake: ClipWakeSchema.optional()
27716
+ }), ClipBytesSchema, {
27717
+ kind: "query",
27718
+ auth: "protected"
27574
27719
  })
27575
27720
  }
27576
27721
  };
@@ -33864,13 +34009,101 @@ var ExportStateSchema = _enum([
33864
34009
  "expired",
33865
34010
  "deleted"
33866
34011
  ]);
33867
- /** One export job / history row. */
34012
+ /**
34013
+ * WHAT an export is — the authority, as opposed to the four top-level fields
34014
+ * the Library sorts and labels on (D558 § 2.2).
34015
+ *
34016
+ * Read it through {@link exportSubjectOf}, never off the record directly: the
34017
+ * field is optional for the history rows written before it existed, and that
34018
+ * absence has exactly one interpreter.
34019
+ */
34020
+ var ExportSubjectSchema = discriminatedUnion("kind", [object({
34021
+ kind: literal("footage"),
34022
+ deviceId: number(),
34023
+ profiles: array(string()).min(1),
34024
+ fromMs: number(),
34025
+ toMs: number()
34026
+ }), object({
34027
+ kind: literal("clip"),
34028
+ deviceId: number(),
34029
+ provider: string().min(1),
34030
+ source: string().min(1),
34031
+ sourceLabel: string().min(1),
34032
+ clipId: string().min(1),
34033
+ /**
34034
+ * WHERE IN THE CATALOG to confirm this clip — the day window the surface was
34035
+ * already listing when the operator picked the segment.
34036
+ *
34037
+ * It is **not** a time range control and it never becomes one: the record's
34038
+ * `fromMs`/`toMs` come from the catalog ROW and from nothing a caller
34039
+ * supplied (D558 § 5.4.3), and a window that does not contain the clip is a
34040
+ * `catalog-miss`, not a silently wider search. It exists because
34041
+ * `videoclips.listClips` takes `since`/`until` and has no by-handle twin:
34042
+ * the catalog check D558 asks for is literally that call, and a call needs a
34043
+ * window. The surface has one — `ClipsBrowser`'s `dayWindow`, one local
34044
+ * wall-clock day, which is also the only width measured to be cheap (one
34045
+ * day on 592 lists 171 clips in 712 ms, a busy day 546 in 2.0 s; twenty days
34046
+ * of one child's events took 3.6–5.4 s).
34047
+ */
34048
+ catalogWindow: object({
34049
+ sinceMs: number(),
34050
+ untilMs: number()
34051
+ }),
34052
+ profile: _enum([
34053
+ "high",
34054
+ "mid",
34055
+ "low"
34056
+ ]),
34057
+ /**
34058
+ * The operator's authorisation to wake a sleeping camera for this export.
34059
+ * ONE definition, in the cap that owns the clip read ({@link ClipWakeSchema}),
34060
+ * because the gate that honours it is the clip provider's sleep gate — a
34061
+ * second enum here would be a second contract. Absent by default; never
34062
+ * settable by a scheduler or a retry.
34063
+ *
34064
+ * **One authorised yes is ONE wake.** A failed clip export is retried only by
34065
+ * an operator act that asks again; a queued job that outlived its wake fails
34066
+ * with a reason rather than waking on its turn; and this subject carries
34067
+ * exactly one profile precisely so one tap is never two fetches (D558 § 5.2).
34068
+ */
34069
+ wake: ClipWakeSchema.optional()
34070
+ })]);
34071
+ /**
34072
+ * One export job / history row.
34073
+ *
34074
+ * **`subject` is the AUTHORITY on what was exported. `deviceId`, `profile`,
34075
+ * `fromMs` and `toMs` are its PROJECTION** — kept top-level because the whole
34076
+ * Library sorts and labels on them (`library-items.ts` orders an export by
34077
+ * `fromMs`; `export-format.ts` draws `rangeLabel` from the pair), and a row
34078
+ * that did not fill them would sort under the epoch and render a blank range.
34079
+ * Write to the subject and read from the projection and the two will disagree;
34080
+ * the projection is derived at creation and never edited afterwards.
34081
+ *
34082
+ * And they mean DIFFERENT FACTS for the two kinds, which is the part a reader
34083
+ * who knows only the recording export will get wrong:
34084
+ *
34085
+ * | field | `kind:'footage'` | `kind:'clip'` |
34086
+ * | --- | --- | --- |
34087
+ * | `fromMs`/`toMs` | the stretch the operator ASKED for | the camera's own boundaries, always `clip.timeRange`, never anything a caller supplied |
34088
+ * | `profile` | the stream rendered | the twin actually SERVED (`subject.profile` is the one asked for) |
34089
+ *
34090
+ * Same type, different fact — the shape this repo keeps getting wrong (D385's
34091
+ * two authorities, D224's second copy).
34092
+ */
33868
34093
  var ExportRecordSchema = object({
33869
34094
  id: string(),
33870
34095
  deviceId: number(),
33871
34096
  profile: string(),
33872
34097
  fromMs: number(),
33873
34098
  toMs: number(),
34099
+ /**
34100
+ * What this export IS. Optional ONLY for the rows written before D558: the
34101
+ * store parses every row through this schema on every read, so a required
34102
+ * field would make the export AUDIT — which is the whole reason rows survive
34103
+ * file deletion — unreadable in one release. Absence means `footage`, and
34104
+ * {@link exportSubjectOf} is the one place that says so.
34105
+ */
34106
+ subject: ExportSubjectSchema.optional(),
33874
34107
  options: ExportOptionsSchema,
33875
34108
  state: ExportStateSchema,
33876
34109
  /** 0–100 while rendering; null otherwise. */
@@ -33887,6 +34120,49 @@ var ExportRecordSchema = object({
33887
34120
  /** Failure reason when state is 'failed'; null otherwise. */
33888
34121
  error: string().nullable()
33889
34122
  });
34123
+ /**
34124
+ * Every way a clip export can fail, as a TOKEN — never prose.
34125
+ *
34126
+ * A branch that accepts work and produces nothing is the branch this repo
34127
+ * keeps losing work in (D391), and a clip export has five places to lose it
34128
+ * that a recording export does not have. The token is what a surface may key
34129
+ * a table on; the PROSE — the camera's own words, the source's verbatim
34130
+ * refusal — travels with it, in the same `ExportRecord.error` string, after a
34131
+ * `: `. Two separate things in one field because the field is one field:
34132
+ * `ClipStillRefusalCodeSchema` split them across two HTTP headers for the same
34133
+ * reason, and the surface that keyed on the whole header rendered every
34134
+ * refusal on this fleet as `Refused: <prose>`.
34135
+ *
34136
+ * Compose with {@link clipExportFailure}, read back with
34137
+ * {@link clipExportFailureOf}. Never hand-spell the separator.
34138
+ */
34139
+ var ClipExportFailureSchema = _enum([
34140
+ "catalog-miss",
34141
+ "catalog-unreachable",
34142
+ "no-file-for-window",
34143
+ "clip-in-progress",
34144
+ "unsupported-option",
34145
+ "sleeping",
34146
+ "camera-refused",
34147
+ "fetch-failed",
34148
+ "too-large-to-transfer",
34149
+ "wake-expired"
34150
+ ]);
34151
+ /** `<token>: <prose>` — the ONE composition of a clip export's failure string. */
34152
+ function clipExportFailure(code, detail) {
34153
+ return detail.length > 0 ? `${code}: ${detail}` : code;
34154
+ }
34155
+ /**
34156
+ * The token out of an {@link ExportRecord.error}, or null when the string did
34157
+ * not come from {@link clipExportFailure} (every footage failure, and every
34158
+ * error thrown by something that never heard of this vocabulary).
34159
+ */
34160
+ function clipExportFailureOf(error) {
34161
+ if (error === null) return null;
34162
+ const head = error.split(":", 1)[0] ?? "";
34163
+ const parsed = ClipExportFailureSchema.safeParse(head.trim());
34164
+ return parsed.success ? parsed.data : null;
34165
+ }
33890
34166
  /** Candidate download URLs (LAN first, then operator extra hosts). */
33891
34167
  var ExportDownloadSchema = object({
33892
34168
  url: string(),
@@ -33924,29 +34200,150 @@ var ExportBytesSchema = object({
33924
34200
  name: string(),
33925
34201
  bytes: number().int().nonnegative()
33926
34202
  });
34203
+ /** Canonical `profiles[]`, falling back to the legacy singular `profile`. */
34204
+ function resolveExportProfiles(input) {
34205
+ if (input.profiles !== void 0 && input.profiles.length > 0) return [...input.profiles];
34206
+ if (typeof input.profile === "string" && input.profile.length > 0) return [input.profile];
34207
+ return [];
34208
+ }
34209
+ /**
34210
+ * `createExport` input — ONE object carrying an optional {@link ExportSubject},
34211
+ * never a union of two inputs.
34212
+ *
34213
+ * It has to be a ZodObject: generated routers call `.input.loose()` so the
34214
+ * out-of-band `nodeId` selector survives the wire parse, and `.loose()` is a
34215
+ * ZodObject method a `z.discriminatedUnion` does not have. That is why the
34216
+ * discriminant sits one level down, in `subject`, and why
34217
+ * {@link resolveCreateExportSubject} — not a `z.preprocess` wrapper, which
34218
+ * would have produced a schema with no `.loose()` — is the one reading of a
34219
+ * legacy flat input as a subject.
34220
+ *
34221
+ * **`deviceId` stays REQUIRED at the top level**, for both kinds, and a clip
34222
+ * subject naming a different one is REFUSED. Not symmetry: `METHOD_DEVICE_SELECTORS`
34223
+ * (generated) maps top-level fields and one-level object arrays, so per-device
34224
+ * scope enforcement in `scope-access.ts` reads THIS field and cannot see
34225
+ * `subject.deviceId`. A deviceId that lived only in the subject would let a
34226
+ * principal scoped to one camera create an export — and, on the clip path, a
34227
+ * WAKE — for another.
34228
+ *
34229
+ * **A clip carries no time range**, and one supplied alongside a clip subject
34230
+ * is refused rather than ignored: there is no drag on this path and nothing to
34231
+ * normalise (D558 § 5.4.3). The record's `fromMs`/`toMs` come from the clip's
34232
+ * own `timeRange` and from nowhere else.
34233
+ */
34234
+ var CreateExportInputSchema = object({
34235
+ deviceId: number(),
34236
+ /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
34237
+ profile: string().optional(),
34238
+ profiles: array(string()).min(1).optional(),
34239
+ /** Footage only — a clip's boundaries are the camera's. */
34240
+ fromMs: number().optional(),
34241
+ toMs: number().optional(),
34242
+ /** What to export. Absent means the legacy flat footage request. */
34243
+ subject: ExportSubjectSchema.optional(),
34244
+ options: ExportOptionsSchema
34245
+ }).superRefine((v, ctx) => {
34246
+ if (v.subject?.kind === "clip") {
34247
+ if (v.subject.deviceId !== v.deviceId) ctx.addIssue({
34248
+ code: ZodIssueCode.custom,
34249
+ message: `subject.deviceId (${v.subject.deviceId}) must equal deviceId (${v.deviceId}) — the top-level field is what per-device scope enforcement reads`,
34250
+ path: ["subject", "deviceId"]
34251
+ });
34252
+ if (v.fromMs !== void 0 || v.toMs !== void 0) ctx.addIssue({
34253
+ code: ZodIssueCode.custom,
34254
+ message: "a clip export asks for no time range: the camera chose the boundaries and they are read from the catalog row",
34255
+ path: ["fromMs"]
34256
+ });
34257
+ return;
34258
+ }
34259
+ if (v.subject?.kind === "footage" && v.subject.deviceId !== v.deviceId) ctx.addIssue({
34260
+ code: ZodIssueCode.custom,
34261
+ message: `subject.deviceId (${v.subject.deviceId}) must equal deviceId (${v.deviceId})`,
34262
+ path: ["subject", "deviceId"]
34263
+ });
34264
+ const fromMs = v.subject?.kind === "footage" ? v.subject.fromMs : v.fromMs;
34265
+ const toMs = v.subject?.kind === "footage" ? v.subject.toMs : v.toMs;
34266
+ if (typeof fromMs !== "number" || typeof toMs !== "number") ctx.addIssue({
34267
+ code: ZodIssueCode.custom,
34268
+ message: "a footage export needs fromMs and toMs",
34269
+ path: ["fromMs"]
34270
+ });
34271
+ if ((v.subject?.kind === "footage" ? [...v.subject.profiles] : resolveExportProfiles(v)).length < 1) ctx.addIssue({
34272
+ code: ZodIssueCode.custom,
34273
+ message: "pass profiles[] (min 1) or legacy profile",
34274
+ path: ["profiles"]
34275
+ });
34276
+ });
34277
+ /**
34278
+ * The ONE reading of a `createExport` input as a {@link ExportSubject}.
34279
+ *
34280
+ * Every consumer goes through this: a provider that branched on
34281
+ * `input.subject !== undefined` in one place and on `input.fromMs` in another
34282
+ * would be two authorities on what was asked for, which is how the flat fields
34283
+ * and the subject drift apart.
34284
+ *
34285
+ * Throws on a footage input with no range — an input that parsed cannot reach
34286
+ * that, and a caller that skipped the parse gets a named refusal rather than
34287
+ * `NaN` boundaries on a durable row.
34288
+ */
34289
+ function resolveCreateExportSubject(input) {
34290
+ if (input.subject !== void 0) return input.subject;
34291
+ const profiles = resolveExportProfiles(input);
34292
+ if (typeof input.fromMs !== "number" || typeof input.toMs !== "number") throw new Error("recording-export: a footage export needs fromMs and toMs");
34293
+ return {
34294
+ kind: "footage",
34295
+ deviceId: input.deviceId,
34296
+ profiles,
34297
+ fromMs: input.fromMs,
34298
+ toMs: input.toMs
34299
+ };
34300
+ }
34301
+ /**
34302
+ * The ONE interpreter of a stored row's subject.
34303
+ *
34304
+ * `ExportRecord.subject` is optional for exactly one reason — the history rows
34305
+ * written before D558 — and "absent means footage, built from the projection"
34306
+ * is a statement that must live in one place. Anything that reads
34307
+ * `rec.subject` directly and falls back inline is the second authority.
34308
+ */
34309
+ function exportSubjectOf(rec) {
34310
+ if (rec.subject !== void 0) return rec.subject;
34311
+ return {
34312
+ kind: "footage",
34313
+ deviceId: rec.deviceId,
34314
+ profiles: [rec.profile],
34315
+ fromMs: rec.fromMs,
34316
+ toMs: rec.toMs
34317
+ };
34318
+ }
33927
34319
  var recordingExportCapability = {
33928
34320
  name: "recording-export",
33929
34321
  scope: "system",
33930
34322
  mode: "singleton",
33931
34323
  methods: {
33932
- /** Queue a render of `[fromMs,toMs)` for `deviceId`/`profiles` (legacy
33933
- * singular `profile` still accepted). Fails fast when no footage covers
33934
- * the range. One job per profile; returns the first queued record. */
33935
- createExport: method(object({
33936
- deviceId: number(),
33937
- /** @deprecated Prefer `profiles`. Kept so timelapse/notifiers keep working. */
33938
- profile: string().optional(),
33939
- profiles: array(string()).min(1).optional(),
33940
- fromMs: number(),
33941
- toMs: number(),
33942
- options: ExportOptionsSchema
33943
- }).superRefine((v, ctx) => {
33944
- if ((v.profiles !== void 0 && v.profiles.length > 0 ? v.profiles : v.profile !== void 0 ? [v.profile] : []).length < 1) ctx.addIssue({
33945
- code: ZodIssueCode.custom,
33946
- message: "pass profiles[] (min 1) or legacy profile",
33947
- path: ["profiles"]
33948
- });
33949
- }), ExportRecordSchema, {
34324
+ /**
34325
+ * Queue an export of {@link ExportSubjectSchema}.
34326
+ *
34327
+ * `kind:'footage'` — a render of `[fromMs,toMs)` for `deviceId`/`profiles`
34328
+ * (legacy flat input, singular `profile` included, still accepted and
34329
+ * rewritten). Fails fast when no footage covers the range. One job per
34330
+ * profile; **returns the first queued record and the others are reachable
34331
+ * only through `listExports`** — a defect named in D558 § 6.3 and the
34332
+ * reason a clip subject carries exactly ONE profile.
34333
+ *
34334
+ * `kind:'clip'` — a finished file the camera holds, validated against the
34335
+ * device's clip CATALOG (`videoclips.listClips`, at the subject's
34336
+ * `provider`) instead of the recording index, and fetched once by handle
34337
+ * under a bound. Its `fromMs`/`toMs` come from the catalog row and from
34338
+ * nowhere else; a caller supplying a range is refused.
34339
+ *
34340
+ * A clip export reuses the six {@link ExportStateSchema} members and adds
34341
+ * none: the viewer maps an unknown state string to `failed`, so a seventh
34342
+ * member renders every live export — of both kinds — as FAILED on every
34343
+ * installed app (D558 § 6.1, pinned by `export-state-members.spec.ts`).
34344
+ * `subject.kind` is what tells a surface what `rendering` means.
34345
+ */
34346
+ createExport: method(CreateExportInputSchema, ExportRecordSchema, {
33950
34347
  kind: "mutation",
33951
34348
  auth: "protected"
33952
34349
  }),
@@ -42158,6 +42555,12 @@ Object.freeze({
42158
42555
  addonId: null,
42159
42556
  access: "view"
42160
42557
  },
42558
+ "videoclips.readClipBytes": {
42559
+ capName: "videoclips",
42560
+ capScope: "device",
42561
+ addonId: null,
42562
+ access: "view"
42563
+ },
42161
42564
  "viewerUi.getStaticDir": {
42162
42565
  capName: "viewer-ui",
42163
42566
  capScope: "system",
@@ -44176,6 +44579,11 @@ Object.freeze({
44176
44579
  form: "single",
44177
44580
  optional: false
44178
44581
  }],
44582
+ "videoclips.readClipBytes": [{
44583
+ name: "deviceId",
44584
+ form: "single",
44585
+ optional: false
44586
+ }],
44179
44587
  "waterHeater.setAway": [{
44180
44588
  name: "deviceId",
44181
44589
  form: "single",
@@ -45995,6 +46403,12 @@ Object.defineProperty(exports, "COCO_TO_MACRO", {
45995
46403
  return COCO_TO_MACRO;
45996
46404
  }
45997
46405
  });
46406
+ Object.defineProperty(exports, "CamProfileSchema", {
46407
+ enumerable: true,
46408
+ get: function() {
46409
+ return CamProfileSchema;
46410
+ }
46411
+ });
45998
46412
  Object.defineProperty(exports, "DEFAULT_AUDIO_ANALYZER_CONFIG", {
45999
46413
  enumerable: true,
46000
46414
  get: function() {
@@ -46253,6 +46667,18 @@ Object.defineProperty(exports, "cameraStreamsCapability", {
46253
46667
  return cameraStreamsCapability;
46254
46668
  }
46255
46669
  });
46670
+ Object.defineProperty(exports, "clipExportFailure", {
46671
+ enumerable: true,
46672
+ get: function() {
46673
+ return clipExportFailure;
46674
+ }
46675
+ });
46676
+ Object.defineProperty(exports, "clipExportFailureOf", {
46677
+ enumerable: true,
46678
+ get: function() {
46679
+ return clipExportFailureOf;
46680
+ }
46681
+ });
46256
46682
  Object.defineProperty(exports, "createEvent", {
46257
46683
  enumerable: true,
46258
46684
  get: function() {
@@ -46379,6 +46805,12 @@ Object.defineProperty(exports, "expandAudioChunkToF32le", {
46379
46805
  return expandAudioChunkToF32le;
46380
46806
  }
46381
46807
  });
46808
+ Object.defineProperty(exports, "exportSubjectOf", {
46809
+ enumerable: true,
46810
+ get: function() {
46811
+ return exportSubjectOf;
46812
+ }
46813
+ });
46382
46814
  Object.defineProperty(exports, "failureContributionCapability", {
46383
46815
  enumerable: true,
46384
46816
  get: function() {
@@ -46631,6 +47063,12 @@ Object.defineProperty(exports, "resolveClusterStepModelId", {
46631
47063
  return resolveClusterStepModelId;
46632
47064
  }
46633
47065
  });
47066
+ Object.defineProperty(exports, "resolveCreateExportSubject", {
47067
+ enumerable: true,
47068
+ get: function() {
47069
+ return resolveCreateExportSubject;
47070
+ }
47071
+ });
46634
47072
  Object.defineProperty(exports, "resolveEgressDecodeHwAccel", {
46635
47073
  enumerable: true,
46636
47074
  get: function() {
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-k6Vu-AhZ.js");
5
+ const require_dist = require("../dist-NYjn7hkE.js");
6
6
  const require_lazy_sharp = require("../lazy-sharp-BuwKlQLR.js");
7
7
  let node_fs = require("node:fs");
8
8
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { $ as evaluateZoneRules, Jt as BaseAddon, Zt as DeviceType, ht as motionDetectionCapability, rn as hydrateSchema } from "../dist-g5MfpiBh.mjs";
1
+ import { Qt as BaseAddon, cn as hydrateSchema, nn as DeviceType, tt as evaluateZoneRules, vt as motionDetectionCapability } from "../dist-C1pCVJk7.mjs";
2
2
  import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { join } from "node:path";
@@ -1,4 +1,4 @@
1
- import { Kt as isSoftwareDecode, Ut as Fmp4BoxSplitter, Vt as errMsg, Wt as buildFfmpegArgs } from "./dist-g5MfpiBh.mjs";
1
+ import { Gt as errMsg, Jt as buildFfmpegArgs, Xt as isSoftwareDecode, qt as Fmp4BoxSplitter } from "./dist-C1pCVJk7.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { realpathSync } from "node:fs";
4
4
  import path from "node:path";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_dist = require("./dist-k6Vu-AhZ.js");
2
+ const require_dist = require("./dist-NYjn7hkE.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  let node_fs = require("node:fs");
5
5
  node_fs = require_chunk.__toESM(node_fs, 1);
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../chunk-emK7D4bc.js");
6
- const require_dist = require("../dist-k6Vu-AhZ.js");
7
- const require_node = require("../node--u_jUObS.js");
8
- const require_default_detection_model = require("../default-detection-model-CAWhHQo2.js");
6
+ const require_dist = require("../dist-NYjn7hkE.js");
7
+ const require_node = require("../node-CVYY8a4y.js");
8
+ const require_default_detection_model = require("../default-detection-model-6lCvep7n.js");
9
9
  const require_worker_protocol = require("../worker-protocol-B2MfQLlu.js");
10
10
  const require_hub_hostname = require("../hub-hostname-DAJXlOgV.js");
11
11
  const require_lazy_sharp = require("../lazy-sharp-BuwKlQLR.js");
@@ -1,6 +1,6 @@
1
- import { $t as createEvent, C as NativeLeaseAdmissionSchema, Ct as pipelineRunnerCapability, Jt as BaseAddon, K as deriveDetailCropRect, S as MOTION_CLOSE_AFTER_MS, Sn as string, Vt as errMsg, _n as literal, bt as pickDetailCropConvention, en as customAction, fn as _enum, gn as lazy, m as DEVICE_BACKEND_TO_FORMAT, mn as boolean, nt as failureContributionCapability, p as DEFAULT_NATIVE_LEASE_SETTINGS, pn as array, sn as nodePin, st as loadContributionCapability, tn as defineCustomActions, u as DEFAULT_DETAIL_CROP_CONVENTION, vn as number, w as NativeLeaseSettingsSchema, wn as EventCategory, xt as pickNativeLeaseOverride, y as FailureCounters, yn as object } from "../dist-g5MfpiBh.mjs";
2
- import { i as NO_COST_CLAIM, t as ChildCostRegistry } from "../node-BXsHQH5h.mjs";
3
- import { a as localFrameRegistry, d as getStepDefinition, i as rootObjectGate, o as resolveFrameViewGeometry, r as macroGateVerdict } from "../default-detection-model-BXwE-Dvo.mjs";
1
+ import { C as NativeLeaseAdmissionSchema, Cn as number, Ct as pickDetailCropConvention, Dn as string, Et as pipelineRunnerCapability, Gt as errMsg, J as deriveDetailCropRect, Qt as BaseAddon, S as MOTION_CLOSE_AFTER_MS, Sn as literal, _n as _enum, an as customAction, at as failureContributionCapability, fn as nodePin, in as createEvent, kn as EventCategory, m as DEVICE_BACKEND_TO_FORMAT, on as defineCustomActions, p as DEFAULT_NATIVE_LEASE_SETTINGS, u as DEFAULT_DETAIL_CROP_CONVENTION, ut as loadContributionCapability, vn as array, w as NativeLeaseSettingsSchema, wn as object, wt as pickNativeLeaseOverride, xn as lazy, y as FailureCounters, yn as boolean } from "../dist-C1pCVJk7.mjs";
2
+ import { i as NO_COST_CLAIM, t as ChildCostRegistry } from "../node--UY0iepi.mjs";
3
+ import { a as localFrameRegistry, d as getStepDefinition, i as rootObjectGate, o as resolveFrameViewGeometry, r as macroGateVerdict } from "../default-detection-model-dQSwHHfx.mjs";
4
4
  import { t as isWorkerReply } from "../worker-protocol-C_W-P_g-.mjs";
5
5
  import { t as resolveHubHostname } from "../hub-hostname-cCknRYKj.mjs";
6
6
  import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";