@camstack/types 1.2.243 → 1.2.245

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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-mVRRyKVq.js");
2
+ const require_sleep = require("./sleep-Da9UCU5_.js");
3
3
  const require_event_category = require("./event-category-BVfsrBYA.js");
4
4
  const require_canonical_hash = require("./canonical-hash-CSE4ioRi.js");
5
5
  const require_enums = require("./enums.js");
@@ -11553,6 +11553,248 @@ var deviceAdoptionCapability = {
11553
11553
  }
11554
11554
  };
11555
11555
  //#endregion
11556
+ //#region src/capabilities/device-admin-link.cap.ts
11557
+ /**
11558
+ * device-admin-link — "this device has a management page of its own, and here
11559
+ * is its address".
11560
+ *
11561
+ * ## Why this is not a `deviceConfig` cap
11562
+ *
11563
+ * There is nothing to edit. A `deviceConfig` cap (D14) exists so the framework
11564
+ * can DERIVE a settings form from `getOptions` + `getStatus` and route a flat
11565
+ * patch back through a setter; it costs a `builderId` reducer in
11566
+ * `device-config-contribution.ts` and a `*-config-schema.ts` beside it, and it
11567
+ * renders a form section. This cap answers ONE question with ONE read and
11568
+ * renders a button. Nothing about it is a form, so it carries no `deviceConfig`
11569
+ * block, no `settings`, no `runtimeState` and no reducer — exactly like
11570
+ * `reboot`, the other pure-RPC device-native cap.
11571
+ *
11572
+ * ## Absent, and the difference between "no page" and "we cannot say"
11573
+ *
11574
+ * The two are answered at DIFFERENT layers, on purpose:
11575
+ *
11576
+ * - **"We cannot say"** → the provider never registers the cap for that
11577
+ * device. A VeSync humidifier, a Petkit feeder, a Dreame vacuum and a Dreo
11578
+ * fan are reached only through a vendor cloud; there is no address to hand
11579
+ * out and no page to open. A Tuya plug, a Wyze camera and a Gree air
11580
+ * conditioner DO have a LAN IP, and still have no HTTP management page
11581
+ * behind it. None of them register, so `deviceManager.getBindings` never
11582
+ * lists the cap and no surface asks.
11583
+ * - **"This device has no page, and I know that"** → the provider registers
11584
+ * and `getAdminLink` returns `null`. This is the answer for a device whose
11585
+ * sibling DOES have a page: a Reolink battery camera reached over UDP by
11586
+ * `uid` with a blank `host`, an Ecowitt gateway configured in `listener`
11587
+ * transport, a Home Assistant broker authenticated by supervisor token
11588
+ * (which carries no `baseUrl` at all).
11589
+ *
11590
+ * Both draw NOTHING. A button that opens a browser error is worse than no
11591
+ * button, and D62 is the same rule from the other side: an off switch is
11592
+ * reported off, never made to look broken. There is no third state where the
11593
+ * UI renders a disabled button "because the device might have a page".
11594
+ *
11595
+ * ## The URL never carries credentials
11596
+ *
11597
+ * Not in userinfo, not in a query string. Every provider builds through
11598
+ * `buildDeviceAdminUrl` (`device-admin-link-url.ts`), which takes host, port,
11599
+ * scheme and path as separate arguments — there is no parameter a secret could
11600
+ * arrive in — and re-checks its own output for the `scheme://user:pass@` shape
11601
+ * that `scripts/check-no-credential-urls-in-fixtures.ts` bans from recorded
11602
+ * output. `scripts/check-admin-link-builder-is-the-only-url-source.ts` is what
11603
+ * keeps providers from hand-rolling one anyway.
11604
+ *
11605
+ * This matters here more than anywhere else in the repo, because every provider
11606
+ * that knows a device's host knows its PASSWORD too: `{ host, port, username,
11607
+ * password }` sit in one object on Hikvision, Amcrest, Reolink and ONVIF alike,
11608
+ * and `http://admin:hunter2@192.168.50.139/` is a URL a browser accepts. The
11609
+ * camera's own page will ask for its own login. That is correct, and pre-
11610
+ * filling it is the operator's business, not ours.
11611
+ *
11612
+ * ## It is a LAN fact
11613
+ *
11614
+ * The URL addresses the device where the NODE can see it. It is not proxied,
11615
+ * not made reachable from outside, and not sent anywhere. A surface renders it
11616
+ * as a link the operator's own browser follows, on the operator's own network,
11617
+ * or renders nothing.
11618
+ */
11619
+ /**
11620
+ * Whose page is it. The distinction is for the OPERATOR, who needs to know
11621
+ * before clicking whether he is about to land on a camera's own web server or
11622
+ * inside Home Assistant.
11623
+ */
11624
+ var AdminLinkTargetEnum = zod.z.enum(["device", "integration"]);
11625
+ var DeviceAdminLinkSchema = zod.z.object({
11626
+ /**
11627
+ * Absolute `http(s)://` URL. Built by `buildDeviceAdminUrl` and therefore
11628
+ * free of userinfo and of any credential-shaped query key.
11629
+ */
11630
+ url: zod.z.string(),
11631
+ /**
11632
+ * What the surface calls it — "Web UI", "Home Assistant", "UniFi controller".
11633
+ * The PROVIDER names it, because only the provider knows what the page is;
11634
+ * a UI that invented the label from the addon id would call the Home
11635
+ * Assistant device page "Provider Homeassistant".
11636
+ */
11637
+ label: zod.z.string(),
11638
+ target: AdminLinkTargetEnum,
11639
+ /**
11640
+ * Host the URL points at, without scheme, port or path — for the tooltip, so
11641
+ * an operator can see WHERE the button goes before he follows it. Redundant
11642
+ * with `url` by construction; carried separately so no surface has to parse
11643
+ * a URL to show it.
11644
+ */
11645
+ host: zod.z.string()
11646
+ });
11647
+ var deviceAdminLinkCapability = {
11648
+ name: "device-admin-link",
11649
+ scope: "device",
11650
+ deviceNative: true,
11651
+ mode: "singleton",
11652
+ methods: {
11653
+ /**
11654
+ * The device's management page, or `null` when this device has none.
11655
+ *
11656
+ * `auth: 'admin'` deliberately. This is administration, not actuation —
11657
+ * the same bucket as `reboot` and `camera-credentials`, and explicitly NOT
11658
+ * the actuation set `scripts/check-actuation-not-admin.ts` protects (D403).
11659
+ * The URL is also a statement about the LAN, which a household member with
11660
+ * a `view` grant on a light has no reason to be handed.
11661
+ *
11662
+ * The surfaces gate on the QUERY, never on a role they guessed: a caller
11663
+ * without the right loses the query and draws nothing, which is the same
11664
+ * thing a device with no page draws. There is no path on which a button
11665
+ * appears and then fails — the D403 failure mode, from the other end.
11666
+ */
11667
+ getAdminLink: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" }) }
11668
+ };
11669
+ //#endregion
11670
+ //#region src/capabilities/device-admin-link-url.ts
11671
+ /**
11672
+ * Query keys that may never appear on an admin link. A credential smuggled as
11673
+ * `?password=` is the same leak as userinfo, in a form the userinfo check
11674
+ * cannot see: it survives copy-paste, referrer headers and proxy logs
11675
+ * identically.
11676
+ */
11677
+ var CREDENTIAL_QUERY_KEYS = [
11678
+ "password",
11679
+ "passwd",
11680
+ "pwd",
11681
+ "pass",
11682
+ "user",
11683
+ "username",
11684
+ "usr",
11685
+ "login",
11686
+ "token",
11687
+ "access_token",
11688
+ "auth",
11689
+ "authorization",
11690
+ "apikey",
11691
+ "api_key",
11692
+ "secret",
11693
+ "credential",
11694
+ "credentials",
11695
+ "session",
11696
+ "sessionid",
11697
+ "key"
11698
+ ];
11699
+ /**
11700
+ * The same userinfo shape `scripts/check-no-credential-urls-in-fixtures.ts`
11701
+ * scans recorded fixtures for, applied to what we are about to EMIT. Kept
11702
+ * structurally identical on purpose: a URL this function returns is a URL that
11703
+ * guard would pass.
11704
+ */
11705
+ var CREDENTIAL_URL = /[a-z][a-z0-9+.-]*:\/\/[^/\s:@'"]+:[^/\s:@'"]+@/i;
11706
+ /** A host that is safe to place in an authority component verbatim. */
11707
+ var PLAIN_HOST = /^[a-zA-Z0-9._-]+$/;
11708
+ /** A bracketed IPv6 literal, the only other authority form we emit. */
11709
+ var IPV6_HOST = /^\[[0-9a-fA-F:.]+\]$/;
11710
+ function defaultPortFor(scheme) {
11711
+ return scheme === "https" ? 443 : 80;
11712
+ }
11713
+ /**
11714
+ * Build the admin-page URL, or refuse by name.
11715
+ *
11716
+ * The refusal is never thrown: a provider answering "no page for this device"
11717
+ * is an ordinary answer (`getAdminLink` → `null`), and a throw here would turn
11718
+ * a missing host on one device into a failed query for the whole surface.
11719
+ */
11720
+ function buildDeviceAdminUrl(parts) {
11721
+ const host = parts.host.trim();
11722
+ if (host.length === 0) return {
11723
+ ok: false,
11724
+ reason: "empty-host"
11725
+ };
11726
+ if (host.includes("@")) return {
11727
+ ok: false,
11728
+ reason: "host-carries-userinfo"
11729
+ };
11730
+ if (!PLAIN_HOST.test(host) && !IPV6_HOST.test(host)) return {
11731
+ ok: false,
11732
+ reason: "host-not-plain"
11733
+ };
11734
+ if (parts.port !== null) {
11735
+ if (!Number.isInteger(parts.port) || parts.port < 1 || parts.port > 65535) return {
11736
+ ok: false,
11737
+ reason: "port-out-of-range"
11738
+ };
11739
+ }
11740
+ if (!parts.path.startsWith("/")) return {
11741
+ ok: false,
11742
+ reason: "path-not-absolute"
11743
+ };
11744
+ const query = parts.query ?? {};
11745
+ for (const key of Object.keys(query)) if (CREDENTIAL_QUERY_KEYS.includes(key.toLowerCase())) return {
11746
+ ok: false,
11747
+ reason: "credential-query-key"
11748
+ };
11749
+ const authority = parts.port === null || parts.port === defaultPortFor(parts.scheme) ? host : `${host}:${String(parts.port)}`;
11750
+ const search = new URLSearchParams();
11751
+ for (const [key, value] of Object.entries(query)) search.append(key, value);
11752
+ const suffix = search.size > 0 ? `?${search.toString()}` : "";
11753
+ const url = `${parts.scheme}://${authority}${parts.path}${suffix}`;
11754
+ if (CREDENTIAL_URL.test(url)) return {
11755
+ ok: false,
11756
+ reason: "userinfo-in-result"
11757
+ };
11758
+ return {
11759
+ ok: true,
11760
+ url
11761
+ };
11762
+ }
11763
+ function parseAdminBase(baseUrl) {
11764
+ const raw = baseUrl.trim();
11765
+ if (raw.length === 0) return {
11766
+ ok: false,
11767
+ reason: "empty"
11768
+ };
11769
+ let parsed;
11770
+ try {
11771
+ parsed = new URL(raw);
11772
+ } catch {
11773
+ return {
11774
+ ok: false,
11775
+ reason: "unparseable"
11776
+ };
11777
+ }
11778
+ if (parsed.username !== "" || parsed.password !== "") return {
11779
+ ok: false,
11780
+ reason: "base-carries-userinfo"
11781
+ };
11782
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return {
11783
+ ok: false,
11784
+ reason: "scheme-not-http"
11785
+ };
11786
+ const scheme = parsed.protocol === "https:" ? "https" : "http";
11787
+ const port = parsed.port === "" ? null : Number(parsed.port);
11788
+ const basePath = parsed.pathname === "/" ? "" : parsed.pathname.replace(/\/+$/, "");
11789
+ return {
11790
+ ok: true,
11791
+ host: parsed.hostname,
11792
+ port,
11793
+ scheme,
11794
+ basePath
11795
+ };
11796
+ }
11797
+ //#endregion
11556
11798
  //#region src/capabilities/device-export.cap.ts
11557
11799
  /**
11558
11800
  * `device-export` — collection cap for addons that export camstack
@@ -27260,6 +27502,41 @@ var ClipStillRefusalCodeSchema = zod.z.enum([
27260
27502
  var ClipStillDispositionSchema = zod.z.enum(["deferred", "final"]);
27261
27503
  /** The camera's / provider's own words. Kept verbatim, never parsed. */
27262
27504
  var CLIP_STILL_REASON_HEADER = "x-camstack-reason";
27505
+ /** Longest reason a header carries. Beyond this the sentence is cut. */
27506
+ var CLIP_REASON_HEADER_MAX = 500;
27507
+ /**
27508
+ * Make a refusal sentence safe to put in an HTTP header.
27509
+ *
27510
+ * **An HTTP header value is Latin-1.** Node throws `Invalid character in
27511
+ * header content` on anything above U+00FF, the handler dies mid-response,
27512
+ * and the client gets a socket hang up — no status, no reason, nothing. The
27513
+ * mechanism that exists to EXPLAIN a refusal is then the thing that silences
27514
+ * it, and the surface shows "nothing happened".
27515
+ *
27516
+ * That is not hypothetical: measured 2026-09-23 on 1436, a Hikvision replay
27517
+ * refusal read `SETUP of the video track answered 500 — the camera refused
27518
+ * this replay`, and the EM DASH in it threw on every clip the operator
27519
+ * opened. This repository writes its refusals in prose, and its prose uses
27520
+ * `—`, `’` and `…` everywhere, so every reason string is a candidate.
27521
+ *
27522
+ * Substitutes rather than strips: an operator reading a log or a response
27523
+ * should get a readable sentence, not one with holes in it. The typographic
27524
+ * characters this repo actually writes have exact ASCII equivalents; anything
27525
+ * else non-Latin-1 becomes `?`, which is visible rather than silent. Control
27526
+ * characters go too — a newline in a header value is a response-splitting
27527
+ * bug, not a formatting one.
27528
+ */
27529
+ function clipReasonHeaderValue(reason) {
27530
+ const folded = reason.replace(/[\u2013\u2014\u2212]/g, "-").replace(/[\u2018\u2019\u201b]/g, "'").replace(/[\u201c\u201d]/g, "\"").replace(/\u2026/g, "...").replace(/[\u00a0\u2007\u202f]/g, " ");
27531
+ let out = "";
27532
+ for (const ch of folded) {
27533
+ const code = ch.codePointAt(0) ?? 0;
27534
+ if (code < 32 || code === 127) out += " ";
27535
+ else if (code > 255) out += "?";
27536
+ else out += ch;
27537
+ }
27538
+ return out.slice(0, 500).trim();
27539
+ }
27263
27540
  /** One {@link ClipStillRefusalCodeSchema} token, alone. */
27264
27541
  var CLIP_STILL_REASON_CODE_HEADER = "x-camstack-reason-code";
27265
27542
  /** One {@link ClipStillDispositionSchema} token, alone. */
@@ -30623,6 +30900,632 @@ var dayNightCapability = {
30623
30900
  volatileStateFields: ["lastFetchedAt"]
30624
30901
  };
30625
30902
  //#endregion
30903
+ //#region src/capabilities/recording-onboard.cap.ts
30904
+ /**
30905
+ * Vendor-neutral **onboard** recording + storage cap — what the CAMERA
30906
+ * writes to the CAMERA's own card, on the camera's own schedule.
30907
+ *
30908
+ * This is NOT `recording.cap.ts`. That one is CamStack's recorder: our
30909
+ * footage ledger, our storage locations, our retention. This one has a
30910
+ * different authority — the camera's firmware — and per D62 it stores
30911
+ * nothing of its own. Every value here is read from the camera and every
30912
+ * write goes back to the camera; there is no CamStack-side mirror that
30913
+ * could disagree with the device.
30914
+ *
30915
+ * ## One shape, two firmwares
30916
+ *
30917
+ * Measured 2026-09-22 against the live fleet:
30918
+ *
30919
+ * | fact | Hikvision (ISAPI) | Reolink (Baichuan) |
30920
+ * | --- | --- | --- |
30921
+ * | storage | `ContentMgmt/Storage` `<hdd>` rows: status, capacity, freeSpace (MB) | `getHddInfoList` (cmd 102): `mount`, `format`, `capacity` GB + `capacityM` MB remainder |
30922
+ * | tracks | several (101 **and** 103 on both 1436 and 3833), each with its own schedule | one per channel |
30923
+ * | schedule | per track, 7 `ScheduleAction` blocks: DayOfWeek + TimeOfDay range + ONE `ActionRecordingMode` | per trigger type, a 168-char weekly HOUR mask |
30924
+ * | triggers | `CMR`, `MOTION` | `Normal`, `MD`, `people`, `vehicle`, `dog_cat`, `crossline`, `intrude`, `loitering` |
30925
+ * | pre-record | `PreRecordTimeSeconds` | `preRecordTime` |
30926
+ * | post-record | `PostRecordTimeSeconds` | `recordDelayTime` |
30927
+ * | overwrite | per track `LoopEnable` | `cycle`, with `cycleList` enumerating the accepted values |
30928
+ * | segment length | not exposed on V5.7.1 | `packageTime` (minutes) |
30929
+ *
30930
+ * The two schedule models look different and are the same thing in
30931
+ * different coordinates: both answer "for this trigger, during which
30932
+ * weekly windows does the camera record". {@link RecordWindow} is that
30933
+ * question in one shape — Hikvision's ranges map straight onto it,
30934
+ * Reolink's mask expands into hour-aligned windows.
30935
+ *
30936
+ * ## Union, not intersection
30937
+ *
30938
+ * **The same fields exist on every camera.** What differs per device is
30939
+ * which VALUES that device accepts, and that is what {@link
30940
+ * RecordingOnboardOptions} reports — a `{ readable, writable, reason }`
30941
+ * per field plus the schedule's own limits. A control a camera cannot
30942
+ * honour is rendered DISABLED WITH ITS REASON, never missing and never
30943
+ * dead: disabled must not look like broken.
30944
+ *
30945
+ * ## Refusal by name
30946
+ *
30947
+ * A write a camera cannot honour is refused with a sentence the operator
30948
+ * can read — never accepted and dropped. Both providers refuse through
30949
+ * {@link describeOnboardRefusal}, so the vocabulary is one function and
30950
+ * one test, not two hand-written vendor opinions.
30951
+ *
30952
+ * Follows the D14 `deviceConfig` archetype (see `stream-params.cap.ts`):
30953
+ * `getOptions` advertises per-camera availability, `getStatus` (auto-
30954
+ * injected from `status`) reports the live values, and a single
30955
+ * `setSettings` mutation applies a partial change. No hand-written
30956
+ * settings-contribution methods.
30957
+ */
30958
+ /**
30959
+ * What makes the camera start recording during a window.
30960
+ *
30961
+ * The union of both vendors' vocabularies. `continuous` is Hikvision's
30962
+ * `CMR` and Reolink's `Normal`; `motion` is `MOTION` / `MD`. The
30963
+ * object-class triggers are Reolink-only today and the smart-event ones
30964
+ * (`lineCrossing`, `intrusion`, `loitering`) are Reolink-only on the
30965
+ * firmwares measured — a camera that cannot record on a trigger simply
30966
+ * does not list it in `options.schedule.triggers`, and a window naming
30967
+ * it is REFUSED, not dropped.
30968
+ */
30969
+ var RecordTriggerSchema = zod.z.enum([
30970
+ "continuous",
30971
+ "motion",
30972
+ "person",
30973
+ "vehicle",
30974
+ "animal",
30975
+ "lineCrossing",
30976
+ "intrusion",
30977
+ "loitering",
30978
+ "alarmInput"
30979
+ ]);
30980
+ /**
30981
+ * One weekly recording window: "on `day`, from `startMinute` to
30982
+ * `endMinute`, record on `trigger`".
30983
+ *
30984
+ * `day` is 0 = Monday … 6 = Sunday (ISO order, which is also the order
30985
+ * both firmwares enumerate). Minutes are local camera time since
30986
+ * midnight; `endMinute` may be 1440, meaning end of day — that is
30987
+ * Hikvision's literal `24:00` and Reolink's 24th mask slot, and
30988
+ * collapsing it to 0 would turn a whole-day window into an empty one.
30989
+ */
30990
+ var RecordWindowSchema = zod.z.object({
30991
+ trigger: RecordTriggerSchema,
30992
+ day: zod.z.number().int().min(0).max(6),
30993
+ startMinute: zod.z.number().int().min(0).max(1439),
30994
+ endMinute: zod.z.number().int().min(1).max(1440)
30995
+ });
30996
+ /** Status of one physical volume, as the camera itself describes it. */
30997
+ var OnboardStorageVolumeSchema = zod.z.object({
30998
+ /** The camera's own id for the volume (`hdd/id`, Reolink `HddInfo/number`). */
30999
+ id: zod.z.string(),
31000
+ /** The camera's own name for it, when it gives one (`hddName`). */
31001
+ label: zod.z.string().optional(),
31002
+ status: zod.z.enum([
31003
+ "ok",
31004
+ "unformatted",
31005
+ "error",
31006
+ "offline",
31007
+ "unknown"
31008
+ ]),
31009
+ /**
31010
+ * Total size in MB, or **null when the camera did not say**.
31011
+ *
31012
+ * Never 0 for an unreadable value: a measurement that failed is not a
31013
+ * measurement (D393), and a card whose size is unknown must not be
31014
+ * rendered as a card of size zero.
31015
+ */
31016
+ capacityMb: zod.z.number().nullable(),
31017
+ /**
31018
+ * Free space in MB, or null when unknown.
31019
+ *
31020
+ * **Not a proxy for "has footage".** Measured 2026-09-22: 1436 and
31021
+ * 1439 both report exactly 11776 MB free — the fixed reserve a looping
31022
+ * card converges on once it has wrapped. At loop steady state the
31023
+ * number is identical whether the camera recorded yesterday or stopped
31024
+ * a month ago.
31025
+ */
31026
+ freeMb: zod.z.number().nullable(),
31027
+ /** True when the camera reports the volume writable (`property` RW). */
31028
+ writable: zod.z.boolean().optional()
31029
+ });
31030
+ /**
31031
+ * Whether the camera has usable onboard storage.
31032
+ *
31033
+ * Three states, never two: an unreadable answer is `unknown`, never
31034
+ * folded into `absent`. Folding a failed read into "no card" is how a
31035
+ * healthy camera gets reported as broken, and the inverse is how a
31036
+ * camera with no card reports `ok` and then an empty list (D393).
31037
+ */
31038
+ var OnboardStorageSchema = zod.z.discriminatedUnion("kind", [
31039
+ zod.z.object({
31040
+ kind: zod.z.literal("present"),
31041
+ volumes: zod.z.array(OnboardStorageVolumeSchema)
31042
+ }),
31043
+ zod.z.object({
31044
+ kind: zod.z.literal("absent"),
31045
+ reason: zod.z.string()
31046
+ }),
31047
+ zod.z.object({
31048
+ kind: zod.z.literal("unknown"),
31049
+ reason: zod.z.string()
31050
+ })
31051
+ ]);
31052
+ /**
31053
+ * One recording track the camera exposes. Read-only.
31054
+ *
31055
+ * Hikvision lists several — 1436 and 3833 each list 101 AND 103, with
31056
+ * DIFFERENT schedules (101 MOTION all day, 103 CMR 00:05–23:57) — so a
31057
+ * cap that reported one number for "the schedule" would be lying on
31058
+ * every Hikvision in the fleet. Reolink has exactly one per channel.
31059
+ *
31060
+ * There is deliberately **no `framerate`**. Hikvision declares it in the
31061
+ * track `Description` and it is WRONG: 1436 says `2.260000 fps` while
31062
+ * the media measures 12.55 fps. `codec` and `resolution` from the same
31063
+ * string ARE right — those are the only two worth surfacing.
31064
+ */
31065
+ var OnboardRecordTrackSchema = zod.z.object({
31066
+ id: zod.z.string(),
31067
+ enabled: zod.z.boolean(),
31068
+ isVideo: zod.z.boolean(),
31069
+ /** From the camera's own track description. Null when it does not say. */
31070
+ codec: zod.z.string().nullable(),
31071
+ resolution: zod.z.string().nullable(),
31072
+ /** Per-track overwrite flag, where the firmware keeps it per track. */
31073
+ overwriteWhenFull: zod.z.boolean().nullable()
31074
+ });
31075
+ /**
31076
+ * What the camera is doing with its own storage, right now.
31077
+ *
31078
+ * Every scalar is nullable and **null means the camera did not answer**,
31079
+ * never a default. A form that seeds `0` from an unanswered read invites
31080
+ * the operator to save that 0 back onto the camera.
31081
+ */
31082
+ var RecordingOnboardStatusSchema = zod.z.object({
31083
+ storage: OnboardStorageSchema,
31084
+ tracks: zod.z.array(OnboardRecordTrackSchema),
31085
+ /**
31086
+ * The track the write path targets — the enabled VIDEO one. Null when
31087
+ * no track could be identified, which is itself a refusal reason.
31088
+ */
31089
+ primaryTrackId: zod.z.string().nullable(),
31090
+ /** Master "record to the card at all" switch. */
31091
+ enabled: zod.z.boolean().nullable(),
31092
+ overwriteWhenFull: zod.z.boolean().nullable(),
31093
+ preRecordSec: zod.z.number().nullable(),
31094
+ postRecordSec: zod.z.number().nullable(),
31095
+ /** Length of one recorded file, in minutes. */
31096
+ segmentMinutes: zod.z.number().nullable(),
31097
+ /** The primary track's weekly windows, flattened. */
31098
+ windows: zod.z.array(RecordWindowSchema),
31099
+ /**
31100
+ * How many windows the camera described that CamStack could NOT read —
31101
+ * an unrecognised trigger, an unparseable clock, a weekday it does not
31102
+ * name.
31103
+ *
31104
+ * A dropped window is work the reader threw away, and a schedule that
31105
+ * silently shows fewer rows than the camera holds is how an operator
31106
+ * saves back a schedule shorter than the one they were looking at
31107
+ * (D391). Non-zero means the window list is INCOMPLETE and a write
31108
+ * that replaces it would delete what was not shown — which is why a
31109
+ * provider reporting a non-zero count also reports the schedule as not
31110
+ * writable.
31111
+ */
31112
+ unreadableWindows: zod.z.number(),
31113
+ /**
31114
+ * The camera is scheduled to record and has NO usable storage.
31115
+ *
31116
+ * A first-class fact because it is the fleet's most common silent
31117
+ * defect: measured 2026-09-22, 1441 and 3831 are both motion-recording
31118
+ * to a card that is not there. Neither the schedule nor the storage
31119
+ * read says anything wrong on its own; only the pair does.
31120
+ */
31121
+ recordingToNowhere: zod.z.boolean(),
31122
+ lastFetchedAt: zod.z.number()
31123
+ });
31124
+ /** Numeric range descriptor — `{ min, max, step }` per the getOptions convention. */
31125
+ var RangeSchema = zod.z.object({
31126
+ min: zod.z.number(),
31127
+ max: zod.z.number(),
31128
+ step: zod.z.number()
31129
+ });
31130
+ /**
31131
+ * The values a camera actually takes for a numeric field, when they are a SET
31132
+ * rather than a range.
31133
+ *
31134
+ * `{min,max,step}` cannot say what these two firmwares do. Measured on 1436
31135
+ * (I91DN) on 2026-09-22 by writing each value and reading it back:
31136
+ *
31137
+ * - pre-record: `0, 5, 10, 15, 20, 25, 30` and `2147483647` (INT32_MAX, the
31138
+ * camera's "no limit" — `-1` and `4294967295` both land on it);
31139
+ * - post-record: `5, 10, 30, 60, 120, 300, 600`.
31140
+ *
31141
+ * Neither is expressible as a step: the first has a sentinel two billion away
31142
+ * from its neighbours, the second doubles and then jumps. A range that tried
31143
+ * would forbid values the camera takes AND permit values it silently replaces
31144
+ * with 5 — wrong in both directions at once.
31145
+ *
31146
+ * `sentinel` names the member that is not a duration, so a surface can render
31147
+ * "no limit" instead of `2147483647` seconds.
31148
+ */
31149
+ var AllowedValuesSchema = zod.z.object({
31150
+ values: zod.z.array(zod.z.number()).min(1),
31151
+ sentinel: zod.z.object({
31152
+ value: zod.z.number(),
31153
+ meaning: zod.z.enum(["no-limit", "disabled"])
31154
+ }).optional()
31155
+ });
31156
+ /**
31157
+ * Per-field availability on ONE camera.
31158
+ *
31159
+ * The field exists on every camera — this says whether this one can be
31160
+ * read and whether it can be written, and `reason` says why not when
31161
+ * either is false. The UI renders the control DISABLED with the reason
31162
+ * rather than hiding it, so a limitation is legible instead of looking
31163
+ * like a missing feature.
31164
+ */
31165
+ var OnboardFieldSupportSchema = zod.z.object({
31166
+ readable: zod.z.boolean(),
31167
+ writable: zod.z.boolean(),
31168
+ /** Required whenever `readable` or `writable` is false. */
31169
+ reason: zod.z.string().optional()
31170
+ });
31171
+ /** What this camera's schedule model can express. */
31172
+ var OnboardScheduleSupportSchema = zod.z.object({
31173
+ support: OnboardFieldSupportSchema,
31174
+ /**
31175
+ * The smallest time step the camera can express, in minutes.
31176
+ *
31177
+ * Hikvision takes arbitrary minutes (`00:05:00`–`23:57:00` observed on
31178
+ * 1436's track 103). Reolink's schedule is a 7×24 HOUR mask, so 60. A
31179
+ * window whose edges are not a multiple of this is REFUSED rather than
31180
+ * quietly rounded — rounding is how an operator's 06:30 becomes 06:00
31181
+ * and nothing says so.
31182
+ */
31183
+ granularityMinutes: zod.z.number(),
31184
+ /** Triggers this camera can record on. A window naming another is refused. */
31185
+ triggers: zod.z.array(RecordTriggerSchema),
31186
+ /**
31187
+ * False when the camera stores ONE trigger per time range, so two
31188
+ * windows overlapping on the same day cannot carry different triggers.
31189
+ * True on Reolink, whose mask is per-trigger and independent.
31190
+ */
31191
+ supportsOverlappingTriggers: zod.z.boolean()
31192
+ });
31193
+ var RecordingOnboardOptionsSchema = zod.z.object({
31194
+ enabled: OnboardFieldSupportSchema,
31195
+ overwriteWhenFull: OnboardFieldSupportSchema,
31196
+ preRecordSec: OnboardFieldSupportSchema,
31197
+ preRecordSecRange: RangeSchema.optional(),
31198
+ /** Preferred over the range when the camera takes a SET, not a span. */
31199
+ preRecordSecAllowed: AllowedValuesSchema.optional(),
31200
+ postRecordSec: OnboardFieldSupportSchema,
31201
+ postRecordSecRange: RangeSchema.optional(),
31202
+ /** Preferred over the range when the camera takes a SET, not a span. */
31203
+ postRecordSecAllowed: AllowedValuesSchema.optional(),
31204
+ segmentMinutes: OnboardFieldSupportSchema,
31205
+ segmentMinutesRange: RangeSchema.optional(),
31206
+ /** Preferred over the range when the camera takes a SET, not a span. */
31207
+ segmentMinutesAllowed: AllowedValuesSchema.optional(),
31208
+ schedule: OnboardScheduleSupportSchema
31209
+ });
31210
+ /**
31211
+ * A partial change. Every field optional.
31212
+ *
31213
+ * Unlike the other `deviceConfig` caps, a provider here does **NOT**
31214
+ * silently ignore a field it cannot support — it refuses, by name,
31215
+ * through {@link describeOnboardRefusal}. Silence on a recording setting
31216
+ * is the failure D62 exists to prevent: the operator believes the camera
31217
+ * is recording the way the form says, and it is not.
31218
+ */
31219
+ var RecordingOnboardPatchSchema = zod.z.object({
31220
+ enabled: zod.z.boolean().optional(),
31221
+ overwriteWhenFull: zod.z.boolean().optional(),
31222
+ preRecordSec: zod.z.number().optional(),
31223
+ postRecordSec: zod.z.number().optional(),
31224
+ segmentMinutes: zod.z.number().optional(),
31225
+ /** The complete new window set for the primary track — not a delta. */
31226
+ windows: zod.z.array(RecordWindowSchema).optional()
31227
+ });
31228
+ var recordingOnboardCapability = {
31229
+ name: "recording-onboard",
31230
+ scope: "device",
31231
+ deviceNative: true,
31232
+ mode: "singleton",
31233
+ deviceTypes: [require_sleep.DeviceType.Camera],
31234
+ deviceConfig: { ui: {
31235
+ kind: "derived-form",
31236
+ builderId: "recording-onboard",
31237
+ tab: "recording"
31238
+ } },
31239
+ methods: {
31240
+ getOptions: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), RecordingOnboardOptionsSchema),
31241
+ setSettings: require_sleep.method(zod.z.object({
31242
+ deviceId: zod.z.number(),
31243
+ settings: RecordingOnboardPatchSchema
31244
+ }), zod.z.void(), {
31245
+ kind: "mutation",
31246
+ auth: "admin"
31247
+ })
31248
+ },
31249
+ status: {
31250
+ schema: RecordingOnboardStatusSchema,
31251
+ kind: "poll"
31252
+ },
31253
+ runtimeState: RecordingOnboardStatusSchema,
31254
+ /**
31255
+ * Runtime-state durability: **restored** — operator-set camera-side
31256
+ * recording config; mutation-driven, and the storage half is the last
31257
+ * thing the camera said about its own card.
31258
+ *
31259
+ * See `RuntimeStateDurability`. Enforced by
31260
+ * `scripts/check-runtime-state-durability.ts`.
31261
+ */
31262
+ durability: "restored",
31263
+ /** Clock fields: written, but excluded from the compare that decides
31264
+ * whether persisting is worth a SQLite commit. */
31265
+ volatileStateFields: ["lastFetchedAt"]
31266
+ };
31267
+ //#endregion
31268
+ //#region src/capabilities/recording-onboard-rules.ts
31269
+ /** Minutes in a day. `endMinute === 1440` means "to end of day". */
31270
+ var MINUTES_PER_DAY = 1440;
31271
+ /** Days in the cap's week, 0 = Monday. */
31272
+ var DAYS_PER_WEEK = 7;
31273
+ /** Hours per day — the resolution of Reolink's mask. */
31274
+ var HOURS_PER_DAY = 24;
31275
+ /** Length of a Reolink weekly `valueTable`: 7 days × 24 hours. */
31276
+ var WEEKLY_MASK_LENGTH = 168;
31277
+ /**
31278
+ * Day-of-week names in the cap's index order (0 = Monday), for messages
31279
+ * an operator reads and for Hikvision's `<DayOfWeek>` element.
31280
+ */
31281
+ var DAY_NAMES = [
31282
+ "Monday",
31283
+ "Tuesday",
31284
+ "Wednesday",
31285
+ "Thursday",
31286
+ "Friday",
31287
+ "Saturday",
31288
+ "Sunday"
31289
+ ];
31290
+ /**
31291
+ * Does `patch` ask this camera for something it cannot do?
31292
+ *
31293
+ * Returns the operator-readable reason, or `null` when every field in
31294
+ * the patch is within what `options` says this camera accepts. A
31295
+ * provider calls this BEFORE touching the camera and throws the string:
31296
+ * refusing is the point, and refusing identically on both vendors is why
31297
+ * this is one function.
31298
+ *
31299
+ * The order of checks is the order an operator would read them: the
31300
+ * scalar knobs first, then the schedule, because a schedule complaint is
31301
+ * longer and a scalar one is usually the real problem.
31302
+ */
31303
+ function describeOnboardRefusal(options, patch) {
31304
+ if (patch.enabled !== void 0 && !options.enabled.writable) return unwritable("the master recording switch", options.enabled.reason);
31305
+ if (patch.overwriteWhenFull !== void 0 && !options.overwriteWhenFull.writable) return unwritable("overwrite-when-full", options.overwriteWhenFull.reason);
31306
+ const preRefusal = refuseNumeric("pre-record seconds", patch.preRecordSec, options.preRecordSec, options.preRecordSecRange, options.preRecordSecAllowed);
31307
+ if (preRefusal) return preRefusal;
31308
+ const postRefusal = refuseNumeric("post-record seconds", patch.postRecordSec, options.postRecordSec, options.postRecordSecRange, options.postRecordSecAllowed);
31309
+ if (postRefusal) return postRefusal;
31310
+ const segmentRefusal = refuseNumeric("segment length (minutes)", patch.segmentMinutes, options.segmentMinutes, options.segmentMinutesRange, options.segmentMinutesAllowed);
31311
+ if (segmentRefusal) return segmentRefusal;
31312
+ if (patch.windows !== void 0) {
31313
+ const scheduleRefusal = refuseSchedule(options, patch.windows);
31314
+ if (scheduleRefusal) return scheduleRefusal;
31315
+ }
31316
+ return null;
31317
+ }
31318
+ function unwritable(what, reason) {
31319
+ return reason ? `this camera cannot change ${what}: ${reason}` : `this camera cannot change ${what}`;
31320
+ }
31321
+ function refuseNumeric(what, value, support, range, allowed) {
31322
+ if (value === void 0) return null;
31323
+ if (!support.writable) return unwritable(what, support.reason);
31324
+ if (!Number.isFinite(value)) return `${what} must be a number, got ${String(value)}`;
31325
+ if (allowed) {
31326
+ if (allowed.values.includes(value)) return null;
31327
+ const say = (v) => allowed.sentinel !== void 0 && v === allowed.sentinel.value ? allowed.sentinel.meaning === "no-limit" ? "no limit" : "off" : String(v);
31328
+ return `this camera accepts ${what} only as ${allowed.values.map(say).join(", ")}; ${say(value)} is not one of them`;
31329
+ }
31330
+ if (!range) return null;
31331
+ if (value < range.min || value > range.max) return `this camera accepts ${what} between ${String(range.min)} and ${String(range.max)}; ${String(value)} is outside that`;
31332
+ if (range.step > 0 && (value - range.min) % range.step !== 0) return `this camera accepts ${what} in steps of ${String(range.step)} from ${String(range.min)}; ${String(value)} is not one of them`;
31333
+ return null;
31334
+ }
31335
+ function refuseSchedule(options, windows) {
31336
+ const schedule = options.schedule;
31337
+ if (!schedule.support.writable) return unwritable("the recording schedule", schedule.support.reason);
31338
+ const allowed = new Set(schedule.triggers);
31339
+ for (const window of windows) {
31340
+ if (!allowed.has(window.trigger)) {
31341
+ const offer = schedule.triggers.length > 0 ? schedule.triggers.join(", ") : "none";
31342
+ return `this camera cannot record on "${window.trigger}"; it records on: ${offer}`;
31343
+ }
31344
+ if (window.endMinute <= window.startMinute) return `a window on ${dayName(window.day)} ends at or before it starts (${String(window.startMinute)} → ${String(window.endMinute)})`;
31345
+ const step = schedule.granularityMinutes;
31346
+ if (step > 1 && (window.startMinute % step !== 0 || window.endMinute % step !== 0)) return `this camera's schedule only moves in ${String(step)}-minute steps; the ${dayName(window.day)} window ${formatMinutes(window.startMinute)}–${formatMinutes(window.endMinute)} is not aligned to them`;
31347
+ }
31348
+ if (!schedule.supportsOverlappingTriggers) {
31349
+ const clash = findOverlapWithDifferentTrigger(windows);
31350
+ if (clash) return `this camera stores one trigger per time range, so "${clash.a.trigger}" and "${clash.b.trigger}" cannot both cover ${dayName(clash.a.day)} ${formatMinutes(Math.max(clash.a.startMinute, clash.b.startMinute))}–${formatMinutes(Math.min(clash.a.endMinute, clash.b.endMinute))}`;
31351
+ }
31352
+ return null;
31353
+ }
31354
+ function findOverlapWithDifferentTrigger(windows) {
31355
+ for (let i = 0; i < windows.length; i += 1) for (let j = i + 1; j < windows.length; j += 1) {
31356
+ const a = windows[i];
31357
+ const b = windows[j];
31358
+ if (!a || !b) continue;
31359
+ if (a.day !== b.day) continue;
31360
+ if (a.trigger === b.trigger) continue;
31361
+ if (a.startMinute < b.endMinute && b.startMinute < a.endMinute) return {
31362
+ a,
31363
+ b
31364
+ };
31365
+ }
31366
+ return null;
31367
+ }
31368
+ function dayName(day) {
31369
+ return DAY_NAMES[day] ?? `day ${String(day)}`;
31370
+ }
31371
+ /** `510` → `08:30`. For messages, not for the wire. */
31372
+ function formatMinutes(minute) {
31373
+ const hour = Math.floor(minute / 60);
31374
+ const rest = minute % 60;
31375
+ return `${String(hour).padStart(2, "0")}:${String(rest).padStart(2, "0")}`;
31376
+ }
31377
+ /**
31378
+ * Index of the mask character covering `day` at `hour`.
31379
+ *
31380
+ * **Layout: day-major, Monday first** — `day * 24 + hour`.
31381
+ *
31382
+ * This is an ASSUMPTION, and it is recorded as one because the fleet
31383
+ * cannot currently confirm it: every `valueTable` on every Reolink
31384
+ * measured on 2026-09-22 is uniform (all `1` or all `0`), and a uniform
31385
+ * mask reads identically under either layout. To settle it, set a single
31386
+ * hour on one day from the Reolink app and re-read `getRecordSchedule`.
31387
+ * Until then, a NON-uniform mask is reported as windows under this
31388
+ * layout and the day labels may be transposed; a uniform one is exact.
31389
+ */
31390
+ function weeklyMaskIndex(day, hour) {
31391
+ return day * 24 + hour;
31392
+ }
31393
+ /**
31394
+ * True when every slot of the mask carries the same value — the case in
31395
+ * which {@link weeklyMaskIndex}'s layout assumption cannot be wrong.
31396
+ */
31397
+ function weeklyMaskIsUniform(mask) {
31398
+ if (mask.length === 0) return true;
31399
+ const first = mask[0];
31400
+ for (const ch of mask) if (ch !== first) return false;
31401
+ return true;
31402
+ }
31403
+ /**
31404
+ * Expand one trigger's weekly hour mask into windows, merging adjacent
31405
+ * set hours into one window per run so a full day is ONE window rather
31406
+ * than twenty-four.
31407
+ *
31408
+ * A mask of the wrong length yields no windows: a truncated table is not
31409
+ * a schedule of fewer days, it is an answer we did not understand.
31410
+ */
31411
+ function weeklyMaskToWindows(mask, trigger) {
31412
+ if (mask.length !== 168) return [];
31413
+ const out = [];
31414
+ for (let day = 0; day < 7; day += 1) {
31415
+ let runStart = null;
31416
+ for (let hour = 0; hour <= 24; hour += 1) {
31417
+ const set = hour < 24 && mask[weeklyMaskIndex(day, hour)] === "1";
31418
+ if (set && runStart === null) runStart = hour;
31419
+ else if (!set && runStart !== null) {
31420
+ out.push({
31421
+ trigger,
31422
+ day,
31423
+ startMinute: runStart * 60,
31424
+ endMinute: hour * 60
31425
+ });
31426
+ runStart = null;
31427
+ }
31428
+ }
31429
+ }
31430
+ return out;
31431
+ }
31432
+ /**
31433
+ * Collapse this trigger's windows back into a weekly hour mask.
31434
+ *
31435
+ * Windows for other triggers are ignored — the mask is per trigger. A
31436
+ * window that is not hour-aligned is REFUSED upstream by
31437
+ * {@link describeOnboardRefusal}; this function rounds nothing, it
31438
+ * simply sets every hour the window fully or partly covers, so a caller
31439
+ * that skipped the refusal cannot silently lose coverage.
31440
+ */
31441
+ function windowsToWeeklyMask(windows, trigger) {
31442
+ const slots = new Array(168).fill("0");
31443
+ for (const window of windows) {
31444
+ if (window.trigger !== trigger) continue;
31445
+ if (window.day < 0 || window.day >= 7) continue;
31446
+ const firstHour = Math.floor(window.startMinute / 60);
31447
+ const lastHour = Math.ceil(window.endMinute / 60);
31448
+ for (let hour = firstHour; hour < lastHour && hour < 24; hour += 1) slots[weeklyMaskIndex(window.day, hour)] = "1";
31449
+ }
31450
+ return slots.join("");
31451
+ }
31452
+ /**
31453
+ * Parse a Hikvision `<TimeOfDay>` into minutes since midnight.
31454
+ *
31455
+ * The firmware is not self-consistent and both spellings are real, on
31456
+ * the same camera in the same block: a start time reads `00:00:00` and
31457
+ * the matching end time reads `24:00`. Seconds are accepted and
31458
+ * discarded — the cap's resolution is minutes — and `24:00` maps to
31459
+ * {@link MINUTES_PER_DAY}, not to 0.
31460
+ *
31461
+ * Returns null for anything else, which a caller reports as a window it
31462
+ * could not read rather than as midnight.
31463
+ */
31464
+ function timeOfDayToMinutes(value) {
31465
+ const match = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(value.trim());
31466
+ if (!match) return null;
31467
+ const hour = Number(match[1]);
31468
+ const minute = Number(match[2]);
31469
+ if (!Number.isInteger(hour) || !Number.isInteger(minute)) return null;
31470
+ if (minute > 59) return null;
31471
+ const total = hour * 60 + minute;
31472
+ if (total > 1440) return null;
31473
+ return total;
31474
+ }
31475
+ /**
31476
+ * Render minutes back as a Hikvision `TimeOfDay`.
31477
+ *
31478
+ * Emits the camera's own two spellings: `24:00` for end-of-day, because
31479
+ * that is what the firmware writes and `24:00:00` is not observed, and
31480
+ * `HH:MM:SS` otherwise.
31481
+ */
31482
+ function minutesToTimeOfDay(minute) {
31483
+ if (minute >= 1440) return "24:00";
31484
+ const hour = Math.floor(minute / 60);
31485
+ const rest = minute % 60;
31486
+ return `${String(hour).padStart(2, "0")}:${String(rest).padStart(2, "0")}:00`;
31487
+ }
31488
+ /** `'Monday'` → 0. Case-insensitive. Null for anything unrecognised. */
31489
+ function dayOfWeekToIndex(value) {
31490
+ const needle = value.trim().toLowerCase();
31491
+ const index = DAY_NAMES.findIndex((name) => name.toLowerCase() === needle);
31492
+ return index >= 0 ? index : null;
31493
+ }
31494
+ /**
31495
+ * Which fields of a patch the camera did NOT take verbatim.
31496
+ *
31497
+ * Measured on a Hikvision I91DN (1436, 2026-09-22): a `PUT` of
31498
+ * `PreRecordTimeSeconds: 8` answered `200`, `statusCode 1`, `OK` — and stored
31499
+ * **5**. Neither the asked value nor the previous one. The camera declares no
31500
+ * allowed set for that field, so there is nothing to refuse against before the
31501
+ * wire: `/capabilities` returns a plain value where a constrained field would
31502
+ * carry an `opt=` list.
31503
+ *
31504
+ * So the only honest moment is after the read-back, and re-reading alone is
31505
+ * not enough — it makes the difference VISIBLE while leaving it unexplained.
31506
+ * A write that reports success for a value the camera never took is the same
31507
+ * silent substitution D599 removed from the clip path, wearing a different hat.
31508
+ *
31509
+ * Compares only the fields the patch actually named: a field nobody asked
31510
+ * about cannot have been clamped, and a read-back that could not answer it is
31511
+ * `stored: null` rather than a claim.
31512
+ */
31513
+ function describeOnboardClamp(patch, landed) {
31514
+ const out = [];
31515
+ for (const [field, asked] of Object.entries(patch)) {
31516
+ if (asked === void 0) continue;
31517
+ if (typeof asked !== "number" && typeof asked !== "boolean" && typeof asked !== "string") continue;
31518
+ const raw = landed === null ? void 0 : landed[field];
31519
+ const stored = typeof raw === "number" || typeof raw === "boolean" || typeof raw === "string" ? raw : null;
31520
+ if (stored !== asked) out.push({
31521
+ field,
31522
+ asked,
31523
+ stored
31524
+ });
31525
+ }
31526
+ return out;
31527
+ }
31528
+ //#endregion
30626
31529
  //#region src/capabilities/device-status.cap.ts
30627
31530
  /**
30628
31531
  * Generic device-level status snapshot. Auto-registered by `BaseDevice`
@@ -41528,6 +42431,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
41528
42431
  pressureSensor: pressureSensorCapability,
41529
42432
  privacyMask: privacyMaskCapability,
41530
42433
  ptzAutotrack: ptzAutotrackCapability,
42434
+ recordingOnboard: recordingOnboardCapability,
41531
42435
  recordingSignal: recordingSignalCapability,
41532
42436
  sceneMonitor: sceneMonitorCapability,
41533
42437
  scriptRunner: scriptRunnerCapability,
@@ -45976,6 +46880,7 @@ var CAP_NAMES_WITH_STATUS = [
45976
46880
  "ptz",
45977
46881
  "ptz-autotrack",
45978
46882
  "recording",
46883
+ "recording-onboard",
45979
46884
  "recording-signal",
45980
46885
  "scene-monitor",
45981
46886
  "script-runner",
@@ -46039,6 +46944,7 @@ var CAPABILITY_NAMES = {
46039
46944
  dayNight: "day-night",
46040
46945
  decoder: "decoder",
46041
46946
  detectionPipeline: "detection-pipeline",
46947
+ deviceAdminLink: "device-admin-link",
46042
46948
  deviceAdoption: "device-adoption",
46043
46949
  deviceDiscovery: "device-discovery",
46044
46950
  deviceExport: "device-export",
@@ -46113,6 +47019,7 @@ var CAPABILITY_NAMES = {
46113
47019
  reboot: "reboot",
46114
47020
  recording: "recording",
46115
47021
  recordingExport: "recording-export",
47022
+ recordingOnboard: "recording-onboard",
46116
47023
  recordingSignal: "recording-signal",
46117
47024
  sceneMonitor: "scene-monitor",
46118
47025
  scriptRunner: "script-runner",
@@ -46332,6 +47239,10 @@ var CAPABILITY_ROUTER_KEYS = [
46332
47239
  key: "detectionPipeline",
46333
47240
  name: "detection-pipeline"
46334
47241
  },
47242
+ {
47243
+ key: "deviceAdminLink",
47244
+ name: "device-admin-link"
47245
+ },
46335
47246
  {
46336
47247
  key: "deviceAdoption",
46337
47248
  name: "device-adoption"
@@ -46628,6 +47539,10 @@ var CAPABILITY_ROUTER_KEYS = [
46628
47539
  key: "recordingExport",
46629
47540
  name: "recording-export"
46630
47541
  },
47542
+ {
47543
+ key: "recordingOnboard",
47544
+ name: "recording-onboard"
47545
+ },
46631
47546
  {
46632
47547
  key: "recordingSignal",
46633
47548
  name: "recording-signal"
@@ -46843,6 +47758,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
46843
47758
  dayNightCapability,
46844
47759
  decoderCapability,
46845
47760
  detectionPipelineCapability,
47761
+ deviceAdminLinkCapability,
46846
47762
  deviceAdoptionCapability,
46847
47763
  deviceDiscoveryCapability,
46848
47764
  deviceExportCapability,
@@ -46917,6 +47833,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
46917
47833
  rebootCapability,
46918
47834
  recordingCapability,
46919
47835
  recordingExportCapability,
47836
+ recordingOnboardCapability,
46920
47837
  recordingSignalCapability,
46921
47838
  sceneMonitorCapability,
46922
47839
  scriptRunnerCapability,
@@ -48263,6 +49180,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
48263
49180
  addonId: null,
48264
49181
  access: "view"
48265
49182
  },
49183
+ "deviceAdminLink.getAdminLink": {
49184
+ capName: "device-admin-link",
49185
+ capScope: "device",
49186
+ addonId: null,
49187
+ access: "view"
49188
+ },
48266
49189
  "deviceAdoption.adopt": {
48267
49190
  capName: "device-adoption",
48268
49191
  capScope: "system",
@@ -52301,6 +53224,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
52301
53224
  addonId: null,
52302
53225
  access: "view"
52303
53226
  },
53227
+ "recordingOnboard.getOptions": {
53228
+ capName: "recording-onboard",
53229
+ capScope: "device",
53230
+ addonId: null,
53231
+ access: "view"
53232
+ },
53233
+ "recordingOnboard.getStatus": {
53234
+ capName: "recording-onboard",
53235
+ capScope: "device",
53236
+ addonId: null,
53237
+ access: "view"
53238
+ },
53239
+ "recordingOnboard.setSettings": {
53240
+ capName: "recording-onboard",
53241
+ capScope: "device",
53242
+ addonId: null,
53243
+ access: "create"
53244
+ },
52304
53245
  "recordingSignal.getStatus": {
52305
53246
  capName: "recording-signal",
52306
53247
  capScope: "device",
@@ -53998,6 +54939,7 @@ var KNOWN_CAP_NAMES = [
53998
54939
  "day-night",
53999
54940
  "decoder",
54000
54941
  "detection-pipeline",
54942
+ "device-admin-link",
54001
54943
  "device-adoption",
54002
54944
  "device-discovery",
54003
54945
  "device-export",
@@ -54072,6 +55014,7 @@ var KNOWN_CAP_NAMES = [
54072
55014
  "reboot",
54073
55015
  "recording",
54074
55016
  "recording-export",
55017
+ "recording-onboard",
54075
55018
  "recording-signal",
54076
55019
  "scene-monitor",
54077
55020
  "script-runner",
@@ -54140,6 +55083,7 @@ var DEVICE_CAP_NAMES = [
54140
55083
  "cover",
54141
55084
  "day-night",
54142
55085
  "detection-pipeline",
55086
+ "device-admin-link",
54143
55087
  "device-discovery",
54144
55088
  "device-ops",
54145
55089
  "device-status",
@@ -54178,6 +55122,7 @@ var DEVICE_CAP_NAMES = [
54178
55122
  "ptz",
54179
55123
  "ptz-autotrack",
54180
55124
  "reboot",
55125
+ "recording-onboard",
54181
55126
  "recording-signal",
54182
55127
  "scene-monitor",
54183
55128
  "script-runner",
@@ -54514,6 +55459,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
54514
55459
  form: "single",
54515
55460
  optional: true
54516
55461
  }],
55462
+ "deviceAdminLink.getAdminLink": [{
55463
+ name: "deviceId",
55464
+ form: "single",
55465
+ optional: false
55466
+ }],
54517
55467
  "deviceAdoption.release": [{
54518
55468
  name: "camDeviceId",
54519
55469
  form: "single",
@@ -55899,6 +56849,16 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
55899
56849
  form: "single",
55900
56850
  optional: true
55901
56851
  }],
56852
+ "recordingOnboard.getOptions": [{
56853
+ name: "deviceId",
56854
+ form: "single",
56855
+ optional: false
56856
+ }],
56857
+ "recordingOnboard.setSettings": [{
56858
+ name: "deviceId",
56859
+ form: "single",
56860
+ optional: false
56861
+ }],
55902
56862
  "recordingSignal.getStatus": [{
55903
56863
  name: "deviceId",
55904
56864
  form: "single",
@@ -56450,7 +57410,7 @@ function getCapsByProviderKind(kind) {
56450
57410
  //#region src/generated/runtime-state-durability.ts
56451
57411
  /**
56452
57412
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
56453
- * `runtimeState`. 68 caps: 35 `restored`, 33 `session`.
57413
+ * `runtimeState`. 69 caps: 36 `restored`, 33 `session`.
56454
57414
  *
56455
57415
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
56456
57416
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -56652,6 +57612,10 @@ var RUNTIME_STATE_POLICY = {
56652
57612
  durability: "session",
56653
57613
  volatileFields: []
56654
57614
  },
57615
+ "recording-onboard": {
57616
+ durability: "restored",
57617
+ volatileFields: ["lastFetchedAt"]
57618
+ },
56655
57619
  "recording-signal": {
56656
57620
  durability: "session",
56657
57621
  volatileFields: []
@@ -56776,6 +57740,7 @@ var RESTORED_CAP_NAMES = [
56776
57740
  "presence",
56777
57741
  "pressure-sensor",
56778
57742
  "privacy-mask",
57743
+ "recording-onboard",
56779
57744
  "smoke",
56780
57745
  "stream-catalog",
56781
57746
  "stream-params",
@@ -61645,6 +62610,7 @@ exports.AddonAutoUpdateSchema = AddonAutoUpdateSchema;
61645
62610
  exports.AddonListItemSchema = AddonListItemSchema;
61646
62611
  exports.AddonPageDeclarationSchema = AddonPageDeclarationSchema;
61647
62612
  exports.AddonPageInfoSchema = AddonPageInfoSchema;
62613
+ exports.AdminLinkTargetEnum = AdminLinkTargetEnum;
61648
62614
  exports.AdoptionAdoptInputSchema = AdoptInputSchema;
61649
62615
  exports.AdoptionAdoptResultSchema = AdoptResultSchema;
61650
62616
  exports.AdoptionCandidateResultSchema = AdoptionCandidateResultSchema;
@@ -61761,6 +62727,7 @@ exports.CAP_NAMES_WITH_STATUS = CAP_NAMES_WITH_STATUS;
61761
62727
  exports.CAP_NODE_PIN_CONTEXT_KEY = require_sleep.CAP_NODE_PIN_CONTEXT_KEY;
61762
62728
  exports.CAP_PROVIDER_KIND_MAP = CAP_PROVIDER_KIND_MAP;
61763
62729
  exports.CLASS_MAP_MACRO_TARGETS = CLASS_MAP_MACRO_TARGETS;
62730
+ exports.CLIP_REASON_HEADER_MAX = CLIP_REASON_HEADER_MAX;
61764
62731
  exports.CLIP_STILL_DISPOSITION_HEADER = CLIP_STILL_DISPOSITION_HEADER;
61765
62732
  exports.CLIP_STILL_REASON_CODE_HEADER = CLIP_STILL_REASON_CODE_HEADER;
61766
62733
  exports.CLIP_STILL_REASON_HEADER = CLIP_STILL_REASON_HEADER;
@@ -61864,6 +62831,8 @@ exports.CreateUserInputSchema = CreateUserInputSchema;
61864
62831
  exports.CustomActionInputSchema = CustomActionInputSchema;
61865
62832
  exports.CustomModelDescriptorSchema = CustomModelDescriptorSchema;
61866
62833
  exports.DATAPLANE_SECRET_HEADER = require_sleep.DATAPLANE_SECRET_HEADER;
62834
+ exports.DAYS_PER_WEEK = DAYS_PER_WEEK;
62835
+ exports.DAY_NAMES = DAY_NAMES;
61867
62836
  exports.DECLARED_DEVICE_SWEEP_LIMIT = DECLARED_DEVICE_SWEEP_LIMIT;
61868
62837
  exports.DECLARED_INTEGRATION_FIXED_KEY = DECLARED_INTEGRATION_FIXED_KEY;
61869
62838
  exports.DEFAULT_ADDON_PLACEMENT = DEFAULT_ADDON_PLACEMENT;
@@ -61923,6 +62892,7 @@ exports.DetailCropConventionSchema = DetailCropConventionSchema;
61923
62892
  exports.DetectionCatalogClassMapSchema = DetectionCatalogClassMapSchema;
61924
62893
  exports.DetectionSourceSchema = DetectionSourceSchema;
61925
62894
  exports.DetectionSourcesSchema = DetectionSourcesSchema;
62895
+ exports.DeviceAdminLinkSchema = DeviceAdminLinkSchema;
61926
62896
  exports.DeviceCodeSeveritySchema = DeviceCodeSeveritySchema;
61927
62897
  exports.DeviceConfig = DeviceConfig;
61928
62898
  exports.DeviceDiscoveryStatusSchema = DeviceDiscoveryStatusSchema;
@@ -62042,6 +63012,7 @@ exports.HAP_AUDIO_VBV_KBITS = HAP_AUDIO_VBV_KBITS;
62042
63012
  exports.HAP_KEYFRAME_INTERVAL_SEC = HAP_KEYFRAME_INTERVAL_SEC;
62043
63013
  exports.HF_BASE_URL = HF_BASE_URL;
62044
63014
  exports.HF_REPO = HF_REPO;
63015
+ exports.HOURS_PER_DAY = HOURS_PER_DAY;
62045
63016
  exports.HWACCEL_OPTIONS = HWACCEL_OPTIONS;
62046
63017
  exports.HealthStatusSchema = HealthStatusSchema;
62047
63018
  exports.HfModelResolutionSchema = HfModelResolutionSchema;
@@ -62161,6 +63132,7 @@ exports.MEDIA_OWNER_TYPES = MEDIA_OWNER_TYPES;
62161
63132
  exports.MEDIA_PRESENCE_OWNER_KINDS = MEDIA_PRESENCE_OWNER_KINDS;
62162
63133
  exports.METHOD_ACCESS_MAP = METHOD_ACCESS_MAP;
62163
63134
  exports.METHOD_DEVICE_SELECTORS = METHOD_DEVICE_SELECTORS;
63135
+ exports.MINUTES_PER_DAY = MINUTES_PER_DAY;
62164
63136
  exports.MODEL_FORMATS = MODEL_FORMATS;
62165
63137
  exports.MODEL_PROVIDER_IDS = MODEL_PROVIDER_IDS;
62166
63138
  exports.MOTION_CLOSE_AFTER_MS = MOTION_CLOSE_AFTER_MS;
@@ -62363,6 +63335,11 @@ exports.OVERLAY_LAYERS = OVERLAY_LAYERS;
62363
63335
  exports.OauthIntegrationDescriptorSchema = OauthIntegrationDescriptorSchema;
62364
63336
  exports.ObjectEventSchema = ObjectEventSchema;
62365
63337
  exports.OccupancyBurstRefusalSchema = OccupancyBurstRefusalSchema;
63338
+ exports.OnboardFieldSupportSchema = OnboardFieldSupportSchema;
63339
+ exports.OnboardRecordTrackSchema = OnboardRecordTrackSchema;
63340
+ exports.OnboardScheduleSupportSchema = OnboardScheduleSupportSchema;
63341
+ exports.OnboardStorageSchema = OnboardStorageSchema;
63342
+ exports.OnboardStorageVolumeSchema = OnboardStorageVolumeSchema;
62366
63343
  exports.OpsLogDomainSchema = OpsLogDomainSchema;
62367
63344
  exports.OpsLogEntrySchema = OpsLogEntrySchema;
62368
63345
  exports.OpsLogOpSchema = OpsLogOpSchema;
@@ -62464,6 +63441,8 @@ exports.ReadinessRegistry = require_sleep.ReadinessRegistry;
62464
63441
  exports.ReadinessTimeoutError = require_sleep.ReadinessTimeoutError;
62465
63442
  exports.RecentTracksPageSchema = RecentTracksPageSchema;
62466
63443
  exports.RecentTracksQueryInput = RecentTracksQueryInput;
63444
+ exports.RecordTriggerSchema = RecordTriggerSchema;
63445
+ exports.RecordWindowSchema = RecordWindowSchema;
62467
63446
  exports.RecordingAvailabilityForDeviceSchema = RecordingAvailabilityForDeviceSchema;
62468
63447
  exports.RecordingAvailabilitySchema = RecordingAvailabilitySchema;
62469
63448
  exports.RecordingBandAudioSchema = RecordingBandAudioSchema;
@@ -62477,6 +63456,9 @@ exports.RecordingDeviceUsageSchema = RecordingDeviceUsageSchema;
62477
63456
  exports.RecordingLocationUsageSchema = RecordingLocationUsageSchema;
62478
63457
  exports.RecordingManifestSchema = RecordingManifestSchema;
62479
63458
  exports.RecordingObjectTriggerClassSchema = RecordingObjectTriggerClassSchema;
63459
+ exports.RecordingOnboardOptionsSchema = RecordingOnboardOptionsSchema;
63460
+ exports.RecordingOnboardPatchSchema = RecordingOnboardPatchSchema;
63461
+ exports.RecordingOnboardStatusSchema = RecordingOnboardStatusSchema;
62480
63462
  exports.RecordingRangeSchema = RecordingRangeSchema;
62481
63463
  exports.RecordingRebalanceInputSchema = RecordingRebalanceInputSchema;
62482
63464
  exports.RecordingRebalanceMoveSchema = RecordingRebalanceMoveSchema;
@@ -62756,6 +63738,7 @@ exports.VectorUpsertResultSchema = VectorUpsertResultSchema;
62756
63738
  exports.VibrationStatusSchema = VibrationStatusSchema;
62757
63739
  exports.VideoEncodeSchema = VideoEncodeSchema;
62758
63740
  exports.WEBRTC_EGRESS_PROFILE = WEBRTC_EGRESS_PROFILE;
63741
+ exports.WEEKLY_MASK_LENGTH = WEEKLY_MASK_LENGTH;
62759
63742
  exports.WELL_KNOWN_TABS = require_sleep.WELL_KNOWN_TABS;
62760
63743
  exports.WELL_KNOWN_TAB_MAP = require_sleep.WELL_KNOWN_TAB_MAP;
62761
63744
  exports.WaterHeaterStatusSchema = WaterHeaterStatusSchema;
@@ -62830,6 +63813,7 @@ exports.brightnessCapability = brightnessCapability;
62830
63813
  exports.brokerCapability = brokerCapability;
62831
63814
  exports.buildAddonRouteProvider = buildAddonRouteProvider;
62832
63815
  exports.buildAudioArgs = require_canonical_hash.buildAudioArgs;
63816
+ exports.buildDeviceAdminUrl = buildDeviceAdminUrl;
62833
63817
  exports.buildEventKindDescriptor = buildEventKindDescriptor;
62834
63818
  exports.buildFfmpegArgs = require_canonical_hash.buildFfmpegArgs;
62835
63819
  exports.buildInputArgs = require_canonical_hash.buildInputArgs;
@@ -62853,6 +63837,7 @@ exports.classifyStreams = classifyStreams;
62853
63837
  exports.climateControlCapability = climateControlCapability;
62854
63838
  exports.clipExportFailure = clipExportFailure;
62855
63839
  exports.clipExportFailureOf = clipExportFailureOf;
63840
+ exports.clipReasonHeaderValue = clipReasonHeaderValue;
62856
63841
  exports.clusterModelSettingKey = clusterModelSettingKey;
62857
63842
  exports.clusterStepSettingFieldsFor = clusterStepSettingFieldsFor;
62858
63843
  exports.clusterStepSettingKey = clusterStepSettingKey;
@@ -62898,6 +63883,7 @@ exports.customAction = require_sleep.customAction;
62898
63883
  exports.customModelRegistryCapability = customModelRegistryCapability;
62899
63884
  exports.dataStoreProviderCapability = dataStoreProviderCapability;
62900
63885
  exports.dayNightCapability = dayNightCapability;
63886
+ exports.dayOfWeekToIndex = dayOfWeekToIndex;
62901
63887
  exports.declarationOwnerNodeId = declarationOwnerNodeId;
62902
63888
  exports.declareLogChannel = declareLogChannel;
62903
63889
  exports.decodeVectorBase64 = decodeVectorBase64;
@@ -62911,8 +63897,11 @@ exports.deriveDetailCropRect = deriveDetailCropRect;
62911
63897
  exports.deriveRecordingMode = deriveRecordingMode;
62912
63898
  exports.describeCustomActions = require_sleep.describeCustomActions;
62913
63899
  exports.describeModelVariant = describeModelVariant;
63900
+ exports.describeOnboardClamp = describeOnboardClamp;
63901
+ exports.describeOnboardRefusal = describeOnboardRefusal;
62914
63902
  exports.detectAccessRole = detectAccessRole;
62915
63903
  exports.detectionPipelineCapability = detectionPipelineCapability;
63904
+ exports.deviceAdminLinkCapability = deviceAdminLinkCapability;
62916
63905
  exports.deviceAdoptionCapability = deviceAdoptionCapability;
62917
63906
  exports.deviceBackendToFormat = deviceBackendToFormat;
62918
63907
  exports.deviceCustomAction = require_sleep.deviceCustomAction;
@@ -62969,6 +63958,7 @@ exports.foldSnapshotByFunction = foldSnapshotByFunction;
62969
63958
  exports.formatForBackend = formatForBackend;
62970
63959
  exports.formatForRuntime = formatForRuntime;
62971
63960
  exports.formatMediaOwnerKey = formatMediaOwnerKey;
63961
+ exports.formatMinutes = formatMinutes;
62972
63962
  exports.formatParkedFor = formatParkedFor;
62973
63963
  exports.gasCapability = gasCapability;
62974
63964
  exports.gbToBytes = gbToBytes;
@@ -63061,6 +64051,7 @@ exports.method = require_sleep.method;
63061
64051
  exports.methodAccessForHttpMethod = methodAccessForHttpMethod;
63062
64052
  exports.metricsProviderCapability = metricsProviderCapability;
63063
64053
  exports.migrateLegacyDeviceSignalConfig = migrateLegacyDeviceSignalConfig;
64054
+ exports.minutesToTimeOfDay = minutesToTimeOfDay;
63064
64055
  exports.modeMayRead = modeMayRead;
63065
64056
  exports.modeMayWrite = modeMayWrite;
63066
64057
  exports.modelConvertCapability = modelConvertCapability;
@@ -63094,6 +64085,7 @@ exports.optionalMethod = require_sleep.optionalMethod;
63094
64085
  exports.osdCapability = osdCapability;
63095
64086
  exports.osdManagerCapability = osdManagerCapability;
63096
64087
  exports.overlayClusterStepSettings = overlayClusterStepSettings;
64088
+ exports.parseAdminBase = parseAdminBase;
63097
64089
  exports.parseCameraStreamConfig = parseCameraStreamConfig;
63098
64090
  exports.parseExpression = parseExpression;
63099
64091
  exports.parseJsonArray = require_sleep.parseJsonArray;
@@ -63145,6 +64137,7 @@ exports.readinessKey = require_sleep.readinessKey;
63145
64137
  exports.rebootCapability = rebootCapability;
63146
64138
  exports.recordingCapability = recordingCapability;
63147
64139
  exports.recordingExportCapability = recordingExportCapability;
64140
+ exports.recordingOnboardCapability = recordingOnboardCapability;
63148
64141
  exports.recordingSignalCapability = recordingSignalCapability;
63149
64142
  exports.rectsToCells = rectsToCells;
63150
64143
  exports.reducePoints = reducePoints;
@@ -63244,6 +64237,7 @@ exports.taskTargetSchema = taskTargetSchema;
63244
64237
  exports.temperatureSensorCapability = temperatureSensorCapability;
63245
64238
  exports.terminalSessionCapability = terminalSessionCapability;
63246
64239
  exports.textToHtml = textToHtml;
64240
+ exports.timeOfDayToMinutes = timeOfDayToMinutes;
63247
64241
  exports.toDeviceSummary = toDeviceSummary;
63248
64242
  exports.toExpressionValue = toExpressionValue;
63249
64243
  exports.toNodeId = require_sleep.toNodeId;
@@ -63272,6 +64266,10 @@ exports.waterHeaterCapability = waterHeaterCapability;
63272
64266
  exports.weatherCapability = weatherCapability;
63273
64267
  exports.webrtcClientHintsSchema = webrtcClientHintsSchema;
63274
64268
  exports.webrtcSessionCapability = webrtcSessionCapability;
64269
+ exports.weeklyMaskIndex = weeklyMaskIndex;
64270
+ exports.weeklyMaskIsUniform = weeklyMaskIsUniform;
64271
+ exports.weeklyMaskToWindows = weeklyMaskToWindows;
64272
+ exports.windowsToWeeklyMask = windowsToWeeklyMask;
63275
64273
  exports.wiringAddonHealthSchema = wiringAddonHealthSchema;
63276
64274
  exports.wiringHealthSnapshotSchema = wiringHealthSnapshotSchema;
63277
64275
  exports.wiringNodeHealthSchema = wiringNodeHealthSchema;