@camstack/addon-provider-homeassistant 1.2.142 → 1.2.144

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.
@@ -5359,7 +5359,7 @@ var ZodIssueCode = {
5359
5359
  var ZodFirstPartyTypeKind;
5360
5360
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5361
5361
  //#endregion
5362
- //#region ../types/dist/sleep-i3eUVc-d.mjs
5362
+ //#region ../types/dist/sleep-pM_J7YnY.mjs
5363
5363
  /**
5364
5364
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5365
5365
  * window to float samples (D455).
@@ -6495,6 +6495,24 @@ function normalizeAddonInitResult(result) {
6495
6495
  if (Array.isArray(result)) return { providers: result };
6496
6496
  return result;
6497
6497
  }
6498
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
6499
+ var PeerBytesTicketSchema = object({
6500
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
6501
+ url: string().min(1),
6502
+ /**
6503
+ * The HOST node this URL means something on — the hub or a named agent,
6504
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
6505
+ * refuses `cross-node` by name when they differ, without dialling.
6506
+ */
6507
+ hostNodeId: string().min(1),
6508
+ expiresAtMs: number().int().nonnegative(),
6509
+ /**
6510
+ * What the producer DECLARED the body to be, when it knows — `null` when it
6511
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
6512
+ * must be able to tell "the producer did not say" from "the body is empty".
6513
+ */
6514
+ declaredBytes: number().int().nonnegative().nullable()
6515
+ });
6498
6516
  /** Shared Zod schemas used across streaming capabilities. */
6499
6517
  var CamProfileSchema = _enum([
6500
6518
  "high",
@@ -7816,7 +7834,7 @@ var AdoptionJobSchema = object({
7816
7834
  * component's original options — detection to the detection-pipeline wrapper
7817
7835
  * binding, audio analysis to its own, recording to `RecordingConfig.enabled`
7818
7836
  * (which was always first-class; the switch was a veneer over
7819
- * `recording.setDeviceConfig`), notifications to a notification-center
7837
+ * `recordingArchive.setDeviceConfig`), notifications to a notification-center
7820
7838
  * per-device setting, the two camera planes to their own components.
7821
7839
  *
7822
7840
  * What survives is {@link composeSwitchedOff}: `CameraStatus.switchedOff`, the
@@ -7842,7 +7860,7 @@ var AdoptionJobSchema = object({
7842
7860
  * | `stream-broker` | `deviceManager.setDisabled` | `StreamBrokerManager.reconcileAllCatalogs` releases the brokers; `ensureBroker` refuses re-creation |
7843
7861
  * | `object-detection` | `deviceManager.setWrapperActive('detection-pipeline')` | `PipelineSettingsStore.resolvePipelineForDevice` returns `{ steps: [], audio: null }` |
7844
7862
  * | `audio-analysis` | `deviceManager.setWrapperActive('audio-analysis')` | `AudioSubscriptionController.subscribeAudioStream` returns `null` before opening the stream |
7845
- * | `recording` | `recording.setDeviceConfig` → `RecordingConfig.enabled` | `band-decision.shouldRecord` returns false; the controller detaches the device |
7863
+ * | `recording` | `recordingArchive.setDeviceConfig` → `RecordingConfig.enabled` | `band-decision.shouldRecord` returns false; the controller detaches the device |
7846
7864
  * | `notifications` | `notificationRules.setDeviceMuted` | `NotificationCenter.evaluateAndEnqueue` returns before any rule is evaluated |
7847
7865
  * | `privacy-mask` | `privacyMask.setMask({ enabled })` → the CAMERA | the camera blanks the masked regions itself; every stream and recording carries the black boxes |
7848
7866
  * | `device-audio` | `privacyMask.setAudioEnabled` → the CAMERA | the camera stops encoding an audio track at all; every consumer sees silent video |
@@ -11835,87 +11853,6 @@ var brokerCapability = {
11835
11853
  }
11836
11854
  };
11837
11855
  DeviceType.Camera;
11838
- /**
11839
- * The signals a device can emit to WAKE its own stream.
11840
- *
11841
- * A camera whose stream is built on demand sleeps until something asks for it,
11842
- * and "something" cannot be a consumer that is merely attached — a Frigate-style
11843
- * puller holds a session open for ever, and treating that as demand would keep
11844
- * a battery camera awake for ever, which is the whole thing the battery is for
11845
- * (D173). So the wake has to come from the CAMERA: an event it noticed by
11846
- * itself, with no stream running.
11847
- *
11848
- * ## The vocabulary is the PROVIDER'S, not ours
11849
- *
11850
- * Like `consumables`, this cap declares no vocabulary of its own. A provider
11851
- * names each signal with a `code` it chooses and a `label` an operator reads.
11852
- * Reolink offers motion and camera-native detection; another provider may offer
11853
- * a tamper, a doorbell press, a PIR, or something no camera in this fleet has
11854
- * yet. A fixed enum here would mean every new signal is a framework release.
11855
- *
11856
- * It is deliberately NOT derived from the caps a device already binds. Whether
11857
- * a camera CAN push firmware motion is expressed by `motionSources` containing
11858
- * `'onboard'`, and whether it does AI on-camera by the `native-object-detection`
11859
- * binding — but both answer "what drives the detection pipeline", which is a
11860
- * different question from "what may wake a sleeping stream". A camera can do
11861
- * the first and not be trusted with the second, and the operator picks per
11862
- * camera. Two questions, two authorities.
11863
- *
11864
- * ## Availability is not permission
11865
- *
11866
- * `listSignals` says what the device CAN emit. Whether a given signal actually
11867
- * wakes the stream is the operator's per-camera choice, held by the broker
11868
- * alongside the cooldown — see the stream-broker cap's wake settings. A
11869
- * provider declaring a signal is not a provider enabling it.
11870
- */
11871
- /** One signal a device can emit. */
11872
- var StreamSignalSchema = object({
11873
- /** Stable id chosen by the provider, e.g. `'motion'`, `'person'`, `'tamper'`. */
11874
- code: string().min(1),
11875
- /** What an operator reads in the picker. The provider's own wording. */
11876
- label: string().min(1),
11877
- /**
11878
- * Whether the provider recommends this signal ON when a camera is first set
11879
- * up. A provider knows which of its signals are cheap and reliable; an
11880
- * operator should not have to discover that by trial. Reolink recommends
11881
- * both of its own.
11882
- */
11883
- recommended: boolean()
11884
- });
11885
- var StreamSignalsStatusSchema = object({
11886
- signals: array(StreamSignalSchema),
11887
- lastFetchedAt: number()
11888
- });
11889
- var streamSignalsCapability = {
11890
- name: "stream-signals",
11891
- scope: "device",
11892
- deviceNative: true,
11893
- mode: "singleton",
11894
- deviceTypes: Object.values(DeviceType),
11895
- runtimeState: StreamSignalsStatusSchema,
11896
- /**
11897
- * Runtime-state durability: **session** — mirrored in RAM, never written.
11898
- *
11899
- * The slice holds what the DEVICE says it can emit. That is a probed fact,
11900
- * not an operator choice: the provider re-declares it on every registration,
11901
- * so losing it loses nothing and persisting it would freeze an answer the
11902
- * camera is entitled to change. Measured the same day on the sibling case —
11903
- * `native-object-detection.supportedClasses` was persisted, and a firmware
11904
- * class the camera really detected stayed missing for the life of the row
11905
- * because the fix could not reach it.
11906
- *
11907
- * See `RuntimeStateDurability`. Enforced by
11908
- * `scripts/check-runtime-state-durability.ts`.
11909
- */
11910
- durability: "session",
11911
- methods: {
11912
- /**
11913
- * What this device can emit. Empty is a valid and common answer — most
11914
- * cameras have nothing to offer here, and an empty list is what makes the
11915
- * broker's picker show nothing rather than a false choice.
11916
- */
11917
- listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
11918
- };
11919
11856
  /** Stream delivery format. (Relocated from the retired `streaming-engine` cap.) */
11920
11857
  var StreamFormatSchema = _enum([
11921
11858
  "webrtc",
@@ -13381,6 +13318,244 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
13381
13318
  });
13382
13319
  DeviceType.Camera;
13383
13320
  /**
13321
+ * device-admin-link — "this device has a management page of its own, and here
13322
+ * is its address".
13323
+ *
13324
+ * ## Why this is not a `deviceConfig` cap
13325
+ *
13326
+ * There is nothing to edit. A `deviceConfig` cap (D14) exists so the framework
13327
+ * can DERIVE a settings form from `getOptions` + `getStatus` and route a flat
13328
+ * patch back through a setter; it costs a `builderId` reducer in
13329
+ * `device-config-contribution.ts` and a `*-config-schema.ts` beside it, and it
13330
+ * renders a form section. This cap answers ONE question with ONE read and
13331
+ * renders a button. Nothing about it is a form, so it carries no `deviceConfig`
13332
+ * block, no `settings`, no `runtimeState` and no reducer — exactly like
13333
+ * `reboot`, the other pure-RPC device-native cap.
13334
+ *
13335
+ * ## Absent, and the difference between "no page" and "we cannot say"
13336
+ *
13337
+ * The two are answered at DIFFERENT layers, on purpose:
13338
+ *
13339
+ * - **"We cannot say"** → the provider never registers the cap for that
13340
+ * device. A VeSync humidifier, a Petkit feeder, a Dreame vacuum and a Dreo
13341
+ * fan are reached only through a vendor cloud; there is no address to hand
13342
+ * out and no page to open. A Tuya plug, a Wyze camera and a Gree air
13343
+ * conditioner DO have a LAN IP, and still have no HTTP management page
13344
+ * behind it. None of them register, so `deviceManager.getBindings` never
13345
+ * lists the cap and no surface asks.
13346
+ * - **"This device has no page, and I know that"** → the provider registers
13347
+ * and `getAdminLink` returns `null`. This is the answer for a device whose
13348
+ * sibling DOES have a page: a Reolink battery camera reached over UDP by
13349
+ * `uid` with a blank `host`, an Ecowitt gateway configured in `listener`
13350
+ * transport, a Home Assistant broker authenticated by supervisor token
13351
+ * (which carries no `baseUrl` at all).
13352
+ *
13353
+ * Both draw NOTHING. A button that opens a browser error is worse than no
13354
+ * button, and D62 is the same rule from the other side: an off switch is
13355
+ * reported off, never made to look broken. There is no third state where the
13356
+ * UI renders a disabled button "because the device might have a page".
13357
+ *
13358
+ * ## The URL never carries credentials
13359
+ *
13360
+ * Not in userinfo, not in a query string. Every provider builds through
13361
+ * `buildDeviceAdminUrl` (`device-admin-link-url.ts`), which takes host, port,
13362
+ * scheme and path as separate arguments — there is no parameter a secret could
13363
+ * arrive in — and re-checks its own output for the `scheme://user:pass@` shape
13364
+ * that `scripts/check-no-credential-urls-in-fixtures.ts` bans from recorded
13365
+ * output. `scripts/check-admin-link-builder-is-the-only-url-source.ts` is what
13366
+ * keeps providers from hand-rolling one anyway.
13367
+ *
13368
+ * This matters here more than anywhere else in the repo, because every provider
13369
+ * that knows a device's host knows its PASSWORD too: `{ host, port, username,
13370
+ * password }` sit in one object on Hikvision, Amcrest, Reolink and ONVIF alike,
13371
+ * and `http://admin:hunter2@192.168.50.139/` is a URL a browser accepts. The
13372
+ * camera's own page will ask for its own login. That is correct, and pre-
13373
+ * filling it is the operator's business, not ours.
13374
+ *
13375
+ * ## It is a LAN fact
13376
+ *
13377
+ * The URL addresses the device where the NODE can see it. It is not proxied,
13378
+ * not made reachable from outside, and not sent anywhere. A surface renders it
13379
+ * as a link the operator's own browser follows, on the operator's own network,
13380
+ * or renders nothing.
13381
+ */
13382
+ /**
13383
+ * Whose page is it. The distinction is for the OPERATOR, who needs to know
13384
+ * before clicking whether he is about to land on a camera's own web server or
13385
+ * inside Home Assistant.
13386
+ */
13387
+ var AdminLinkTargetEnum = _enum(["device", "integration"]);
13388
+ var DeviceAdminLinkSchema = object({
13389
+ /**
13390
+ * Absolute `http(s)://` URL. Built by `buildDeviceAdminUrl` and therefore
13391
+ * free of userinfo and of any credential-shaped query key.
13392
+ */
13393
+ url: string(),
13394
+ /**
13395
+ * What the surface calls it — "Web UI", "Home Assistant", "UniFi controller".
13396
+ * The PROVIDER names it, because only the provider knows what the page is;
13397
+ * a UI that invented the label from the addon id would call the Home
13398
+ * Assistant device page "Provider Homeassistant".
13399
+ */
13400
+ label: string(),
13401
+ target: AdminLinkTargetEnum,
13402
+ /**
13403
+ * Host the URL points at, without scheme, port or path — for the tooltip, so
13404
+ * an operator can see WHERE the button goes before he follows it. Redundant
13405
+ * with `url` by construction; carried separately so no surface has to parse
13406
+ * a URL to show it.
13407
+ */
13408
+ host: string()
13409
+ });
13410
+ var deviceAdminLinkCapability = {
13411
+ name: "device-admin-link",
13412
+ scope: "device",
13413
+ deviceNative: true,
13414
+ mode: "singleton",
13415
+ methods: {
13416
+ /**
13417
+ * The device's management page, or `null` when this device has none.
13418
+ *
13419
+ * `auth: 'admin'` deliberately. This is administration, not actuation —
13420
+ * the same bucket as `reboot` and `camera-credentials`, and explicitly NOT
13421
+ * the actuation set `scripts/check-actuation-not-admin.ts` protects (D403).
13422
+ * The URL is also a statement about the LAN, which a household member with
13423
+ * a `view` grant on a light has no reason to be handed.
13424
+ *
13425
+ * The surfaces gate on the QUERY, never on a role they guessed: a caller
13426
+ * without the right loses the query and draws nothing, which is the same
13427
+ * thing a device with no page draws. There is no path on which a button
13428
+ * appears and then fails — the D403 failure mode, from the other end.
13429
+ */
13430
+ getAdminLink: method(object({ deviceId: number().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" }) }
13431
+ };
13432
+ /**
13433
+ * Query keys that may never appear on an admin link. A credential smuggled as
13434
+ * `?password=` is the same leak as userinfo, in a form the userinfo check
13435
+ * cannot see: it survives copy-paste, referrer headers and proxy logs
13436
+ * identically.
13437
+ */
13438
+ var CREDENTIAL_QUERY_KEYS = [
13439
+ "password",
13440
+ "passwd",
13441
+ "pwd",
13442
+ "pass",
13443
+ "user",
13444
+ "username",
13445
+ "usr",
13446
+ "login",
13447
+ "token",
13448
+ "access_token",
13449
+ "auth",
13450
+ "authorization",
13451
+ "apikey",
13452
+ "api_key",
13453
+ "secret",
13454
+ "credential",
13455
+ "credentials",
13456
+ "session",
13457
+ "sessionid",
13458
+ "key"
13459
+ ];
13460
+ /**
13461
+ * The same userinfo shape `scripts/check-no-credential-urls-in-fixtures.ts`
13462
+ * scans recorded fixtures for, applied to what we are about to EMIT. Kept
13463
+ * structurally identical on purpose: a URL this function returns is a URL that
13464
+ * guard would pass.
13465
+ */
13466
+ var CREDENTIAL_URL = /[a-z][a-z0-9+.-]*:\/\/[^/\s:@'"]+:[^/\s:@'"]+@/i;
13467
+ /** A host that is safe to place in an authority component verbatim. */
13468
+ var PLAIN_HOST = /^[a-zA-Z0-9._-]+$/;
13469
+ /** A bracketed IPv6 literal, the only other authority form we emit. */
13470
+ var IPV6_HOST = /^\[[0-9a-fA-F:.]+\]$/;
13471
+ function defaultPortFor(scheme) {
13472
+ return scheme === "https" ? 443 : 80;
13473
+ }
13474
+ /**
13475
+ * Build the admin-page URL, or refuse by name.
13476
+ *
13477
+ * The refusal is never thrown: a provider answering "no page for this device"
13478
+ * is an ordinary answer (`getAdminLink` → `null`), and a throw here would turn
13479
+ * a missing host on one device into a failed query for the whole surface.
13480
+ */
13481
+ function buildDeviceAdminUrl(parts) {
13482
+ const host = parts.host.trim();
13483
+ if (host.length === 0) return {
13484
+ ok: false,
13485
+ reason: "empty-host"
13486
+ };
13487
+ if (host.includes("@")) return {
13488
+ ok: false,
13489
+ reason: "host-carries-userinfo"
13490
+ };
13491
+ if (!PLAIN_HOST.test(host) && !IPV6_HOST.test(host)) return {
13492
+ ok: false,
13493
+ reason: "host-not-plain"
13494
+ };
13495
+ if (parts.port !== null) {
13496
+ if (!Number.isInteger(parts.port) || parts.port < 1 || parts.port > 65535) return {
13497
+ ok: false,
13498
+ reason: "port-out-of-range"
13499
+ };
13500
+ }
13501
+ if (!parts.path.startsWith("/")) return {
13502
+ ok: false,
13503
+ reason: "path-not-absolute"
13504
+ };
13505
+ const query = parts.query ?? {};
13506
+ for (const key of Object.keys(query)) if (CREDENTIAL_QUERY_KEYS.includes(key.toLowerCase())) return {
13507
+ ok: false,
13508
+ reason: "credential-query-key"
13509
+ };
13510
+ const authority = parts.port === null || parts.port === defaultPortFor(parts.scheme) ? host : `${host}:${String(parts.port)}`;
13511
+ const search = new URLSearchParams();
13512
+ for (const [key, value] of Object.entries(query)) search.append(key, value);
13513
+ const suffix = search.size > 0 ? `?${search.toString()}` : "";
13514
+ const url = `${parts.scheme}://${authority}${parts.path}${suffix}`;
13515
+ if (CREDENTIAL_URL.test(url)) return {
13516
+ ok: false,
13517
+ reason: "userinfo-in-result"
13518
+ };
13519
+ return {
13520
+ ok: true,
13521
+ url
13522
+ };
13523
+ }
13524
+ function parseAdminBase(baseUrl) {
13525
+ const raw = baseUrl.trim();
13526
+ if (raw.length === 0) return {
13527
+ ok: false,
13528
+ reason: "empty"
13529
+ };
13530
+ let parsed;
13531
+ try {
13532
+ parsed = new URL(raw);
13533
+ } catch {
13534
+ return {
13535
+ ok: false,
13536
+ reason: "unparseable"
13537
+ };
13538
+ }
13539
+ if (parsed.username !== "" || parsed.password !== "") return {
13540
+ ok: false,
13541
+ reason: "base-carries-userinfo"
13542
+ };
13543
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return {
13544
+ ok: false,
13545
+ reason: "scheme-not-http"
13546
+ };
13547
+ const scheme = parsed.protocol === "https:" ? "https" : "http";
13548
+ const port = parsed.port === "" ? null : Number(parsed.port);
13549
+ const basePath = parsed.pathname === "/" ? "" : parsed.pathname.replace(/\/+$/, "");
13550
+ return {
13551
+ ok: true,
13552
+ host: parsed.hostname,
13553
+ port,
13554
+ scheme,
13555
+ basePath
13556
+ };
13557
+ }
13558
+ /**
13384
13559
  * Identity envelope for a device's upstream-system metadata.
13385
13560
  *
13386
13561
  * Two jobs:
@@ -13877,244 +14052,6 @@ var deviceAdoptionCapability = {
13877
14052
  }
13878
14053
  };
13879
14054
  /**
13880
- * device-admin-link — "this device has a management page of its own, and here
13881
- * is its address".
13882
- *
13883
- * ## Why this is not a `deviceConfig` cap
13884
- *
13885
- * There is nothing to edit. A `deviceConfig` cap (D14) exists so the framework
13886
- * can DERIVE a settings form from `getOptions` + `getStatus` and route a flat
13887
- * patch back through a setter; it costs a `builderId` reducer in
13888
- * `device-config-contribution.ts` and a `*-config-schema.ts` beside it, and it
13889
- * renders a form section. This cap answers ONE question with ONE read and
13890
- * renders a button. Nothing about it is a form, so it carries no `deviceConfig`
13891
- * block, no `settings`, no `runtimeState` and no reducer — exactly like
13892
- * `reboot`, the other pure-RPC device-native cap.
13893
- *
13894
- * ## Absent, and the difference between "no page" and "we cannot say"
13895
- *
13896
- * The two are answered at DIFFERENT layers, on purpose:
13897
- *
13898
- * - **"We cannot say"** → the provider never registers the cap for that
13899
- * device. A VeSync humidifier, a Petkit feeder, a Dreame vacuum and a Dreo
13900
- * fan are reached only through a vendor cloud; there is no address to hand
13901
- * out and no page to open. A Tuya plug, a Wyze camera and a Gree air
13902
- * conditioner DO have a LAN IP, and still have no HTTP management page
13903
- * behind it. None of them register, so `deviceManager.getBindings` never
13904
- * lists the cap and no surface asks.
13905
- * - **"This device has no page, and I know that"** → the provider registers
13906
- * and `getAdminLink` returns `null`. This is the answer for a device whose
13907
- * sibling DOES have a page: a Reolink battery camera reached over UDP by
13908
- * `uid` with a blank `host`, an Ecowitt gateway configured in `listener`
13909
- * transport, a Home Assistant broker authenticated by supervisor token
13910
- * (which carries no `baseUrl` at all).
13911
- *
13912
- * Both draw NOTHING. A button that opens a browser error is worse than no
13913
- * button, and D62 is the same rule from the other side: an off switch is
13914
- * reported off, never made to look broken. There is no third state where the
13915
- * UI renders a disabled button "because the device might have a page".
13916
- *
13917
- * ## The URL never carries credentials
13918
- *
13919
- * Not in userinfo, not in a query string. Every provider builds through
13920
- * `buildDeviceAdminUrl` (`device-admin-link-url.ts`), which takes host, port,
13921
- * scheme and path as separate arguments — there is no parameter a secret could
13922
- * arrive in — and re-checks its own output for the `scheme://user:pass@` shape
13923
- * that `scripts/check-no-credential-urls-in-fixtures.ts` bans from recorded
13924
- * output. `scripts/check-admin-link-builder-is-the-only-url-source.ts` is what
13925
- * keeps providers from hand-rolling one anyway.
13926
- *
13927
- * This matters here more than anywhere else in the repo, because every provider
13928
- * that knows a device's host knows its PASSWORD too: `{ host, port, username,
13929
- * password }` sit in one object on Hikvision, Amcrest, Reolink and ONVIF alike,
13930
- * and `http://admin:hunter2@192.168.50.139/` is a URL a browser accepts. The
13931
- * camera's own page will ask for its own login. That is correct, and pre-
13932
- * filling it is the operator's business, not ours.
13933
- *
13934
- * ## It is a LAN fact
13935
- *
13936
- * The URL addresses the device where the NODE can see it. It is not proxied,
13937
- * not made reachable from outside, and not sent anywhere. A surface renders it
13938
- * as a link the operator's own browser follows, on the operator's own network,
13939
- * or renders nothing.
13940
- */
13941
- /**
13942
- * Whose page is it. The distinction is for the OPERATOR, who needs to know
13943
- * before clicking whether he is about to land on a camera's own web server or
13944
- * inside Home Assistant.
13945
- */
13946
- var AdminLinkTargetEnum = _enum(["device", "integration"]);
13947
- var DeviceAdminLinkSchema = object({
13948
- /**
13949
- * Absolute `http(s)://` URL. Built by `buildDeviceAdminUrl` and therefore
13950
- * free of userinfo and of any credential-shaped query key.
13951
- */
13952
- url: string(),
13953
- /**
13954
- * What the surface calls it — "Web UI", "Home Assistant", "UniFi controller".
13955
- * The PROVIDER names it, because only the provider knows what the page is;
13956
- * a UI that invented the label from the addon id would call the Home
13957
- * Assistant device page "Provider Homeassistant".
13958
- */
13959
- label: string(),
13960
- target: AdminLinkTargetEnum,
13961
- /**
13962
- * Host the URL points at, without scheme, port or path — for the tooltip, so
13963
- * an operator can see WHERE the button goes before he follows it. Redundant
13964
- * with `url` by construction; carried separately so no surface has to parse
13965
- * a URL to show it.
13966
- */
13967
- host: string()
13968
- });
13969
- var deviceAdminLinkCapability = {
13970
- name: "device-admin-link",
13971
- scope: "device",
13972
- deviceNative: true,
13973
- mode: "singleton",
13974
- methods: {
13975
- /**
13976
- * The device's management page, or `null` when this device has none.
13977
- *
13978
- * `auth: 'admin'` deliberately. This is administration, not actuation —
13979
- * the same bucket as `reboot` and `camera-credentials`, and explicitly NOT
13980
- * the actuation set `scripts/check-actuation-not-admin.ts` protects (D403).
13981
- * The URL is also a statement about the LAN, which a household member with
13982
- * a `view` grant on a light has no reason to be handed.
13983
- *
13984
- * The surfaces gate on the QUERY, never on a role they guessed: a caller
13985
- * without the right loses the query and draws nothing, which is the same
13986
- * thing a device with no page draws. There is no path on which a button
13987
- * appears and then fails — the D403 failure mode, from the other end.
13988
- */
13989
- getAdminLink: method(object({ deviceId: number().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" }) }
13990
- };
13991
- /**
13992
- * Query keys that may never appear on an admin link. A credential smuggled as
13993
- * `?password=` is the same leak as userinfo, in a form the userinfo check
13994
- * cannot see: it survives copy-paste, referrer headers and proxy logs
13995
- * identically.
13996
- */
13997
- var CREDENTIAL_QUERY_KEYS = [
13998
- "password",
13999
- "passwd",
14000
- "pwd",
14001
- "pass",
14002
- "user",
14003
- "username",
14004
- "usr",
14005
- "login",
14006
- "token",
14007
- "access_token",
14008
- "auth",
14009
- "authorization",
14010
- "apikey",
14011
- "api_key",
14012
- "secret",
14013
- "credential",
14014
- "credentials",
14015
- "session",
14016
- "sessionid",
14017
- "key"
14018
- ];
14019
- /**
14020
- * The same userinfo shape `scripts/check-no-credential-urls-in-fixtures.ts`
14021
- * scans recorded fixtures for, applied to what we are about to EMIT. Kept
14022
- * structurally identical on purpose: a URL this function returns is a URL that
14023
- * guard would pass.
14024
- */
14025
- var CREDENTIAL_URL = /[a-z][a-z0-9+.-]*:\/\/[^/\s:@'"]+:[^/\s:@'"]+@/i;
14026
- /** A host that is safe to place in an authority component verbatim. */
14027
- var PLAIN_HOST = /^[a-zA-Z0-9._-]+$/;
14028
- /** A bracketed IPv6 literal, the only other authority form we emit. */
14029
- var IPV6_HOST = /^\[[0-9a-fA-F:.]+\]$/;
14030
- function defaultPortFor(scheme) {
14031
- return scheme === "https" ? 443 : 80;
14032
- }
14033
- /**
14034
- * Build the admin-page URL, or refuse by name.
14035
- *
14036
- * The refusal is never thrown: a provider answering "no page for this device"
14037
- * is an ordinary answer (`getAdminLink` → `null`), and a throw here would turn
14038
- * a missing host on one device into a failed query for the whole surface.
14039
- */
14040
- function buildDeviceAdminUrl(parts) {
14041
- const host = parts.host.trim();
14042
- if (host.length === 0) return {
14043
- ok: false,
14044
- reason: "empty-host"
14045
- };
14046
- if (host.includes("@")) return {
14047
- ok: false,
14048
- reason: "host-carries-userinfo"
14049
- };
14050
- if (!PLAIN_HOST.test(host) && !IPV6_HOST.test(host)) return {
14051
- ok: false,
14052
- reason: "host-not-plain"
14053
- };
14054
- if (parts.port !== null) {
14055
- if (!Number.isInteger(parts.port) || parts.port < 1 || parts.port > 65535) return {
14056
- ok: false,
14057
- reason: "port-out-of-range"
14058
- };
14059
- }
14060
- if (!parts.path.startsWith("/")) return {
14061
- ok: false,
14062
- reason: "path-not-absolute"
14063
- };
14064
- const query = parts.query ?? {};
14065
- for (const key of Object.keys(query)) if (CREDENTIAL_QUERY_KEYS.includes(key.toLowerCase())) return {
14066
- ok: false,
14067
- reason: "credential-query-key"
14068
- };
14069
- const authority = parts.port === null || parts.port === defaultPortFor(parts.scheme) ? host : `${host}:${String(parts.port)}`;
14070
- const search = new URLSearchParams();
14071
- for (const [key, value] of Object.entries(query)) search.append(key, value);
14072
- const suffix = search.size > 0 ? `?${search.toString()}` : "";
14073
- const url = `${parts.scheme}://${authority}${parts.path}${suffix}`;
14074
- if (CREDENTIAL_URL.test(url)) return {
14075
- ok: false,
14076
- reason: "userinfo-in-result"
14077
- };
14078
- return {
14079
- ok: true,
14080
- url
14081
- };
14082
- }
14083
- function parseAdminBase(baseUrl) {
14084
- const raw = baseUrl.trim();
14085
- if (raw.length === 0) return {
14086
- ok: false,
14087
- reason: "empty"
14088
- };
14089
- let parsed;
14090
- try {
14091
- parsed = new URL(raw);
14092
- } catch {
14093
- return {
14094
- ok: false,
14095
- reason: "unparseable"
14096
- };
14097
- }
14098
- if (parsed.username !== "" || parsed.password !== "") return {
14099
- ok: false,
14100
- reason: "base-carries-userinfo"
14101
- };
14102
- if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return {
14103
- ok: false,
14104
- reason: "scheme-not-http"
14105
- };
14106
- const scheme = parsed.protocol === "https:" ? "https" : "http";
14107
- const port = parsed.port === "" ? null : Number(parsed.port);
14108
- const basePath = parsed.pathname === "/" ? "" : parsed.pathname.replace(/\/+$/, "");
14109
- return {
14110
- ok: true,
14111
- host: parsed.hostname,
14112
- port,
14113
- scheme,
14114
- basePath
14115
- };
14116
- }
14117
- /**
14118
14055
  * `device-export` — collection cap for addons that export camstack
14119
14056
  * devices to external ecosystems (HomeAssistant via MQTT discovery,
14120
14057
  * HomeKit/HAP, Alexa Smart Home, …).
@@ -17421,6 +17358,7 @@ sub("presence", "sensor", "sensor", "#22c55e", "presence", "Presence");
17421
17358
  sub("enum-sensor", "sensor", "sensor", TAXONOMY_COLORS.sensor, "generic", "Sensor state");
17422
17359
  sub("device-event", "sensor", "sensor", "#10b981", "button", "Device event");
17423
17360
  sub("lock", "control", "control", "#0ea5e9", "lock", "Lock");
17361
+ sub("cover", "control", "control", "#0ea5e9", "door", "Cover");
17424
17362
  sub("switch", "control", "control", TAXONOMY_COLORS.control, "switch", "Switch");
17425
17363
  sub("siren", "control", "control", "#dc2626", "siren", "Siren");
17426
17364
  sub("button", "control", "control", "#10b981", "button", "Button");
@@ -17739,6 +17677,10 @@ var NcSystemEventKindSchema = _enum([
17739
17677
  "alarm-disarmed",
17740
17678
  "alarm-arming",
17741
17679
  "alarm-arm-refused",
17680
+ "alarm-pending",
17681
+ "alarm-rearmed",
17682
+ "alarm-sensor-bypass",
17683
+ "alarm-check-failed",
17742
17684
  "addon-updated",
17743
17685
  "server-updated",
17744
17686
  "export-completed",
@@ -18334,6 +18276,19 @@ var NcMediaFrameSchema = _enum([
18334
18276
  "full",
18335
18277
  "boxed"
18336
18278
  ]);
18279
+ /**
18280
+ * How a SENSOR notification shows the cameras that link the sensor.
18281
+ *
18282
+ * `mosaic` — one image composed of every linked camera's photograph, taken at
18283
+ * the trigger. `each` — one image per camera where the target takes several
18284
+ * attachments; a target that takes one keeps the first camera's (the degrade
18285
+ * engine drops the rest by order). Either way ONE notification per event.
18286
+ * Absent = `mosaic`, applied by the Notification Center and deliberately NOT
18287
+ * a Zod default (see NcRulePatchSchema: a default materialises on every
18288
+ * partial patch). Meaningless for a rule whose subject is not a sensor, and a
18289
+ * sensor linked to one camera ships that camera's plain snapshot either way.
18290
+ */
18291
+ var NcLinkedCameraModeSchema = _enum(["mosaic", "each"]);
18337
18292
  var NcMediaPolicySchema = object({
18338
18293
  attach: _enum([
18339
18294
  "best",
@@ -18379,7 +18334,9 @@ var NcMediaPolicySchema = object({
18379
18334
  * A profile that is not assigned falls back to the cheapest, and the render
18380
18335
  * reports which one actually ran.
18381
18336
  */
18382
- profile: CamProfileSchema.optional()
18337
+ profile: CamProfileSchema.optional(),
18338
+ /** See {@link NcLinkedCameraModeSchema}. */
18339
+ linkedCameras: NcLinkedCameraModeSchema.optional()
18383
18340
  });
18384
18341
  /**
18385
18342
  * Cooldown GRANULARITY over the subject's class — how much a fired
@@ -18499,7 +18456,7 @@ var NcRuleInputSchema = object({
18499
18456
  cooldownSec: 60,
18500
18457
  scope: "rule-device"
18501
18458
  }),
18502
- /** `{{var}}` templating over camera/class/label/zones/confidence/time. */
18459
+ /** `{{var}}` title/body. The variables are declared in `NC_TEMPLATE_VARS` (@camstack/types) and depend on the rule kind — see `templateVarsFor`. */
18503
18460
  template: object({
18504
18461
  title: string().max(500).optional(),
18505
18462
  body: string().max(2e3).optional()
@@ -18679,6 +18636,22 @@ var NcRulePatchSchema = NcRuleInputSchema.partial().extend({
18679
18636
  throttle: NcThrottleSchema.optional(),
18680
18637
  priority: number().int().min(1).max(5).optional()
18681
18638
  });
18639
+ var NcRuleClearableKeySchema = _enum([
18640
+ "template",
18641
+ "schedule",
18642
+ "targetUsers",
18643
+ "snoozeOptions",
18644
+ "snoozeAllowGlobal",
18645
+ "waitForEnhancement",
18646
+ "actions",
18647
+ "confirm",
18648
+ "groupIdleSec"
18649
+ ]);
18650
+ var NcRuleUpdateInputSchema = object({
18651
+ ruleId: string(),
18652
+ patch: NcRulePatchSchema,
18653
+ clear: array(NcRuleClearableKeySchema).optional()
18654
+ });
18682
18655
  /** A persisted rule. */
18683
18656
  var NcRuleSchema = NcRuleInputSchema.extend({
18684
18657
  id: string(),
@@ -18710,6 +18683,85 @@ var NcTestResultSchema = object({
18710
18683
  className: string().optional(),
18711
18684
  label: string().optional()
18712
18685
  });
18686
+ /** The five rule kinds, as data. `NcRuleKind` in `notification/rule-kinds.ts`
18687
+ * is the same union; the template-vars spec pins the two together. */
18688
+ var NcRuleKindSchema = _enum([
18689
+ "detection",
18690
+ "sensor",
18691
+ "occupancy",
18692
+ "sound",
18693
+ "system"
18694
+ ]);
18695
+ /** Which producer renders a template: an ordinary rule, a timelapse, a digest. */
18696
+ var NcTemplateFamilySchema = _enum([
18697
+ "rule",
18698
+ "timelapse",
18699
+ "summary"
18700
+ ]);
18701
+ /** Which text field of that producer. `previewText` is the timelapse frame
18702
+ * caption, `captionText` the digest mosaic caption — both see fewer vars. */
18703
+ var NcTemplateFieldSchema = _enum([
18704
+ "title",
18705
+ "body",
18706
+ "previewText",
18707
+ "captionText"
18708
+ ]);
18709
+ var NcTemplateVarGroupSchema = _enum([
18710
+ "subject",
18711
+ "place",
18712
+ "time",
18713
+ "rule",
18714
+ "occupancy",
18715
+ "sound",
18716
+ "sensor",
18717
+ "system",
18718
+ "digest",
18719
+ "ai"
18720
+ ]);
18721
+ /**
18722
+ * ONE `{{var}}` a notification template may name.
18723
+ *
18724
+ * `families` / `fields` / `kinds` / `deliveries` / `systemEventKinds` say WHERE
18725
+ * it has a value; absent = no restriction on that axis. `systemEventKinds` is
18726
+ * read only for a `system` rule. `dynamic` declares a FAMILY of names
18727
+ * (`count_<class>`): the descriptor's `name` is the example member.
18728
+ */
18729
+ var NcTemplateVarDescriptorSchema = object({
18730
+ name: string().regex(/^\w+$/),
18731
+ label: string(),
18732
+ description: string().optional(),
18733
+ example: string(),
18734
+ group: NcTemplateVarGroupSchema,
18735
+ families: array(NcTemplateFamilySchema).min(1),
18736
+ fields: array(NcTemplateFieldSchema).optional(),
18737
+ kinds: array(NcRuleKindSchema).optional(),
18738
+ deliveries: array(NcDeliverySchema).optional(),
18739
+ systemEventKinds: array(NcSystemEventKindSchema).optional(),
18740
+ dynamic: object({
18741
+ prefix: literal("count_"),
18742
+ from: literal("classes")
18743
+ }).optional()
18744
+ });
18745
+ /** Input to `previewTemplate` — the editor's own context, plus the draft text. */
18746
+ var NcTemplatePreviewInputSchema = object({
18747
+ context: object({
18748
+ family: NcTemplateFamilySchema,
18749
+ field: NcTemplateFieldSchema,
18750
+ kind: NcRuleKindSchema.optional(),
18751
+ delivery: NcDeliverySchema.optional(),
18752
+ systemEventKinds: array(NcSystemEventKindSchema).optional()
18753
+ }),
18754
+ template: object({
18755
+ title: string().max(500).optional(),
18756
+ body: string().max(2e3).optional()
18757
+ })
18758
+ });
18759
+ var NcTemplatePreviewSchema = object({
18760
+ title: string().nullable(),
18761
+ body: string().nullable(),
18762
+ /** Names the template uses that this context never fills — they render empty. */
18763
+ unknown: array(string())
18764
+ });
18713
18765
  var NcConditionDescriptorSchema = object({
18714
18766
  /** Field id inside `NcConditions` (or `'schedule'` for the rule-level group). */
18715
18767
  id: string(),
@@ -18975,8 +19027,17 @@ object({
18975
19027
  lastAt: number()
18976
19028
  });
18977
19029
  /**
18978
- * The three durations the panel's state machine runs on, plus who hears about
18979
- * an arm.
19030
+ * The per-mode lists, at most one per mode. Two lists for one mode have no
19031
+ * meaning a reader could agree on (union? the last one?), so they are refused
19032
+ * at the boundary rather than interpreted.
19033
+ */
19034
+ var NcAlarmNonBlockingListSchema = array(object({
19035
+ mode: AlarmArmModeSchema,
19036
+ deviceIds: array(number().int()).max(200)
19037
+ })).max(8).refine((lists) => new Set(lists.map((l) => l.mode)).size === lists.length, { message: "nonBlocking: at most one list per arm mode" });
19038
+ /**
19039
+ * The three durations the panel's state machine runs on, who hears about its
19040
+ * transitions, and which openings each mode tolerates.
18980
19041
  *
18981
19042
  * They live on the NOTIFICATION-RULES cap, not on `alarm-panel`, on purpose:
18982
19043
  * `alarm-panel` is `deviceNative` and its other provider mirrors somebody
@@ -18995,21 +19056,39 @@ var NcAlarmSettingsSchema = object({
18995
19056
  * existed, and therefore what an untouched install keeps doing.
18996
19057
  */
18997
19058
  triggeredDurationSec: number().int().min(0).max(3600),
18998
- /** Send a notification when a mode takes effect. */
18999
- announceArm: boolean(),
19000
19059
  /**
19001
- * Where that notification goes. Target ids from `notification-output`.
19060
+ * Deprecated by D630 — every transition is announced. Parsed, never read;
19061
+ * remove after one release. Optional so an older admin's patch (which still
19062
+ * sends it) parses rather than failing the whole save.
19063
+ */
19064
+ announceArm: boolean().optional(),
19065
+ /**
19066
+ * Target ids from `notification-output`: every alarm transition goes here.
19002
19067
  *
19003
- * Explicit rather than "everyone": an arm announcement is a household
19068
+ * Explicit rather than "everyone": an alarm announcement is a household
19004
19069
  * message, and broadcasting it to every configured endpoint (including a
19005
19070
  * webhook wired to something else) is not a default anybody would choose.
19006
- * Empty with `announceArm: true` sends nothing, and the server logs that —
19007
- * silence must be attributable.
19071
+ * Empty sends nothing, and the server logs that — silence must be
19072
+ * attributable.
19008
19073
  */
19009
- announceTargets: array(string().min(1)).max(16)
19074
+ announceTargets: array(string().min(1)).max(16),
19075
+ /**
19076
+ * Per arm mode, the covered devices whose being OPEN does not refuse the
19077
+ * arm (a window left ajar for the cat under `home`, say). At most one entry
19078
+ * per mode is meaningful. Defaulted to `[]` so a blob stored before D630
19079
+ * parses as "every opening blocks" — the behaviour it was written under.
19080
+ */
19081
+ nonBlocking: NcAlarmNonBlockingListSchema.default([])
19010
19082
  });
19011
- /** Every field optional — a tab edits one control at a time. */
19012
- var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.partial();
19083
+ /**
19084
+ * Every field optional — a tab edits one control at a time.
19085
+ *
19086
+ * `nonBlocking` is re-declared WITHOUT its default: `.partial()` does not
19087
+ * remove an inner `.default()`, so a patch that never named the field would
19088
+ * parse to `nonBlocking: []` and wipe every mode's list on an unrelated edit
19089
+ * (the same trap {@link NcRulePatchSchema} documents).
19090
+ */
19091
+ var NcAlarmSettingsPatchSchema = NcAlarmSettingsSchema.extend({ nonBlocking: NcAlarmNonBlockingListSchema }).partial();
19013
19092
  /**
19014
19093
  * What one arm mode actually arms, DERIVED from the enabled rules gated on it.
19015
19094
  * Never authored, never stored — see `alarm-mode-coverage.ts` for why a stored
@@ -19054,6 +19133,36 @@ var NcAlarmModeCoverageSchema = object({
19054
19133
  */
19055
19134
  skippedDevices: array(NcAlarmSkippedDeviceSchema).default([])
19056
19135
  });
19136
+ /** One covered device that reads open, and whether that refuses the arm. */
19137
+ var NcAlarmOpeningSchema = object({
19138
+ deviceId: number().int(),
19139
+ name: string(),
19140
+ /** The device's state word as read (`open`, `unlocked`, …). */
19141
+ state: string(),
19142
+ /** False when the mode's non-blocking list names this device. */
19143
+ blocking: boolean()
19144
+ });
19145
+ /** A device the panel is currently ignoring, and which side of it it is on. */
19146
+ var NcAlarmExclusionViewSchema = object({
19147
+ deviceId: number().int(),
19148
+ name: string(),
19149
+ phase: _enum(["open", "closed"])
19150
+ });
19151
+ /** One mode's openings: devices read open, plus those whose state is unknown. */
19152
+ var NcAlarmModeOpeningsSchema = object({
19153
+ mode: AlarmArmModeSchema,
19154
+ devices: array(NcAlarmOpeningSchema),
19155
+ /** Covered devices whose state could not be read (D49): neither open nor closed. */
19156
+ unknown: array(number().int())
19157
+ });
19158
+ var NcAlarmLiveSchema = object({
19159
+ state: AlarmStateSchema,
19160
+ /** The mode being armed into (exit delay) or held; null when disarmed. */
19161
+ targetMode: AlarmArmModeSchema.nullable(),
19162
+ availableModes: array(AlarmArmModeSchema),
19163
+ openings: array(NcAlarmModeOpeningsSchema),
19164
+ exclusions: array(NcAlarmExclusionViewSchema)
19165
+ });
19057
19166
  var NcAlarmConfigSchema = object({
19058
19167
  /**
19059
19168
  * The panel's device id, or null when this install has no panel (the ensure
@@ -19063,7 +19172,13 @@ var NcAlarmConfigSchema = object({
19063
19172
  */
19064
19173
  deviceId: number().int().nullable(),
19065
19174
  settings: NcAlarmSettingsSchema,
19066
- coverage: array(NcAlarmModeCoverageSchema)
19175
+ coverage: array(NcAlarmModeCoverageSchema),
19176
+ /**
19177
+ * The panel as it is NOW — state, what each mode would find open, what is
19178
+ * excluded. Optional: a panel-less hub answers without it, and a client
19179
+ * must not read its absence as "nothing is open".
19180
+ */
19181
+ live: NcAlarmLiveSchema.optional()
19067
19182
  });
19068
19183
  /**
19069
19184
  * ONE rule's demand on ONE camera's clip ring.
@@ -19111,10 +19226,7 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
19111
19226
  kind: "mutation",
19112
19227
  auth: "admin",
19113
19228
  caller: "required"
19114
- }), method(object({
19115
- ruleId: string(),
19116
- patch: NcRulePatchSchema
19117
- }), object({ rule: NcRuleSchema }), {
19229
+ }), method(NcRuleUpdateInputSchema, object({ rule: NcRuleSchema }), {
19118
19230
  kind: "mutation",
19119
19231
  auth: "admin",
19120
19232
  caller: "required"
@@ -19142,7 +19254,10 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
19142
19254
  }), method(object({}), object({
19143
19255
  catalog: array(NcConditionDescriptorSchema),
19144
19256
  taxonomy: NcTaxonomySchema.optional()
19145
- })), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
19257
+ })), method(object({}), object({ vars: array(NcTemplateVarDescriptorSchema) })), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
19258
+ kind: "mutation",
19259
+ access: "view"
19260
+ }), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
19146
19261
  kind: "mutation",
19147
19262
  caller: "required"
19148
19263
  }), method(object({ snoozeId: string() }), object({ success: literal(true) }), {
@@ -23631,6 +23746,7 @@ var CAP_TO_KIND = {
23631
23746
  "enum-sensor": "enum-sensor",
23632
23747
  "event-emitter": "device-event",
23633
23748
  "lock-control": "lock",
23749
+ cover: "cover",
23634
23750
  switch: "switch",
23635
23751
  button: "button",
23636
23752
  doorbell: "doorbell"
@@ -24448,6 +24564,87 @@ method(_void(), ProviderInfoSchema, { auth: "admin" }), method(object({ config:
24448
24564
  kind: "mutation",
24449
24565
  auth: "admin"
24450
24566
  });
24567
+ /**
24568
+ * The signals a device can emit to WAKE its own stream.
24569
+ *
24570
+ * A camera whose stream is built on demand sleeps until something asks for it,
24571
+ * and "something" cannot be a consumer that is merely attached — a Frigate-style
24572
+ * puller holds a session open for ever, and treating that as demand would keep
24573
+ * a battery camera awake for ever, which is the whole thing the battery is for
24574
+ * (D173). So the wake has to come from the CAMERA: an event it noticed by
24575
+ * itself, with no stream running.
24576
+ *
24577
+ * ## The vocabulary is the PROVIDER'S, not ours
24578
+ *
24579
+ * Like `consumables`, this cap declares no vocabulary of its own. A provider
24580
+ * names each signal with a `code` it chooses and a `label` an operator reads.
24581
+ * Reolink offers motion and camera-native detection; another provider may offer
24582
+ * a tamper, a doorbell press, a PIR, or something no camera in this fleet has
24583
+ * yet. A fixed enum here would mean every new signal is a framework release.
24584
+ *
24585
+ * It is deliberately NOT derived from the caps a device already binds. Whether
24586
+ * a camera CAN push firmware motion is expressed by `motionSources` containing
24587
+ * `'onboard'`, and whether it does AI on-camera by the `native-object-detection`
24588
+ * binding — but both answer "what drives the detection pipeline", which is a
24589
+ * different question from "what may wake a sleeping stream". A camera can do
24590
+ * the first and not be trusted with the second, and the operator picks per
24591
+ * camera. Two questions, two authorities.
24592
+ *
24593
+ * ## Availability is not permission
24594
+ *
24595
+ * `listSignals` says what the device CAN emit. Whether a given signal actually
24596
+ * wakes the stream is the operator's per-camera choice, held by the broker
24597
+ * alongside the cooldown — see the stream-broker cap's wake settings. A
24598
+ * provider declaring a signal is not a provider enabling it.
24599
+ */
24600
+ /** One signal a device can emit. */
24601
+ var StreamSignalSchema = object({
24602
+ /** Stable id chosen by the provider, e.g. `'motion'`, `'person'`, `'tamper'`. */
24603
+ code: string().min(1),
24604
+ /** What an operator reads in the picker. The provider's own wording. */
24605
+ label: string().min(1),
24606
+ /**
24607
+ * Whether the provider recommends this signal ON when a camera is first set
24608
+ * up. A provider knows which of its signals are cheap and reliable; an
24609
+ * operator should not have to discover that by trial. Reolink recommends
24610
+ * both of its own.
24611
+ */
24612
+ recommended: boolean()
24613
+ });
24614
+ var StreamSignalsStatusSchema = object({
24615
+ signals: array(StreamSignalSchema),
24616
+ lastFetchedAt: number()
24617
+ });
24618
+ var streamSignalsCapability = {
24619
+ name: "stream-signals",
24620
+ scope: "device",
24621
+ deviceNative: true,
24622
+ mode: "singleton",
24623
+ deviceTypes: Object.values(DeviceType),
24624
+ runtimeState: StreamSignalsStatusSchema,
24625
+ /**
24626
+ * Runtime-state durability: **session** — mirrored in RAM, never written.
24627
+ *
24628
+ * The slice holds what the DEVICE says it can emit. That is a probed fact,
24629
+ * not an operator choice: the provider re-declares it on every registration,
24630
+ * so losing it loses nothing and persisting it would freeze an answer the
24631
+ * camera is entitled to change. Measured the same day on the sibling case —
24632
+ * `native-object-detection.supportedClasses` was persisted, and a firmware
24633
+ * class the camera really detected stayed missing for the life of the row
24634
+ * because the fix could not reach it.
24635
+ *
24636
+ * See `RuntimeStateDurability`. Enforced by
24637
+ * `scripts/check-runtime-state-durability.ts`.
24638
+ */
24639
+ durability: "session",
24640
+ methods: {
24641
+ /**
24642
+ * What this device can emit. Empty is a valid and common answer — most
24643
+ * cameras have nothing to offer here, and an empty list is what makes the
24644
+ * broker's picker show nothing rather than a false choice.
24645
+ */
24646
+ listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
24647
+ };
24451
24648
  /** Profile-exported FormBuilder schema. Shape is ConfigUISchema at the UI. */
24452
24649
  var ProfileSettingsSchemaBridge = unknown().nullable();
24453
24650
  var ProfileSettingsBagSchema = record(string(), unknown());
@@ -25020,6 +25217,7 @@ _enum([
25020
25217
  "sleeping",
25021
25218
  "camera-refused",
25022
25219
  "no-keyframe",
25220
+ "decode-failed",
25023
25221
  "no-catalog-row",
25024
25222
  "unsupported",
25025
25223
  "unknown-device",
@@ -25294,6 +25492,32 @@ var ClipBytesSchema = object({
25294
25492
  durationMs: number().positive().optional()
25295
25493
  });
25296
25494
  /**
25495
+ * Where a clip's finished bytes can be TAKEN (D613) — the answer to
25496
+ * {@link videoclipsCapability.methods.offerClipBytes}.
25497
+ *
25498
+ * Everything {@link ClipBytesSchema} carries except the bytes themselves, plus
25499
+ * the one-shot ticket that leads to them. The metadata is answered BEFORE the
25500
+ * transfer on purpose: a consumer learns which twin it got, what to call the
25501
+ * file and how long the clip runs without having to read a byte, so a decision
25502
+ * it would make on that metadata (a wrong twin, an implausible duration) costs
25503
+ * no transfer at all.
25504
+ */
25505
+ var ClipBytesOfferSchema = object({
25506
+ /**
25507
+ * One shot, seconds-long, loopback, on the PROVIDER's own host. Open it with
25508
+ * `ctx.peerBytes.open(...)`, which refuses a ticket from another node by
25509
+ * name rather than dialling a port that means something else here.
25510
+ */
25511
+ ticket: PeerBytesTicketSchema,
25512
+ contentType: string(),
25513
+ /** Suggested filename, extension included. */
25514
+ name: string(),
25515
+ /** Which twin was actually served — see {@link ClipBytesSchema.served}. */
25516
+ served: CamProfileSchema,
25517
+ /** See {@link ClipBytesSchema.durationMs}. Absent when nothing measured it. */
25518
+ durationMs: number().positive().optional()
25519
+ });
25520
+ /**
25297
25521
  * Where a clip's STREAM can be dialled (D597) — the answer to
25298
25522
  * {@link videoclipsCapability.methods.dialClipStream}.
25299
25523
  *
@@ -25369,6 +25593,44 @@ var ClipStreamDialSchema = object({
25369
25593
  /** Why `servedAudio` is `none` although sound was asked for. */
25370
25594
  audioReason: ClipStreamAudioReasonSchema.optional()
25371
25595
  });
25596
+ /**
25597
+ * What a surface may DRAW for this provider's clips — the answer to
25598
+ * {@link videoclipsCapability.methods.getPlaybackOptions} (D612).
25599
+ *
25600
+ * The envelope is a PROVIDER fact, not a clip fact, and that is measured, not
25601
+ * assumed: the broker's `chooseClipPath` reads exactly two inputs — whether
25602
+ * `dialClipStream` and `readClipBytes` are wired — and both are constants of
25603
+ * the broker's own closure over the provider's methods. The `profile` it is
25604
+ * handed is explicitly not read. So every clip of a provider is served the
25605
+ * same way, and a per-clip channel carried a value that could not vary. The
25606
+ * per-clip `clipTransport` server message was removed for exactly that reason.
25607
+ *
25608
+ * Queried per camera, before a clip is picked, so a control is rendered or
25609
+ * DISABLED rather than offered and refused at play time (D62: a disabled
25610
+ * control reads as unavailable, one that undoes the gesture reads as broken).
25611
+ */
25612
+ var ClipPlaybackOptionsSchema = object({
25613
+ /**
25614
+ * How this provider's clips reach the player. `stream` is the provider's
25615
+ * forward-only fMP4 (D597); `file` is one bounded by-handle fetch of the
25616
+ * whole clip, `stbl` indexed (D575).
25617
+ */
25618
+ transport: _enum(["stream", "file"]),
25619
+ /** `forward` = only ahead of the playhead. `free` = anywhere. */
25620
+ seek: _enum(["forward", "free"]),
25621
+ /** Frame-step BACKWARD is meaningful. Forward always is. */
25622
+ stepBack: boolean(),
25623
+ /** Whether the scrub gesture is served, as opposed to refused by name. */
25624
+ scrub: boolean(),
25625
+ /**
25626
+ * The rates that can be delivered, ascending, always containing `1`. The
25627
+ * viewer draws its picker from this and from nothing else — a constant it
25628
+ * keeps instead is the second authority that produced the defect: `8` and
25629
+ * `16` were offered, the broker clamped them to `4`, and no line anywhere
25630
+ * said so. `0` is not a member: pause is the absence of a rate.
25631
+ */
25632
+ rates: array(number().positive()).min(1).readonly()
25633
+ });
25372
25634
  var ClipSourceAvailabilitySchema = object({
25373
25635
  state: _enum([
25374
25636
  "ok",
@@ -25528,6 +25790,29 @@ DeviceType.Camera, method(object({
25528
25790
  }), ClipBytesSchema, {
25529
25791
  kind: "query",
25530
25792
  auth: "protected"
25793
+ }), optionalMethod(object({
25794
+ deviceId: number(),
25795
+ clipId: string().min(1),
25796
+ /** WHICH provider holds the bytes — see `readClipBytes.provider`. */
25797
+ provider: string().min(1),
25798
+ /** Which twin — `low | mid` → the sub file, `high` → the main twin. */
25799
+ profile: CamProfileSchema.optional(),
25800
+ /**
25801
+ * The CALLER's byte bound, so an over-size clip is refused before the
25802
+ * camera is touched rather than after. Capped by
25803
+ * {@link VIDEOCLIPS_MAX_OFFER_BYTES} whatever is passed; absent means
25804
+ * that ceiling.
25805
+ */
25806
+ maxBytes: number().int().positive().optional(),
25807
+ /**
25808
+ * The operator's authorisation to wake a sleeping camera for this
25809
+ * read. Absent — the default — means a sleeping standalone battery
25810
+ * camera is REFUSED by name, before any session is opened.
25811
+ */
25812
+ wake: ClipWakeSchema.optional()
25813
+ }), ClipBytesOfferSchema, {
25814
+ kind: "query",
25815
+ auth: "protected"
25531
25816
  }), optionalMethod(object({
25532
25817
  deviceId: number(),
25533
25818
  clipId: string().min(1),
@@ -25549,6 +25834,15 @@ DeviceType.Camera, method(object({
25549
25834
  }), ClipStreamDialSchema, {
25550
25835
  kind: "query",
25551
25836
  auth: "protected"
25837
+ }), optionalMethod(object({
25838
+ deviceId: number(),
25839
+ /** WHICH provider to ask — the `addonId` a {@link ClipSourceSchema}
25840
+ * row carries. Required for the same reason `listClips` requires it:
25841
+ * a collection cap has no "the bound one" to resolve to (D554). */
25842
+ provider: string().min(1)
25843
+ }), ClipPlaybackOptionsSchema, {
25844
+ kind: "query",
25845
+ auth: "protected"
25552
25846
  });
25553
25847
  /**
25554
25848
  * Optional client-side hints sent at session creation to help the provider
@@ -26998,6 +27292,143 @@ DeviceType.Camera, method(object({ deviceId: number() }), CameraCredentialsSchem
26998
27292
  auth: "admin"
26999
27293
  });
27000
27294
  /**
27295
+ * camera-grid-layout — the geometry of a COMPOSITE camera, on the camera's own
27296
+ * page.
27297
+ *
27298
+ * ## Why this is a capability and not an addon settings schema
27299
+ *
27300
+ * It was one, and it did not render. The addon declared the editor as a
27301
+ * `type: 'widget'` field inside its own `deviceSettingsSchema()`; the hub
27302
+ * returned that section correctly and `ConfigFormField` renders `type:'widget'`
27303
+ * perfectly well — and nothing ever asked camera-grid for it. The Cluster →
27304
+ * Pipeline → Device Overrides page interrogates a HAND-WRITTEN list of four
27305
+ * addons (`PIPELINE_CLUSTER_DEVICE_ADDONS`), whose own comment says an addon
27306
+ * not on it "falls off silently".
27307
+ *
27308
+ * Adding a fifth name to that list would have been the wrong fix twice over:
27309
+ * that page is per-camera DETECTION tuning, and a grid's geometry belongs
27310
+ * beside PTZ and motion zones on the camera itself. The device page is
27311
+ * BINDING-driven (D12), so the way in is a capability bound to the device —
27312
+ * and this cap carries its section the way `recording` does, by RETURNING it
27313
+ * from `getDeviceSettingsContribution`.
27314
+ *
27315
+ * Seven other widgets are still declared the other way, through a
27316
+ * `deviceConfig.ui` block the framework derives a section from. That route
27317
+ * gives the addon no say in where its own panel lands and no way to decline
27318
+ * for a device the panel does not suit, which is why this one does not use it.
27319
+ *
27320
+ * ## Why one addon may implement it
27321
+ *
27322
+ * It is a device-scoped NATIVE cap, registered by the grid camera device
27323
+ * itself. Nothing else declares a composite camera, so nothing else has a
27324
+ * layout — and the device-scoped route means the widget asks THE camera, not
27325
+ * "the camera-grid addon", which is what let the old custom-action pair be
27326
+ * reached only by a caller that already knew the addon id.
27327
+ *
27328
+ * ## The tab
27329
+ *
27330
+ * `streaming`, not a top-tab of its own. A grid's geometry IS what its stream
27331
+ * is, so the Streaming tab is where it belongs; a `grid` top-tab would need an
27332
+ * entry in `WELL_KNOWN_TAB_MAP` or the device page renders the raw id as the
27333
+ * label (measured on the robot camera, 2026-09-06 — a tab called "navigation"
27334
+ * next to "PTZ").
27335
+ */
27336
+ /** A rectangle in normalized [0,1] coordinates of whatever contains it. */
27337
+ var GridNormalizedRectSchema = object({
27338
+ x: number().min(0).max(1),
27339
+ y: number().min(0).max(1),
27340
+ width: number().gt(0).max(1),
27341
+ height: number().gt(0).max(1)
27342
+ });
27343
+ /**
27344
+ * One source camera, the part of its picture taken, and where that part lands.
27345
+ *
27346
+ * Both rectangles are NORMALIZED (D519): a source camera can change resolution
27347
+ * — a profile switch, a firmware update, a substream that comes back different
27348
+ * — and a stored PIXEL rectangle would quietly start cutting the wrong region,
27349
+ * which is the class of bug nobody files.
27350
+ */
27351
+ var GridLayoutCellSchema = object({
27352
+ deviceId: number().int().positive(),
27353
+ /** The part of the SOURCE taken, normalized against the source. */
27354
+ source: GridNormalizedRectSchema,
27355
+ /** Where it lands, normalized against the CANVAS. */
27356
+ cell: GridNormalizedRectSchema
27357
+ });
27358
+ /**
27359
+ * Which profiles this grid can actually compose, and why not.
27360
+ *
27361
+ * A grid's `high` composes its sources' `high` and its `low` their `low`, so a
27362
+ * profile is on offer only when EVERY source can serve it. The refusal NAMES
27363
+ * the sources, because "this grid has no low" is not a finding — "615 has no
27364
+ * low" is, and it is the one an operator can act on.
27365
+ */
27366
+ var GridProfileOfferSchema = object({
27367
+ profile: _enum([
27368
+ "high",
27369
+ "mid",
27370
+ "low"
27371
+ ]),
27372
+ offered: boolean(),
27373
+ /** Sources that cannot serve it. Empty when it is offered, or when there are no cells. */
27374
+ missingSources: array(number().int().positive()),
27375
+ /**
27376
+ * The canvas this profile composes onto, `WxH`, or empty when it is not
27377
+ * offered. DERIVED from the cells and the sources' own size at this profile —
27378
+ * it is reported because nothing else in the system would ever say what the
27379
+ * grid came out as, and because it is the number an operator would otherwise
27380
+ * expect to type.
27381
+ */
27382
+ canvas: string(),
27383
+ /**
27384
+ * Whether this profile is PUBLISHED, of the ones the grid could serve.
27385
+ *
27386
+ * A grid's `high` is composed of its sources' `high`, so on a 4K fleet it is
27387
+ * a 4K canvas built from 4K decodes — something to opt into, not something a
27388
+ * viewer's adaptive should be handed by climbing to the top rung it can see.
27389
+ * Default is `mid` + `low`.
27390
+ */
27391
+ published: boolean()
27392
+ });
27393
+ var GridLayoutViewSchema = object({
27394
+ /** The persisted grid row this camera was declared from. */
27395
+ instanceId: string(),
27396
+ deviceId: number().int().nonnegative(),
27397
+ name: string(),
27398
+ /**
27399
+ * NO canvas size. A grid's resolution is not authored: each profile derives
27400
+ * its own from the cells and its sources' dimensions. The two numbers that
27401
+ * used to be here were a text field that silently decided both how much the
27402
+ * composite cost and how sharp it was — see `profiles[].canvas` for what it
27403
+ * came out as.
27404
+ */
27405
+ fps: number().int(),
27406
+ cells: array(GridLayoutCellSchema),
27407
+ /** What the catalog will publish, and what it refuses to. Read-only. */
27408
+ profiles: array(GridProfileOfferSchema)
27409
+ });
27410
+ var GridLayoutPatchSchema = object({
27411
+ deviceId: number().int().nonnegative(),
27412
+ name: string().min(1).max(160).optional(),
27413
+ fps: number().int().min(1).max(60).optional(),
27414
+ /** Which profiles to publish. See `GridProfileOffer.published`. */
27415
+ publishedProfiles: array(_enum([
27416
+ "high",
27417
+ "mid",
27418
+ "low"
27419
+ ])).max(3).optional(),
27420
+ /**
27421
+ * The whole cell list at once. A per-cell patch would need an ordering the
27422
+ * editor does not have, and a half-applied layout is a picture nobody asked
27423
+ * for.
27424
+ */
27425
+ cells: array(GridLayoutCellSchema).max(16)
27426
+ });
27427
+ DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), GridLayoutViewSchema.nullable(), { auth: "admin" }), method(GridLayoutPatchSchema, GridLayoutViewSchema, {
27428
+ kind: "mutation",
27429
+ auth: "admin"
27430
+ });
27431
+ /**
27001
27432
  * Carbon-monoxide alarm sensor. Drives Home Assistant `binary_sensor`
27002
27433
  * entries with `device_class: carbon_monoxide`. Push-driven.
27003
27434
  */
@@ -27800,346 +28231,6 @@ var dayNightCapability = {
27800
28231
  volatileStateFields: ["lastFetchedAt"]
27801
28232
  };
27802
28233
  /**
27803
- * Vendor-neutral **onboard** recording + storage cap — what the CAMERA
27804
- * writes to the CAMERA's own card, on the camera's own schedule.
27805
- *
27806
- * This is NOT `recording.cap.ts`. That one is CamStack's recorder: our
27807
- * footage ledger, our storage locations, our retention. This one has a
27808
- * different authority — the camera's firmware — and per D62 it stores
27809
- * nothing of its own. Every value here is read from the camera and every
27810
- * write goes back to the camera; there is no CamStack-side mirror that
27811
- * could disagree with the device.
27812
- *
27813
- * ## One shape, two firmwares
27814
- *
27815
- * Measured 2026-09-22 against the live fleet:
27816
- *
27817
- * | fact | Hikvision (ISAPI) | Reolink (Baichuan) |
27818
- * | --- | --- | --- |
27819
- * | storage | `ContentMgmt/Storage` `<hdd>` rows: status, capacity, freeSpace (MB) | `getHddInfoList` (cmd 102): `mount`, `format`, `capacity` GB + `capacityM` MB remainder |
27820
- * | tracks | several (101 **and** 103 on both 1436 and 3833), each with its own schedule | one per channel |
27821
- * | schedule | per track, 7 `ScheduleAction` blocks: DayOfWeek + TimeOfDay range + ONE `ActionRecordingMode` | per trigger type, a 168-char weekly HOUR mask |
27822
- * | triggers | `CMR`, `MOTION` | `Normal`, `MD`, `people`, `vehicle`, `dog_cat`, `crossline`, `intrude`, `loitering` |
27823
- * | pre-record | `PreRecordTimeSeconds` | `preRecordTime` |
27824
- * | post-record | `PostRecordTimeSeconds` | `recordDelayTime` |
27825
- * | overwrite | per track `LoopEnable` | `cycle`, with `cycleList` enumerating the accepted values |
27826
- * | segment length | not exposed on V5.7.1 | `packageTime` (minutes) |
27827
- *
27828
- * The two schedule models look different and are the same thing in
27829
- * different coordinates: both answer "for this trigger, during which
27830
- * weekly windows does the camera record". {@link RecordWindow} is that
27831
- * question in one shape — Hikvision's ranges map straight onto it,
27832
- * Reolink's mask expands into hour-aligned windows.
27833
- *
27834
- * ## Union, not intersection
27835
- *
27836
- * **The same fields exist on every camera.** What differs per device is
27837
- * which VALUES that device accepts, and that is what {@link
27838
- * RecordingOnboardOptions} reports — a `{ readable, writable, reason }`
27839
- * per field plus the schedule's own limits. A control a camera cannot
27840
- * honour is rendered DISABLED WITH ITS REASON, never missing and never
27841
- * dead: disabled must not look like broken.
27842
- *
27843
- * ## Refusal by name
27844
- *
27845
- * A write a camera cannot honour is refused with a sentence the operator
27846
- * can read — never accepted and dropped. Both providers refuse through
27847
- * {@link describeOnboardRefusal}, so the vocabulary is one function and
27848
- * one test, not two hand-written vendor opinions.
27849
- *
27850
- * Follows the D14 `deviceConfig` archetype (see `stream-params.cap.ts`):
27851
- * `getOptions` advertises per-camera availability, `getStatus` (auto-
27852
- * injected from `status`) reports the live values, and a single
27853
- * `setSettings` mutation applies a partial change. No hand-written
27854
- * settings-contribution methods.
27855
- */
27856
- /**
27857
- * What makes the camera start recording during a window.
27858
- *
27859
- * The union of both vendors' vocabularies. `continuous` is Hikvision's
27860
- * `CMR` and Reolink's `Normal`; `motion` is `MOTION` / `MD`. The
27861
- * object-class triggers are Reolink-only today and the smart-event ones
27862
- * (`lineCrossing`, `intrusion`, `loitering`) are Reolink-only on the
27863
- * firmwares measured — a camera that cannot record on a trigger simply
27864
- * does not list it in `options.schedule.triggers`, and a window naming
27865
- * it is REFUSED, not dropped.
27866
- */
27867
- var RecordTriggerSchema = _enum([
27868
- "continuous",
27869
- "motion",
27870
- "person",
27871
- "vehicle",
27872
- "animal",
27873
- "lineCrossing",
27874
- "intrusion",
27875
- "loitering",
27876
- "alarmInput"
27877
- ]);
27878
- /**
27879
- * One weekly recording window: "on `day`, from `startMinute` to
27880
- * `endMinute`, record on `trigger`".
27881
- *
27882
- * `day` is 0 = Monday … 6 = Sunday (ISO order, which is also the order
27883
- * both firmwares enumerate). Minutes are local camera time since
27884
- * midnight; `endMinute` may be 1440, meaning end of day — that is
27885
- * Hikvision's literal `24:00` and Reolink's 24th mask slot, and
27886
- * collapsing it to 0 would turn a whole-day window into an empty one.
27887
- */
27888
- var RecordWindowSchema = object({
27889
- trigger: RecordTriggerSchema,
27890
- day: number().int().min(0).max(6),
27891
- startMinute: number().int().min(0).max(1439),
27892
- endMinute: number().int().min(1).max(1440)
27893
- });
27894
- /** Status of one physical volume, as the camera itself describes it. */
27895
- var OnboardStorageVolumeSchema = object({
27896
- /** The camera's own id for the volume (`hdd/id`, Reolink `HddInfo/number`). */
27897
- id: string(),
27898
- /** The camera's own name for it, when it gives one (`hddName`). */
27899
- label: string().optional(),
27900
- status: _enum([
27901
- "ok",
27902
- "unformatted",
27903
- "error",
27904
- "offline",
27905
- "unknown"
27906
- ]),
27907
- /**
27908
- * Total size in MB, or **null when the camera did not say**.
27909
- *
27910
- * Never 0 for an unreadable value: a measurement that failed is not a
27911
- * measurement (D393), and a card whose size is unknown must not be
27912
- * rendered as a card of size zero.
27913
- */
27914
- capacityMb: number().nullable(),
27915
- /**
27916
- * Free space in MB, or null when unknown.
27917
- *
27918
- * **Not a proxy for "has footage".** Measured 2026-09-22: 1436 and
27919
- * 1439 both report exactly 11776 MB free — the fixed reserve a looping
27920
- * card converges on once it has wrapped. At loop steady state the
27921
- * number is identical whether the camera recorded yesterday or stopped
27922
- * a month ago.
27923
- */
27924
- freeMb: number().nullable(),
27925
- /** True when the camera reports the volume writable (`property` RW). */
27926
- writable: boolean().optional()
27927
- });
27928
- /**
27929
- * What the camera is doing with its own storage, right now.
27930
- *
27931
- * Every scalar is nullable and **null means the camera did not answer**,
27932
- * never a default. A form that seeds `0` from an unanswered read invites
27933
- * the operator to save that 0 back onto the camera.
27934
- */
27935
- var RecordingOnboardStatusSchema = object({
27936
- storage: discriminatedUnion("kind", [
27937
- object({
27938
- kind: literal("present"),
27939
- volumes: array(OnboardStorageVolumeSchema)
27940
- }),
27941
- object({
27942
- kind: literal("absent"),
27943
- reason: string()
27944
- }),
27945
- object({
27946
- kind: literal("unknown"),
27947
- reason: string()
27948
- })
27949
- ]),
27950
- tracks: array(object({
27951
- id: string(),
27952
- enabled: boolean(),
27953
- isVideo: boolean(),
27954
- /** From the camera's own track description. Null when it does not say. */
27955
- codec: string().nullable(),
27956
- resolution: string().nullable(),
27957
- /** Per-track overwrite flag, where the firmware keeps it per track. */
27958
- overwriteWhenFull: boolean().nullable()
27959
- })),
27960
- /**
27961
- * The track the write path targets — the enabled VIDEO one. Null when
27962
- * no track could be identified, which is itself a refusal reason.
27963
- */
27964
- primaryTrackId: string().nullable(),
27965
- /** Master "record to the card at all" switch. */
27966
- enabled: boolean().nullable(),
27967
- overwriteWhenFull: boolean().nullable(),
27968
- preRecordSec: number().nullable(),
27969
- postRecordSec: number().nullable(),
27970
- /** Length of one recorded file, in minutes. */
27971
- segmentMinutes: number().nullable(),
27972
- /** The primary track's weekly windows, flattened. */
27973
- windows: array(RecordWindowSchema),
27974
- /**
27975
- * How many windows the camera described that CamStack could NOT read —
27976
- * an unrecognised trigger, an unparseable clock, a weekday it does not
27977
- * name.
27978
- *
27979
- * A dropped window is work the reader threw away, and a schedule that
27980
- * silently shows fewer rows than the camera holds is how an operator
27981
- * saves back a schedule shorter than the one they were looking at
27982
- * (D391). Non-zero means the window list is INCOMPLETE and a write
27983
- * that replaces it would delete what was not shown — which is why a
27984
- * provider reporting a non-zero count also reports the schedule as not
27985
- * writable.
27986
- */
27987
- unreadableWindows: number(),
27988
- /**
27989
- * The camera is scheduled to record and has NO usable storage.
27990
- *
27991
- * A first-class fact because it is the fleet's most common silent
27992
- * defect: measured 2026-09-22, 1441 and 3831 are both motion-recording
27993
- * to a card that is not there. Neither the schedule nor the storage
27994
- * read says anything wrong on its own; only the pair does.
27995
- */
27996
- recordingToNowhere: boolean(),
27997
- lastFetchedAt: number()
27998
- });
27999
- /** Numeric range descriptor — `{ min, max, step }` per the getOptions convention. */
28000
- var RangeSchema = object({
28001
- min: number(),
28002
- max: number(),
28003
- step: number()
28004
- });
28005
- /**
28006
- * The values a camera actually takes for a numeric field, when they are a SET
28007
- * rather than a range.
28008
- *
28009
- * `{min,max,step}` cannot say what these two firmwares do. Measured on 1436
28010
- * (I91DN) on 2026-09-22 by writing each value and reading it back:
28011
- *
28012
- * - pre-record: `0, 5, 10, 15, 20, 25, 30` and `2147483647` (INT32_MAX, the
28013
- * camera's "no limit" — `-1` and `4294967295` both land on it);
28014
- * - post-record: `5, 10, 30, 60, 120, 300, 600`.
28015
- *
28016
- * Neither is expressible as a step: the first has a sentinel two billion away
28017
- * from its neighbours, the second doubles and then jumps. A range that tried
28018
- * would forbid values the camera takes AND permit values it silently replaces
28019
- * with 5 — wrong in both directions at once.
28020
- *
28021
- * `sentinel` names the member that is not a duration, so a surface can render
28022
- * "no limit" instead of `2147483647` seconds.
28023
- */
28024
- var AllowedValuesSchema = object({
28025
- values: array(number()).min(1),
28026
- sentinel: object({
28027
- value: number(),
28028
- meaning: _enum(["no-limit", "disabled"])
28029
- }).optional()
28030
- });
28031
- /**
28032
- * Per-field availability on ONE camera.
28033
- *
28034
- * The field exists on every camera — this says whether this one can be
28035
- * read and whether it can be written, and `reason` says why not when
28036
- * either is false. The UI renders the control DISABLED with the reason
28037
- * rather than hiding it, so a limitation is legible instead of looking
28038
- * like a missing feature.
28039
- */
28040
- var OnboardFieldSupportSchema = object({
28041
- readable: boolean(),
28042
- writable: boolean(),
28043
- /** Required whenever `readable` or `writable` is false. */
28044
- reason: string().optional()
28045
- });
28046
- /** What this camera's schedule model can express. */
28047
- var OnboardScheduleSupportSchema = object({
28048
- support: OnboardFieldSupportSchema,
28049
- /**
28050
- * The smallest time step the camera can express, in minutes.
28051
- *
28052
- * Hikvision takes arbitrary minutes (`00:05:00`–`23:57:00` observed on
28053
- * 1436's track 103). Reolink's schedule is a 7×24 HOUR mask, so 60. A
28054
- * window whose edges are not a multiple of this is REFUSED rather than
28055
- * quietly rounded — rounding is how an operator's 06:30 becomes 06:00
28056
- * and nothing says so.
28057
- */
28058
- granularityMinutes: number(),
28059
- /** Triggers this camera can record on. A window naming another is refused. */
28060
- triggers: array(RecordTriggerSchema),
28061
- /**
28062
- * False when the camera stores ONE trigger per time range, so two
28063
- * windows overlapping on the same day cannot carry different triggers.
28064
- * True on Reolink, whose mask is per-trigger and independent.
28065
- */
28066
- supportsOverlappingTriggers: boolean()
28067
- });
28068
- var RecordingOnboardOptionsSchema = object({
28069
- enabled: OnboardFieldSupportSchema,
28070
- overwriteWhenFull: OnboardFieldSupportSchema,
28071
- preRecordSec: OnboardFieldSupportSchema,
28072
- preRecordSecRange: RangeSchema.optional(),
28073
- /** Preferred over the range when the camera takes a SET, not a span. */
28074
- preRecordSecAllowed: AllowedValuesSchema.optional(),
28075
- postRecordSec: OnboardFieldSupportSchema,
28076
- postRecordSecRange: RangeSchema.optional(),
28077
- /** Preferred over the range when the camera takes a SET, not a span. */
28078
- postRecordSecAllowed: AllowedValuesSchema.optional(),
28079
- segmentMinutes: OnboardFieldSupportSchema,
28080
- segmentMinutesRange: RangeSchema.optional(),
28081
- /** Preferred over the range when the camera takes a SET, not a span. */
28082
- segmentMinutesAllowed: AllowedValuesSchema.optional(),
28083
- schedule: OnboardScheduleSupportSchema
28084
- });
28085
- /**
28086
- * A partial change. Every field optional.
28087
- *
28088
- * Unlike the other `deviceConfig` caps, a provider here does **NOT**
28089
- * silently ignore a field it cannot support — it refuses, by name,
28090
- * through {@link describeOnboardRefusal}. Silence on a recording setting
28091
- * is the failure D62 exists to prevent: the operator believes the camera
28092
- * is recording the way the form says, and it is not.
28093
- */
28094
- var RecordingOnboardPatchSchema = object({
28095
- enabled: boolean().optional(),
28096
- overwriteWhenFull: boolean().optional(),
28097
- preRecordSec: number().optional(),
28098
- postRecordSec: number().optional(),
28099
- segmentMinutes: number().optional(),
28100
- /** The complete new window set for the primary track — not a delta. */
28101
- windows: array(RecordWindowSchema).optional()
28102
- });
28103
- var recordingOnboardCapability = {
28104
- name: "recording-onboard",
28105
- scope: "device",
28106
- deviceNative: true,
28107
- mode: "singleton",
28108
- deviceTypes: [DeviceType.Camera],
28109
- deviceConfig: { ui: {
28110
- kind: "derived-form",
28111
- builderId: "recording-onboard",
28112
- tab: "recording"
28113
- } },
28114
- methods: {
28115
- getOptions: method(object({ deviceId: number() }), RecordingOnboardOptionsSchema),
28116
- setSettings: method(object({
28117
- deviceId: number(),
28118
- settings: RecordingOnboardPatchSchema
28119
- }), _void(), {
28120
- kind: "mutation",
28121
- auth: "admin"
28122
- })
28123
- },
28124
- status: {
28125
- schema: RecordingOnboardStatusSchema,
28126
- kind: "poll"
28127
- },
28128
- runtimeState: RecordingOnboardStatusSchema,
28129
- /**
28130
- * Runtime-state durability: **restored** — operator-set camera-side
28131
- * recording config; mutation-driven, and the storage half is the last
28132
- * thing the camera said about its own card.
28133
- *
28134
- * See `RuntimeStateDurability`. Enforced by
28135
- * `scripts/check-runtime-state-durability.ts`.
28136
- */
28137
- durability: "restored",
28138
- /** Clock fields: written, but excluded from the compare that decides
28139
- * whether persisting is worth a SQLite commit. */
28140
- volatileStateFields: ["lastFetchedAt"]
28141
- };
28142
- /**
28143
28234
  * Generic device-level status snapshot. Auto-registered by `BaseDevice`
28144
28235
  * for every device, regardless of provider — the kernel needs a uniform
28145
28236
  * cap-keyed slice for the basic device flags every consumer expects to
@@ -28358,30 +28449,6 @@ var eventEmitterCapability = {
28358
28449
  */
28359
28450
  durability: "session"
28360
28451
  };
28361
- var EventItemSchema = object({
28362
- id: string(),
28363
- type: string(),
28364
- timestamp: number(),
28365
- label: string().optional(),
28366
- thumbnailUrl: string().optional(),
28367
- clipUrl: string().optional(),
28368
- metadata: record(string(), unknown()).optional()
28369
- });
28370
- DeviceType.Camera, method(object({
28371
- deviceId: number(),
28372
- from: number().optional(),
28373
- to: number().optional(),
28374
- limit: number().optional()
28375
- }), array(EventItemSchema)), method(object({
28376
- deviceId: number(),
28377
- eventId: string()
28378
- }), object({
28379
- base64: string(),
28380
- contentType: string()
28381
- }).nullable()), method(object({
28382
- deviceId: number(),
28383
- eventId: string()
28384
- }), string().nullable());
28385
28452
  var IdentitySchema = object({
28386
28453
  id: string(),
28387
28454
  name: string(),
@@ -30634,143 +30701,6 @@ var motionTriggerCapability = {
30634
30701
  durability: "session"
30635
30702
  };
30636
30703
  /**
30637
- * camera-grid-layout — the geometry of a COMPOSITE camera, on the camera's own
30638
- * page.
30639
- *
30640
- * ## Why this is a capability and not an addon settings schema
30641
- *
30642
- * It was one, and it did not render. The addon declared the editor as a
30643
- * `type: 'widget'` field inside its own `deviceSettingsSchema()`; the hub
30644
- * returned that section correctly and `ConfigFormField` renders `type:'widget'`
30645
- * perfectly well — and nothing ever asked camera-grid for it. The Cluster →
30646
- * Pipeline → Device Overrides page interrogates a HAND-WRITTEN list of four
30647
- * addons (`PIPELINE_CLUSTER_DEVICE_ADDONS`), whose own comment says an addon
30648
- * not on it "falls off silently".
30649
- *
30650
- * Adding a fifth name to that list would have been the wrong fix twice over:
30651
- * that page is per-camera DETECTION tuning, and a grid's geometry belongs
30652
- * beside PTZ and motion zones on the camera itself. The device page is
30653
- * BINDING-driven (D12), so the way in is a capability bound to the device —
30654
- * and this cap carries its section the way `recording` does, by RETURNING it
30655
- * from `getDeviceSettingsContribution`.
30656
- *
30657
- * Seven other widgets are still declared the other way, through a
30658
- * `deviceConfig.ui` block the framework derives a section from. That route
30659
- * gives the addon no say in where its own panel lands and no way to decline
30660
- * for a device the panel does not suit, which is why this one does not use it.
30661
- *
30662
- * ## Why one addon may implement it
30663
- *
30664
- * It is a device-scoped NATIVE cap, registered by the grid camera device
30665
- * itself. Nothing else declares a composite camera, so nothing else has a
30666
- * layout — and the device-scoped route means the widget asks THE camera, not
30667
- * "the camera-grid addon", which is what let the old custom-action pair be
30668
- * reached only by a caller that already knew the addon id.
30669
- *
30670
- * ## The tab
30671
- *
30672
- * `streaming`, not a top-tab of its own. A grid's geometry IS what its stream
30673
- * is, so the Streaming tab is where it belongs; a `grid` top-tab would need an
30674
- * entry in `WELL_KNOWN_TAB_MAP` or the device page renders the raw id as the
30675
- * label (measured on the robot camera, 2026-09-06 — a tab called "navigation"
30676
- * next to "PTZ").
30677
- */
30678
- /** A rectangle in normalized [0,1] coordinates of whatever contains it. */
30679
- var GridNormalizedRectSchema = object({
30680
- x: number().min(0).max(1),
30681
- y: number().min(0).max(1),
30682
- width: number().gt(0).max(1),
30683
- height: number().gt(0).max(1)
30684
- });
30685
- /**
30686
- * One source camera, the part of its picture taken, and where that part lands.
30687
- *
30688
- * Both rectangles are NORMALIZED (D519): a source camera can change resolution
30689
- * — a profile switch, a firmware update, a substream that comes back different
30690
- * — and a stored PIXEL rectangle would quietly start cutting the wrong region,
30691
- * which is the class of bug nobody files.
30692
- */
30693
- var GridLayoutCellSchema = object({
30694
- deviceId: number().int().positive(),
30695
- /** The part of the SOURCE taken, normalized against the source. */
30696
- source: GridNormalizedRectSchema,
30697
- /** Where it lands, normalized against the CANVAS. */
30698
- cell: GridNormalizedRectSchema
30699
- });
30700
- /**
30701
- * Which profiles this grid can actually compose, and why not.
30702
- *
30703
- * A grid's `high` composes its sources' `high` and its `low` their `low`, so a
30704
- * profile is on offer only when EVERY source can serve it. The refusal NAMES
30705
- * the sources, because "this grid has no low" is not a finding — "615 has no
30706
- * low" is, and it is the one an operator can act on.
30707
- */
30708
- var GridProfileOfferSchema = object({
30709
- profile: _enum([
30710
- "high",
30711
- "mid",
30712
- "low"
30713
- ]),
30714
- offered: boolean(),
30715
- /** Sources that cannot serve it. Empty when it is offered, or when there are no cells. */
30716
- missingSources: array(number().int().positive()),
30717
- /**
30718
- * The canvas this profile composes onto, `WxH`, or empty when it is not
30719
- * offered. DERIVED from the cells and the sources' own size at this profile —
30720
- * it is reported because nothing else in the system would ever say what the
30721
- * grid came out as, and because it is the number an operator would otherwise
30722
- * expect to type.
30723
- */
30724
- canvas: string(),
30725
- /**
30726
- * Whether this profile is PUBLISHED, of the ones the grid could serve.
30727
- *
30728
- * A grid's `high` is composed of its sources' `high`, so on a 4K fleet it is
30729
- * a 4K canvas built from 4K decodes — something to opt into, not something a
30730
- * viewer's adaptive should be handed by climbing to the top rung it can see.
30731
- * Default is `mid` + `low`.
30732
- */
30733
- published: boolean()
30734
- });
30735
- var GridLayoutViewSchema = object({
30736
- /** The persisted grid row this camera was declared from. */
30737
- instanceId: string(),
30738
- deviceId: number().int().nonnegative(),
30739
- name: string(),
30740
- /**
30741
- * NO canvas size. A grid's resolution is not authored: each profile derives
30742
- * its own from the cells and its sources' dimensions. The two numbers that
30743
- * used to be here were a text field that silently decided both how much the
30744
- * composite cost and how sharp it was — see `profiles[].canvas` for what it
30745
- * came out as.
30746
- */
30747
- fps: number().int(),
30748
- cells: array(GridLayoutCellSchema),
30749
- /** What the catalog will publish, and what it refuses to. Read-only. */
30750
- profiles: array(GridProfileOfferSchema)
30751
- });
30752
- var GridLayoutPatchSchema = object({
30753
- deviceId: number().int().nonnegative(),
30754
- name: string().min(1).max(160).optional(),
30755
- fps: number().int().min(1).max(60).optional(),
30756
- /** Which profiles to publish. See `GridProfileOffer.published`. */
30757
- publishedProfiles: array(_enum([
30758
- "high",
30759
- "mid",
30760
- "low"
30761
- ])).max(3).optional(),
30762
- /**
30763
- * The whole cell list at once. A per-cell patch would need an ordering the
30764
- * editor does not have, and a half-applied layout is a picture nobody asked
30765
- * for.
30766
- */
30767
- cells: array(GridLayoutCellSchema).max(16)
30768
- });
30769
- DeviceType.Camera, method(object({ deviceId: number().int().nonnegative() }), GridLayoutViewSchema.nullable(), { auth: "admin" }), method(GridLayoutPatchSchema, GridLayoutViewSchema, {
30770
- kind: "mutation",
30771
- auth: "admin"
30772
- });
30773
- /**
30774
30704
  * Motion-zones share the same MaskShape vocabulary as privacy-mask — the
30775
30705
  * on-camera motion-detection mask is a single `grid` region (a row-major
30776
30706
  * boolean cell lattice the camera's onboard VMD evaluates). Composing it as
@@ -33133,37 +33063,37 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
33133
33063
  kind: "mutation",
33134
33064
  auth: "admin"
33135
33065
  });
33136
- /**
33137
- * `recording` cap — footage availability + HLS playback manifests + per-device
33138
- * recording config. NOTE on events (source of truth, R5/C3): this cap carries
33139
- * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
33140
- * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
33141
- * rows) and are the ONLY event surface — the recorder has none. The in-RAM
33142
- * playback markers it used to build were deleted on 2026-08-29 because nothing
33143
- * ever read them. Event<->footage joins are by time, padded with the shared
33144
- * `EVENT_PAD_MS` (`interfaces/recording-config.ts`).
33145
- */
33146
- var RecordingStatusSchema = object({
33147
- deviceId: number(),
33148
- enabled: boolean(),
33149
- /** THE derived storage mode, from the one definition
33150
- * (`deriveRecordingMode`) — never a second enum. A duplicated list is how
33151
- * `on-device-decision` could have reached the recorder and not the status. */
33152
- activeMode: RecordingStorageModeSchema,
33153
- nodeId: string(),
33154
- storageBytes: number()
33155
- });
33156
33066
  var RecordingRangeSchema = object({
33157
33067
  profile: string(),
33158
33068
  startMs: number(),
33159
33069
  endMs: number()
33160
33070
  });
33071
+ /**
33072
+ * How a source ANSWERED, on every singular read of this cap.
33073
+ *
33074
+ * `'read'` — it looked. `ranges: []` / `days: []` is then a real claim: this
33075
+ * source has no coverage in the window. `'unreadable'` — nobody could look
33076
+ * (the camera was unreachable, the calendar rung threw, the location is
33077
+ * unmounted, the node is still on the old build), and the emptiness beside it
33078
+ * means NOTHING.
33079
+ *
33080
+ * The batch rows have carried this since the grid existed; the SINGULAR
33081
+ * answers gained it with the collection (D625 §10.4), because they are the
33082
+ * ones the single-camera picker uses and because a half-converted fleet makes
33083
+ * "nobody looked" common for the length of a deploy. Without it the timeline
33084
+ * has no vocabulary for it, and `(data ?? [])` in a viewer turns a rollout into
33085
+ * a fleet of cameras that appear to have lost their recordings (D315, D393).
33086
+ */
33087
+ var RecordingReadSchema = _enum(["read", "unreadable"]);
33161
33088
  var RecordingAvailabilitySchema = object({
33162
33089
  deviceId: number(),
33090
+ /** See {@link RecordingReadSchema}. An `'unreadable'` answer carries an empty
33091
+ * `ranges` that means nothing — never draw it as "no footage". */
33092
+ read: RecordingReadSchema,
33163
33093
  ranges: array(RecordingRangeSchema),
33164
33094
  /**
33165
- * Every profile this camera has footage in — not only the one `ranges`
33166
- * describes (D433).
33095
+ * Every profile this camera has footage in AT THIS SOURCE — not only the one
33096
+ * `ranges` describes (D433).
33167
33097
  *
33168
33098
  * `ranges` answers for ONE profile by design: the timeline is a single bar,
33169
33099
  * and enumerating all of them triples the directory reads for a bar that
@@ -33180,15 +33110,285 @@ var RecordingAvailabilitySchema = object({
33180
33110
  });
33181
33111
  var RecordingDaysSchema = object({
33182
33112
  deviceId: number(),
33113
+ /** See {@link RecordingReadSchema}. `days: []` on an `'unreadable'` answer is
33114
+ * "nobody could look", and the date-picker must not spell it the same as
33115
+ * "no footage this month". */
33116
+ read: RecordingReadSchema,
33183
33117
  /** Local-midnight epochs (UTC ms) of days that have ≥1 recorded segment. */
33184
33118
  days: array(number())
33185
33119
  });
33120
+ var RecordingManifestSchema = object({
33121
+ deviceId: number(),
33122
+ /** Local filesystem path to the master playlist; null when no recording exists for the requested range. */
33123
+ localMasterPath: string().nullable(),
33124
+ /** HTTP(S) URL to the master playlist on the recording node's playback server
33125
+ * (the PRIMARY candidate); null when no recording / server. Carries the
33126
+ * scoped playback token in its path. */
33127
+ playbackUrl: string().nullable(),
33128
+ /**
33129
+ * Candidate master-playlist URLs the client tries in order (LAN first, then
33130
+ * remote — Tailscale/Cloudflare if the operator configured extra hosts), each
33131
+ * carrying the same scoped token. `playbackUrl` is the first entry. Empty when
33132
+ * there is no recording / server.
33133
+ */
33134
+ playbackEndpoints: array(string())
33135
+ });
33136
+ var RecordingSourceAvailabilitySchema = object({
33137
+ state: _enum([
33138
+ "ok",
33139
+ "sleeping",
33140
+ "unreachable",
33141
+ "no-storage",
33142
+ "index-empty"
33143
+ ]),
33144
+ /** Free text, shown verbatim. Names the camera's own refusal when there is one. */
33145
+ reason: string().optional(),
33146
+ /** When this source's coverage was last CONFIRMED. A cached answer is never
33147
+ * drawn as current: the surface shows the age whenever it is older than the
33148
+ * refresh interval. The clip catalog's `catalogAsOf`, under the name the
33149
+ * timeline uses for it. */
33150
+ coverageAsOf: number().optional()
33151
+ });
33152
+ /**
33153
+ * One SOURCE of recorded coverage for a camera — a row of the picker.
33154
+ *
33155
+ * A provider lists the sources IT serves for that device, and answers for each
33156
+ * of them whether it can answer at all. A provider with nothing to offer on a
33157
+ * camera returns `[]` — it is not that camera's business. The five availability
33158
+ * states are `ClipSourceAvailability`'s verbatim: they mean exactly the same
33159
+ * things about a coverage index as about a clip catalog, and `sleeping` in
33160
+ * particular is what stops a battery camera being woken to paint a bar.
33161
+ */
33162
+ var RecordingSourceSchema = object({
33163
+ /** The source id. {@link RECORDING_SOURCE_CAMSTACK} for ours (RESERVED), a
33164
+ * vendor namespace (`native:reolink:onboard`, …) for a camera's own store. */
33165
+ source: string(),
33166
+ /** Operator-facing name of the source ("CamStack recordings", "SD card"). */
33167
+ label: string(),
33168
+ /**
33169
+ * The addon that SERVES this row, and the value a later call passes as
33170
+ * `provider`.
33171
+ *
33172
+ * Optional for version skew only. The collection dispatcher stamps it from
33173
+ * the registry, so a row that travelled through the fan-out carries the
33174
+ * authoritative id whatever the provider filled in (D557 §4).
33175
+ */
33176
+ addonId: string().optional(),
33177
+ availability: RecordingSourceAvailabilitySchema
33178
+ });
33179
+ /**
33180
+ * What a surface may DRAW for this (camera, source) — D612's rule applied to a
33181
+ * timeline: **the source declares what it can do, and the surface draws what
33182
+ * was declared. It never assumes, and never offers a gesture it will then
33183
+ * refuse.** D612 exists because `8` and `16` were offered as clip rates, the
33184
+ * broker clamped them to `4`, and no line anywhere said so.
33185
+ *
33186
+ * Asked once per (camera, source) before anything is drawn — never replaced by
33187
+ * a constant the surface keeps, which is the second authority D612 ends.
33188
+ */
33189
+ var RecordingSourceOptionsSchema = object({
33190
+ /** How this source's media reaches the player.
33191
+ * `archive` = our own indexed segment tree; `stream` = the provider's
33192
+ * forward-only fMP4 (D597); `realtime` = a replay bound to wall clock. */
33193
+ transport: _enum([
33194
+ "archive",
33195
+ "stream",
33196
+ "realtime"
33197
+ ]),
33198
+ /** What the BAR means. `continuous` = gaps are holes in a recording;
33199
+ * `sparse` = gaps are the absence of one, and must be drawn as such.
33200
+ *
33201
+ * Not an onboard-only concession: measured 2026-09-24, OUR bar covers 98.8 %
33202
+ * of 592's day and 1.2 % of 1436's. It is a fact about a (source, camera)
33203
+ * pair, and ours answers it per camera from `deriveRecordingMode`. */
33204
+ coverage: _enum(["continuous", "sparse"]),
33205
+ /** Where the playhead may be put.
33206
+ * `free` — anywhere, to the frame.
33207
+ * `forward` — only ahead of the current position.
33208
+ * `segment` — a position SNAPS to the head of the covering segment; a finer
33209
+ * ask is accepted by the camera and SILENTLY IGNORED. Measured
33210
+ * on 1436 (Hikvision V5.7.1, 2026-09-23): a window-narrowed
33211
+ * `ContentMgmt/search` returns a row and a `playbackURI`, the
33212
+ * replay opens 200 and delivers media — and the burned-in OSD of
33213
+ * the first frame reads the SEGMENT HEAD every time. Calling
33214
+ * that `forward` would tell the surface it may move the playhead
33215
+ * ahead within a loaded segment, which it may not. */
33216
+ seek: _enum([
33217
+ "free",
33218
+ "forward",
33219
+ "segment"
33220
+ ]),
33221
+ /** Frame-step BACKWARD is meaningful. */
33222
+ stepBack: boolean(),
33223
+ /** Whether the drag-scrub gesture is served, as opposed to refused by name. */
33224
+ scrub: boolean(),
33225
+ /** Deliverable rates, ascending, always containing `1`. The surface draws its
33226
+ * picker from this and from NOTHING else (D612, D620, D621). `0` is not a
33227
+ * member: pause is the absence of a rate. */
33228
+ rates: array(number().positive()).min(1).readonly(),
33229
+ /** TRUE when a read of this source HOLDS the camera's only playback session.
33230
+ * A surface with this set makes at most ONE read at a time and draws no
33231
+ * scrub-thumbnail strip, no hover preview, no prefetch and no background
33232
+ * refresh. The precedent is exact and expensive: filling one screen of
33233
+ * Hikvision thumbnails at 1.01× realtime consumed fifteen minutes of that
33234
+ * camera's only playback session (1.2.126, reported within minutes), and a
33235
+ * timeline is a screenful of reads by construction. */
33236
+ exclusive: boolean()
33237
+ });
33238
+ /**
33239
+ * How to PLAY the instant that was asked for, from the chosen source.
33240
+ *
33241
+ * No new media transport is built for onboard sources: the `clip` arm is a
33242
+ * DELEGATION to the `videoclips` transport that vendor already has (D597 /
33243
+ * D616 / D617). The onboard half of this collection is a PROJECTION of
33244
+ * `videoclips` for coverage and a delegation to it for bytes.
33245
+ */
33246
+ var RecordingPlaybackSchema = discriminatedUnion("kind", [
33247
+ object({
33248
+ kind: literal("hls"),
33249
+ manifest: RecordingManifestSchema
33250
+ }),
33251
+ object({
33252
+ kind: literal("clip"),
33253
+ /** The `videoclips` source namespace this clip id belongs to. */
33254
+ source: string(),
33255
+ clipId: string(),
33256
+ /** Where this clip actually STARTS. On a `seek: 'segment'` source the
33257
+ * playhead lands here, not at the requested instant — the surface must be
33258
+ * TOLD, not left to discover it from a burned-in OSD. */
33259
+ startsAtMs: number()
33260
+ }),
33261
+ object({
33262
+ kind: literal("none"),
33263
+ reason: string()
33264
+ })
33265
+ ]);
33266
+ DeviceType.Camera, method(object({ deviceId: number() }), array(RecordingSourceSchema).readonly(), {
33267
+ kind: "query",
33268
+ auth: "protected"
33269
+ }), method(object({
33270
+ deviceId: number(),
33271
+ /**
33272
+ * WHICH provider to ask — the `addonId` a {@link RecordingSourceSchema}
33273
+ * row carries, never a source id and never a list. **REQUIRED**, in the
33274
+ * schema, where the generated types make it unomittable rather than
33275
+ * merely discouraged (D554 amended).
33276
+ *
33277
+ * It was learned the expensive way on `videoclips.listClips`: measured
33278
+ * on the live hub 2026-09-20, device 592 bound to `recorder` AND
33279
+ * `provider-reolink`, a bare call with `limit: 3` answered SIX rows,
33280
+ * three from each source, merged — `device-collection-dispatch.ts`
33281
+ * leaves an unpinned fan-out un-narrowed, so absence buys the union the
33282
+ * method exists not to be. An un-narrowed `getAvailability` would do
33283
+ * that to a TIMELINE: our ranges and the card's clips unioned into one
33284
+ * bar, which is "two sources are never drawn together" broken in the
33285
+ * one place it matters most.
33286
+ *
33287
+ * A provider the device is not bound to is refused BY NAME (D552's
33288
+ * `rejectUnresolvedAddonPin`), never answered by another one.
33289
+ */
33290
+ provider: string().min(1),
33291
+ fromMs: number(),
33292
+ toMs: number(),
33293
+ /**
33294
+ * Answer for THIS profile instead of the source's preferred one (D433).
33295
+ * Absent keeps the timeline's behaviour — one bar, one profile, one set
33296
+ * of reads. `profilesWithFootage` on the answer says what may be asked
33297
+ * for.
33298
+ */
33299
+ profile: string().optional()
33300
+ }), RecordingAvailabilitySchema, {
33301
+ kind: "query",
33302
+ auth: "protected"
33303
+ }), method(object({
33304
+ deviceId: number(),
33305
+ provider: string().min(1),
33306
+ fromMs: number(),
33307
+ toMs: number(),
33308
+ tzOffsetMinutes: number()
33309
+ }), RecordingDaysSchema, {
33310
+ kind: "query",
33311
+ auth: "protected"
33312
+ }), method(object({
33313
+ deviceId: number(),
33314
+ provider: string().min(1),
33315
+ fromMs: number(),
33316
+ toMs: number(),
33317
+ profile: CamProfileSchema.optional()
33318
+ }), RecordingPlaybackSchema, {
33319
+ kind: "query",
33320
+ auth: "protected"
33321
+ }), method(object({
33322
+ deviceId: number(),
33323
+ provider: string().min(1)
33324
+ }), RecordingSourceOptionsSchema, {
33325
+ kind: "query",
33326
+ auth: "protected"
33327
+ });
33328
+ /**
33329
+ * `recording-archive` — OUR archive, and the intent that fills it.
33330
+ *
33331
+ * The system-singleton half of the 2026-09-24 cut (D625). `recording` used to
33332
+ * be one 33-method system singleton holding two unrelated subjects: three
33333
+ * per-camera READS about coverage and playback, and everything else — storage
33334
+ * locations, retention, relocation, rebalance, the ops log, the placement
33335
+ * table and the byte-plane primitives our scrub and export are built on.
33336
+ *
33337
+ * The reads became a device-scoped COLLECTION, so a camera's own card can be a
33338
+ * source beside ours (`recording.cap.ts`). Everything that is about OUR store,
33339
+ * or unimplementable by a camera, stayed here.
33340
+ *
33341
+ * ## On the name
33342
+ *
33343
+ * `recording-storage` was the obvious choice and is wrong: this cap also holds
33344
+ * `getDeviceConfig`/`setDeviceConfig`, which are recording INTENT — bands,
33345
+ * retention, the D62 switch authority — and a name that says "storage" invites
33346
+ * the next reader to move them out again. An archive is a thing we keep, and
33347
+ * what we keep it under is a policy; the name covers both halves honestly and
33348
+ * sits in the existing family (`recording-onboard`, `recording-export`,
33349
+ * `recording-signal`).
33350
+ *
33351
+ * ## What must NOT happen to it
33352
+ *
33353
+ * It stays a SINGLETON. It is registered by `recorder`, which is
33354
+ * `placement: 'any-node'` and runs on every recording node; the hub dispatches
33355
+ * to one of them. Putting the ledger, the placement table or the relocation
33356
+ * jobs behind a fan-out is the one genuinely dangerous move in this cut.
33357
+ *
33358
+ * `getDeviceConfig` / `setDeviceConfig` in particular are the D62 recording
33359
+ * authority (`CameraSwitch.authority`). If a write reached a different provider
33360
+ * than the read — which a collection fan-out permits — two authorities would
33361
+ * decide when one camera records, and the symptom (recording silently off, or
33362
+ * a `bands` array clobbered by a partial write) is durable and silent. Keeping
33363
+ * them here means the worst case during a rollout is a 412: the switch refuses
33364
+ * to flip and SAYS so. **Do not move them into the collection, at any point,
33365
+ * for any reason.**
33366
+ *
33367
+ * ## The two batch reads
33368
+ *
33369
+ * `getAvailabilityBatch` / `getDaysWithRecordingsBatch` take `deviceIds:
33370
+ * number[]` with no single `deviceId`, and a device-scoped mount routes
33371
+ * through `getProviderForDevice(deviceId)` — there is nothing for it to route
33372
+ * on. They stay here, and on this cap the batch is explicitly OURS: a grid has
33373
+ * no per-camera picker, and a caller that wants another source's coverage asks
33374
+ * `recording.getAvailability` per device with that source's `provider`.
33375
+ */
33376
+ var RecordingStatusSchema = object({
33377
+ deviceId: number(),
33378
+ enabled: boolean(),
33379
+ /** THE derived storage mode, from the one definition
33380
+ * (`deriveRecordingMode`) — never a second enum. A duplicated list is how
33381
+ * `on-device-decision` could have reached the recorder and not the status. */
33382
+ activeMode: RecordingStorageModeSchema,
33383
+ nodeId: string(),
33384
+ storageBytes: number()
33385
+ });
33186
33386
  /**
33187
33387
  * One camera's row in a `getAvailabilityBatch` answer.
33188
33388
  *
33189
- * `ranges` is EXACTLY what `getAvailability` returns for that camera — the
33190
- * batch collapses the transport, not the work — plus the one thing the singular
33191
- * method never had to say:
33389
+ * `ranges` is EXACTLY what `recording.getAvailability` returns for that camera
33390
+ * at OUR source — the batch collapses the transport, not the work — plus the
33391
+ * `read` mark the singular answer now carries too (D625):
33192
33392
  *
33193
33393
  * - `read: 'read'` — answered. `ranges: []` means "read, and this camera has
33194
33394
  * no footage in the window", which is a real claim.
@@ -33220,22 +33420,6 @@ var RecordingDaysForDeviceSchema = object({
33220
33420
  /** Local-midnight epochs (UTC ms) of days that have ≥1 recorded segment. */
33221
33421
  days: array(number()).readonly()
33222
33422
  });
33223
- var RecordingManifestSchema = object({
33224
- deviceId: number(),
33225
- /** Local filesystem path to the master playlist; null when no recording exists for the requested range. */
33226
- localMasterPath: string().nullable(),
33227
- /** HTTP(S) URL to the master playlist on the recording node's playback server
33228
- * (the PRIMARY candidate); null when no recording / server. Carries the
33229
- * scoped playback token in its path. */
33230
- playbackUrl: string().nullable(),
33231
- /**
33232
- * Candidate master-playlist URLs the client tries in order (LAN first, then
33233
- * remote — Tailscale/Cloudflare if the operator configured extra hosts), each
33234
- * carrying the same scoped token. `playbackUrl` is the first entry. Empty when
33235
- * there is no recording / server.
33236
- */
33237
- playbackEndpoints: array(string())
33238
- });
33239
33423
  /**
33240
33424
  * Recording storage usage for one camera — what the ARCHIVE holds for it,
33241
33425
  * across every profile and every resolvable location on this node.
@@ -33494,34 +33678,12 @@ var ReadWindowBytesResultSchema = discriminatedUnion("kind", [object({
33494
33678
  segmentEndMs: number()
33495
33679
  })]);
33496
33680
  method(object({
33497
- deviceId: number(),
33498
- fromMs: number(),
33499
- toMs: number(),
33500
- /**
33501
- * Answer for THIS profile instead of the preferred one (D433). Absent
33502
- * keeps the timeline's behaviour — one bar, one profile, one set of
33503
- * reads. `profilesWithFootage` on the answer says what may be asked
33504
- * for.
33505
- */
33506
- profile: string().optional()
33507
- }), RecordingAvailabilitySchema, {
33508
- kind: "query",
33509
- auth: "protected"
33510
- }), method(object({
33511
33681
  deviceIds: array(number()).min(1).max(200),
33512
33682
  fromMs: number(),
33513
33683
  toMs: number()
33514
33684
  }), array(RecordingAvailabilityForDeviceSchema).readonly(), {
33515
33685
  kind: "query",
33516
33686
  auth: "protected"
33517
- }), method(object({
33518
- deviceId: number(),
33519
- fromMs: number(),
33520
- toMs: number(),
33521
- tzOffsetMinutes: number()
33522
- }), RecordingDaysSchema, {
33523
- kind: "query",
33524
- auth: "protected"
33525
33687
  }), method(object({
33526
33688
  deviceIds: array(number()).min(1).max(200),
33527
33689
  fromMs: number(),
@@ -33530,13 +33692,6 @@ method(object({
33530
33692
  }), array(RecordingDaysForDeviceSchema).readonly(), {
33531
33693
  kind: "query",
33532
33694
  auth: "protected"
33533
- }), method(object({
33534
- deviceId: number(),
33535
- fromMs: number(),
33536
- toMs: number()
33537
- }), RecordingManifestSchema, {
33538
- kind: "query",
33539
- auth: "protected"
33540
33695
  }), method(object({}), RecordingStorageUsageSchema, {
33541
33696
  kind: "query",
33542
33697
  auth: "admin"
@@ -33984,6 +34139,346 @@ method(object({
33984
34139
  auth: "protected"
33985
34140
  });
33986
34141
  /**
34142
+ * Vendor-neutral **onboard** recording + storage cap — what the CAMERA
34143
+ * writes to the CAMERA's own card, on the camera's own schedule.
34144
+ *
34145
+ * This is NOT `recording.cap.ts`. That one is CamStack's recorder: our
34146
+ * footage ledger, our storage locations, our retention. This one has a
34147
+ * different authority — the camera's firmware — and per D62 it stores
34148
+ * nothing of its own. Every value here is read from the camera and every
34149
+ * write goes back to the camera; there is no CamStack-side mirror that
34150
+ * could disagree with the device.
34151
+ *
34152
+ * ## One shape, two firmwares
34153
+ *
34154
+ * Measured 2026-09-22 against the live fleet:
34155
+ *
34156
+ * | fact | Hikvision (ISAPI) | Reolink (Baichuan) |
34157
+ * | --- | --- | --- |
34158
+ * | storage | `ContentMgmt/Storage` `<hdd>` rows: status, capacity, freeSpace (MB) | `getHddInfoList` (cmd 102): `mount`, `format`, `capacity` GB + `capacityM` MB remainder |
34159
+ * | tracks | several (101 **and** 103 on both 1436 and 3833), each with its own schedule | one per channel |
34160
+ * | schedule | per track, 7 `ScheduleAction` blocks: DayOfWeek + TimeOfDay range + ONE `ActionRecordingMode` | per trigger type, a 168-char weekly HOUR mask |
34161
+ * | triggers | `CMR`, `MOTION` | `Normal`, `MD`, `people`, `vehicle`, `dog_cat`, `crossline`, `intrude`, `loitering` |
34162
+ * | pre-record | `PreRecordTimeSeconds` | `preRecordTime` |
34163
+ * | post-record | `PostRecordTimeSeconds` | `recordDelayTime` |
34164
+ * | overwrite | per track `LoopEnable` | `cycle`, with `cycleList` enumerating the accepted values |
34165
+ * | segment length | not exposed on V5.7.1 | `packageTime` (minutes) |
34166
+ *
34167
+ * The two schedule models look different and are the same thing in
34168
+ * different coordinates: both answer "for this trigger, during which
34169
+ * weekly windows does the camera record". {@link RecordWindow} is that
34170
+ * question in one shape — Hikvision's ranges map straight onto it,
34171
+ * Reolink's mask expands into hour-aligned windows.
34172
+ *
34173
+ * ## Union, not intersection
34174
+ *
34175
+ * **The same fields exist on every camera.** What differs per device is
34176
+ * which VALUES that device accepts, and that is what {@link
34177
+ * RecordingOnboardOptions} reports — a `{ readable, writable, reason }`
34178
+ * per field plus the schedule's own limits. A control a camera cannot
34179
+ * honour is rendered DISABLED WITH ITS REASON, never missing and never
34180
+ * dead: disabled must not look like broken.
34181
+ *
34182
+ * ## Refusal by name
34183
+ *
34184
+ * A write a camera cannot honour is refused with a sentence the operator
34185
+ * can read — never accepted and dropped. Both providers refuse through
34186
+ * {@link describeOnboardRefusal}, so the vocabulary is one function and
34187
+ * one test, not two hand-written vendor opinions.
34188
+ *
34189
+ * Follows the D14 `deviceConfig` archetype (see `stream-params.cap.ts`):
34190
+ * `getOptions` advertises per-camera availability, `getStatus` (auto-
34191
+ * injected from `status`) reports the live values, and a single
34192
+ * `setSettings` mutation applies a partial change. No hand-written
34193
+ * settings-contribution methods.
34194
+ */
34195
+ /**
34196
+ * What makes the camera start recording during a window.
34197
+ *
34198
+ * The union of both vendors' vocabularies. `continuous` is Hikvision's
34199
+ * `CMR` and Reolink's `Normal`; `motion` is `MOTION` / `MD`. The
34200
+ * object-class triggers are Reolink-only today and the smart-event ones
34201
+ * (`lineCrossing`, `intrusion`, `loitering`) are Reolink-only on the
34202
+ * firmwares measured — a camera that cannot record on a trigger simply
34203
+ * does not list it in `options.schedule.triggers`, and a window naming
34204
+ * it is REFUSED, not dropped.
34205
+ */
34206
+ var RecordTriggerSchema = _enum([
34207
+ "continuous",
34208
+ "motion",
34209
+ "person",
34210
+ "vehicle",
34211
+ "animal",
34212
+ "lineCrossing",
34213
+ "intrusion",
34214
+ "loitering",
34215
+ "alarmInput"
34216
+ ]);
34217
+ /**
34218
+ * One weekly recording window: "on `day`, from `startMinute` to
34219
+ * `endMinute`, record on `trigger`".
34220
+ *
34221
+ * `day` is 0 = Monday … 6 = Sunday (ISO order, which is also the order
34222
+ * both firmwares enumerate). Minutes are local camera time since
34223
+ * midnight; `endMinute` may be 1440, meaning end of day — that is
34224
+ * Hikvision's literal `24:00` and Reolink's 24th mask slot, and
34225
+ * collapsing it to 0 would turn a whole-day window into an empty one.
34226
+ */
34227
+ var RecordWindowSchema = object({
34228
+ trigger: RecordTriggerSchema,
34229
+ day: number().int().min(0).max(6),
34230
+ startMinute: number().int().min(0).max(1439),
34231
+ endMinute: number().int().min(1).max(1440)
34232
+ });
34233
+ /** Status of one physical volume, as the camera itself describes it. */
34234
+ var OnboardStorageVolumeSchema = object({
34235
+ /** The camera's own id for the volume (`hdd/id`, Reolink `HddInfo/number`). */
34236
+ id: string(),
34237
+ /** The camera's own name for it, when it gives one (`hddName`). */
34238
+ label: string().optional(),
34239
+ status: _enum([
34240
+ "ok",
34241
+ "unformatted",
34242
+ "error",
34243
+ "offline",
34244
+ "unknown"
34245
+ ]),
34246
+ /**
34247
+ * Total size in MB, or **null when the camera did not say**.
34248
+ *
34249
+ * Never 0 for an unreadable value: a measurement that failed is not a
34250
+ * measurement (D393), and a card whose size is unknown must not be
34251
+ * rendered as a card of size zero.
34252
+ */
34253
+ capacityMb: number().nullable(),
34254
+ /**
34255
+ * Free space in MB, or null when unknown.
34256
+ *
34257
+ * **Not a proxy for "has footage".** Measured 2026-09-22: 1436 and
34258
+ * 1439 both report exactly 11776 MB free — the fixed reserve a looping
34259
+ * card converges on once it has wrapped. At loop steady state the
34260
+ * number is identical whether the camera recorded yesterday or stopped
34261
+ * a month ago.
34262
+ */
34263
+ freeMb: number().nullable(),
34264
+ /** True when the camera reports the volume writable (`property` RW). */
34265
+ writable: boolean().optional()
34266
+ });
34267
+ /**
34268
+ * What the camera is doing with its own storage, right now.
34269
+ *
34270
+ * Every scalar is nullable and **null means the camera did not answer**,
34271
+ * never a default. A form that seeds `0` from an unanswered read invites
34272
+ * the operator to save that 0 back onto the camera.
34273
+ */
34274
+ var RecordingOnboardStatusSchema = object({
34275
+ storage: discriminatedUnion("kind", [
34276
+ object({
34277
+ kind: literal("present"),
34278
+ volumes: array(OnboardStorageVolumeSchema)
34279
+ }),
34280
+ object({
34281
+ kind: literal("absent"),
34282
+ reason: string()
34283
+ }),
34284
+ object({
34285
+ kind: literal("unknown"),
34286
+ reason: string()
34287
+ })
34288
+ ]),
34289
+ tracks: array(object({
34290
+ id: string(),
34291
+ enabled: boolean(),
34292
+ isVideo: boolean(),
34293
+ /** From the camera's own track description. Null when it does not say. */
34294
+ codec: string().nullable(),
34295
+ resolution: string().nullable(),
34296
+ /** Per-track overwrite flag, where the firmware keeps it per track. */
34297
+ overwriteWhenFull: boolean().nullable()
34298
+ })),
34299
+ /**
34300
+ * The track the write path targets — the enabled VIDEO one. Null when
34301
+ * no track could be identified, which is itself a refusal reason.
34302
+ */
34303
+ primaryTrackId: string().nullable(),
34304
+ /** Master "record to the card at all" switch. */
34305
+ enabled: boolean().nullable(),
34306
+ overwriteWhenFull: boolean().nullable(),
34307
+ preRecordSec: number().nullable(),
34308
+ postRecordSec: number().nullable(),
34309
+ /** Length of one recorded file, in minutes. */
34310
+ segmentMinutes: number().nullable(),
34311
+ /** The primary track's weekly windows, flattened. */
34312
+ windows: array(RecordWindowSchema),
34313
+ /**
34314
+ * How many windows the camera described that CamStack could NOT read —
34315
+ * an unrecognised trigger, an unparseable clock, a weekday it does not
34316
+ * name.
34317
+ *
34318
+ * A dropped window is work the reader threw away, and a schedule that
34319
+ * silently shows fewer rows than the camera holds is how an operator
34320
+ * saves back a schedule shorter than the one they were looking at
34321
+ * (D391). Non-zero means the window list is INCOMPLETE and a write
34322
+ * that replaces it would delete what was not shown — which is why a
34323
+ * provider reporting a non-zero count also reports the schedule as not
34324
+ * writable.
34325
+ */
34326
+ unreadableWindows: number(),
34327
+ /**
34328
+ * The camera is scheduled to record and has NO usable storage.
34329
+ *
34330
+ * A first-class fact because it is the fleet's most common silent
34331
+ * defect: measured 2026-09-22, 1441 and 3831 are both motion-recording
34332
+ * to a card that is not there. Neither the schedule nor the storage
34333
+ * read says anything wrong on its own; only the pair does.
34334
+ */
34335
+ recordingToNowhere: boolean(),
34336
+ lastFetchedAt: number()
34337
+ });
34338
+ /** Numeric range descriptor — `{ min, max, step }` per the getOptions convention. */
34339
+ var RangeSchema = object({
34340
+ min: number(),
34341
+ max: number(),
34342
+ step: number()
34343
+ });
34344
+ /**
34345
+ * The values a camera actually takes for a numeric field, when they are a SET
34346
+ * rather than a range.
34347
+ *
34348
+ * `{min,max,step}` cannot say what these two firmwares do. Measured on 1436
34349
+ * (I91DN) on 2026-09-22 by writing each value and reading it back:
34350
+ *
34351
+ * - pre-record: `0, 5, 10, 15, 20, 25, 30` and `2147483647` (INT32_MAX, the
34352
+ * camera's "no limit" — `-1` and `4294967295` both land on it);
34353
+ * - post-record: `5, 10, 30, 60, 120, 300, 600`.
34354
+ *
34355
+ * Neither is expressible as a step: the first has a sentinel two billion away
34356
+ * from its neighbours, the second doubles and then jumps. A range that tried
34357
+ * would forbid values the camera takes AND permit values it silently replaces
34358
+ * with 5 — wrong in both directions at once.
34359
+ *
34360
+ * `sentinel` names the member that is not a duration, so a surface can render
34361
+ * "no limit" instead of `2147483647` seconds.
34362
+ */
34363
+ var AllowedValuesSchema = object({
34364
+ values: array(number()).min(1),
34365
+ sentinel: object({
34366
+ value: number(),
34367
+ meaning: _enum(["no-limit", "disabled"])
34368
+ }).optional()
34369
+ });
34370
+ /**
34371
+ * Per-field availability on ONE camera.
34372
+ *
34373
+ * The field exists on every camera — this says whether this one can be
34374
+ * read and whether it can be written, and `reason` says why not when
34375
+ * either is false. The UI renders the control DISABLED with the reason
34376
+ * rather than hiding it, so a limitation is legible instead of looking
34377
+ * like a missing feature.
34378
+ */
34379
+ var OnboardFieldSupportSchema = object({
34380
+ readable: boolean(),
34381
+ writable: boolean(),
34382
+ /** Required whenever `readable` or `writable` is false. */
34383
+ reason: string().optional()
34384
+ });
34385
+ /** What this camera's schedule model can express. */
34386
+ var OnboardScheduleSupportSchema = object({
34387
+ support: OnboardFieldSupportSchema,
34388
+ /**
34389
+ * The smallest time step the camera can express, in minutes.
34390
+ *
34391
+ * Hikvision takes arbitrary minutes (`00:05:00`–`23:57:00` observed on
34392
+ * 1436's track 103). Reolink's schedule is a 7×24 HOUR mask, so 60. A
34393
+ * window whose edges are not a multiple of this is REFUSED rather than
34394
+ * quietly rounded — rounding is how an operator's 06:30 becomes 06:00
34395
+ * and nothing says so.
34396
+ */
34397
+ granularityMinutes: number(),
34398
+ /** Triggers this camera can record on. A window naming another is refused. */
34399
+ triggers: array(RecordTriggerSchema),
34400
+ /**
34401
+ * False when the camera stores ONE trigger per time range, so two
34402
+ * windows overlapping on the same day cannot carry different triggers.
34403
+ * True on Reolink, whose mask is per-trigger and independent.
34404
+ */
34405
+ supportsOverlappingTriggers: boolean()
34406
+ });
34407
+ var RecordingOnboardOptionsSchema = object({
34408
+ enabled: OnboardFieldSupportSchema,
34409
+ overwriteWhenFull: OnboardFieldSupportSchema,
34410
+ preRecordSec: OnboardFieldSupportSchema,
34411
+ preRecordSecRange: RangeSchema.optional(),
34412
+ /** Preferred over the range when the camera takes a SET, not a span. */
34413
+ preRecordSecAllowed: AllowedValuesSchema.optional(),
34414
+ postRecordSec: OnboardFieldSupportSchema,
34415
+ postRecordSecRange: RangeSchema.optional(),
34416
+ /** Preferred over the range when the camera takes a SET, not a span. */
34417
+ postRecordSecAllowed: AllowedValuesSchema.optional(),
34418
+ segmentMinutes: OnboardFieldSupportSchema,
34419
+ segmentMinutesRange: RangeSchema.optional(),
34420
+ /** Preferred over the range when the camera takes a SET, not a span. */
34421
+ segmentMinutesAllowed: AllowedValuesSchema.optional(),
34422
+ schedule: OnboardScheduleSupportSchema
34423
+ });
34424
+ /**
34425
+ * A partial change. Every field optional.
34426
+ *
34427
+ * Unlike the other `deviceConfig` caps, a provider here does **NOT**
34428
+ * silently ignore a field it cannot support — it refuses, by name,
34429
+ * through {@link describeOnboardRefusal}. Silence on a recording setting
34430
+ * is the failure D62 exists to prevent: the operator believes the camera
34431
+ * is recording the way the form says, and it is not.
34432
+ */
34433
+ var RecordingOnboardPatchSchema = object({
34434
+ enabled: boolean().optional(),
34435
+ overwriteWhenFull: boolean().optional(),
34436
+ preRecordSec: number().optional(),
34437
+ postRecordSec: number().optional(),
34438
+ segmentMinutes: number().optional(),
34439
+ /** The complete new window set for the primary track — not a delta. */
34440
+ windows: array(RecordWindowSchema).optional()
34441
+ });
34442
+ var recordingOnboardCapability = {
34443
+ name: "recording-onboard",
34444
+ scope: "device",
34445
+ deviceNative: true,
34446
+ mode: "singleton",
34447
+ deviceTypes: [DeviceType.Camera],
34448
+ deviceConfig: { ui: {
34449
+ kind: "derived-form",
34450
+ builderId: "recording-onboard",
34451
+ tab: "recording"
34452
+ } },
34453
+ methods: {
34454
+ getOptions: method(object({ deviceId: number() }), RecordingOnboardOptionsSchema),
34455
+ setSettings: method(object({
34456
+ deviceId: number(),
34457
+ settings: RecordingOnboardPatchSchema
34458
+ }), _void(), {
34459
+ kind: "mutation",
34460
+ auth: "admin"
34461
+ })
34462
+ },
34463
+ status: {
34464
+ schema: RecordingOnboardStatusSchema,
34465
+ kind: "poll"
34466
+ },
34467
+ runtimeState: RecordingOnboardStatusSchema,
34468
+ /**
34469
+ * Runtime-state durability: **restored** — operator-set camera-side
34470
+ * recording config; mutation-driven, and the storage half is the last
34471
+ * thing the camera said about its own card.
34472
+ *
34473
+ * See `RuntimeStateDurability`. Enforced by
34474
+ * `scripts/check-runtime-state-durability.ts`.
34475
+ */
34476
+ durability: "restored",
34477
+ /** Clock fields: written, but excluded from the compare that decides
34478
+ * whether persisting is worth a SQLite commit. */
34479
+ volatileStateFields: ["lastFetchedAt"]
34480
+ };
34481
+ /**
33987
34482
  * A camera's own "record me NOW" LEVEL — a signal the device raises while
33988
34483
  * something it knows about is happening (a robot vacuum cleaning, a machine
33989
34484
  * running, a gate open) and lowers when it stops.
@@ -41444,24 +41939,6 @@ Object.freeze({
41444
41939
  addonId: null,
41445
41940
  access: "view"
41446
41941
  },
41447
- "events.getEventClipUrl": {
41448
- capName: "events",
41449
- capScope: "device",
41450
- addonId: null,
41451
- access: "view"
41452
- },
41453
- "events.getEvents": {
41454
- capName: "events",
41455
- capScope: "device",
41456
- addonId: null,
41457
- access: "view"
41458
- },
41459
- "events.getEventThumbnail": {
41460
- capName: "events",
41461
- capScope: "device",
41462
- addonId: null,
41463
- access: "view"
41464
- },
41465
41942
  "faceGallery.assignFace": {
41466
41943
  capName: "face-gallery",
41467
41944
  capScope: "system",
@@ -42782,6 +43259,12 @@ Object.freeze({
42782
43259
  addonId: null,
42783
43260
  access: "view"
42784
43261
  },
43262
+ "notificationRules.getTemplateCatalog": {
43263
+ capName: "notification-rules",
43264
+ capScope: "system",
43265
+ addonId: null,
43266
+ access: "view"
43267
+ },
42785
43268
  "notificationRules.listDeviceMutes": {
42786
43269
  capName: "notification-rules",
42787
43270
  capScope: "system",
@@ -42800,6 +43283,12 @@ Object.freeze({
42800
43283
  addonId: null,
42801
43284
  access: "view"
42802
43285
  },
43286
+ "notificationRules.previewTemplate": {
43287
+ capName: "notification-rules",
43288
+ capScope: "system",
43289
+ addonId: null,
43290
+ access: "view"
43291
+ },
42803
43292
  "notificationRules.resolveArtifactUrl": {
42804
43293
  capName: "notification-rules",
42805
43294
  capScope: "system",
@@ -44336,224 +44825,236 @@ Object.freeze({
44336
44825
  addonId: null,
44337
44826
  access: "create"
44338
44827
  },
44339
- "recording.applyDeviceSettingsPatch": {
44828
+ "recording.getAvailability": {
44340
44829
  capName: "recording",
44341
- capScope: "system",
44830
+ capScope: "device",
44342
44831
  addonId: null,
44343
- access: "create"
44832
+ access: "view"
44344
44833
  },
44345
- "recording.cancelRelocateJob": {
44834
+ "recording.getDaysWithRecordings": {
44346
44835
  capName: "recording",
44347
- capScope: "system",
44836
+ capScope: "device",
44348
44837
  addonId: null,
44349
- access: "create"
44838
+ access: "view"
44350
44839
  },
44351
- "recording.cancelStorageMigrationMove": {
44840
+ "recording.getPlayback": {
44352
44841
  capName: "recording",
44353
- capScope: "system",
44842
+ capScope: "device",
44354
44843
  addonId: null,
44355
- access: "create"
44844
+ access: "view"
44356
44845
  },
44357
- "recording.deleteFootprint": {
44846
+ "recording.getPlaybackOptions": {
44358
44847
  capName: "recording",
44359
- capScope: "system",
44848
+ capScope: "device",
44360
44849
  addonId: null,
44361
- access: "delete"
44850
+ access: "view"
44362
44851
  },
44363
- "recording.getAvailability": {
44852
+ "recording.listSources": {
44364
44853
  capName: "recording",
44365
- capScope: "system",
44854
+ capScope: "device",
44366
44855
  addonId: null,
44367
44856
  access: "view"
44368
44857
  },
44369
- "recording.getAvailabilityBatch": {
44370
- capName: "recording",
44858
+ "recordingArchive.applyDeviceSettingsPatch": {
44859
+ capName: "recording-archive",
44371
44860
  capScope: "system",
44372
44861
  addonId: null,
44373
- access: "view"
44862
+ access: "create"
44374
44863
  },
44375
- "recording.getDaysWithRecordings": {
44376
- capName: "recording",
44864
+ "recordingArchive.cancelRelocateJob": {
44865
+ capName: "recording-archive",
44377
44866
  capScope: "system",
44378
44867
  addonId: null,
44379
- access: "view"
44868
+ access: "create"
44380
44869
  },
44381
- "recording.getDaysWithRecordingsBatch": {
44382
- capName: "recording",
44870
+ "recordingArchive.cancelStorageMigrationMove": {
44871
+ capName: "recording-archive",
44872
+ capScope: "system",
44873
+ addonId: null,
44874
+ access: "create"
44875
+ },
44876
+ "recordingArchive.deleteFootprint": {
44877
+ capName: "recording-archive",
44878
+ capScope: "system",
44879
+ addonId: null,
44880
+ access: "delete"
44881
+ },
44882
+ "recordingArchive.getAvailabilityBatch": {
44883
+ capName: "recording-archive",
44383
44884
  capScope: "system",
44384
44885
  addonId: null,
44385
44886
  access: "view"
44386
44887
  },
44387
- "recording.getDeviceConfig": {
44388
- capName: "recording",
44888
+ "recordingArchive.getDaysWithRecordingsBatch": {
44889
+ capName: "recording-archive",
44389
44890
  capScope: "system",
44390
44891
  addonId: null,
44391
44892
  access: "view"
44392
44893
  },
44393
- "recording.getDeviceLiveContribution": {
44394
- capName: "recording",
44894
+ "recordingArchive.getDeviceConfig": {
44895
+ capName: "recording-archive",
44395
44896
  capScope: "system",
44396
44897
  addonId: null,
44397
44898
  access: "view"
44398
44899
  },
44399
- "recording.getDeviceSettingsContribution": {
44400
- capName: "recording",
44900
+ "recordingArchive.getDeviceLiveContribution": {
44901
+ capName: "recording-archive",
44401
44902
  capScope: "system",
44402
44903
  addonId: null,
44403
44904
  access: "view"
44404
44905
  },
44405
- "recording.getPlacement": {
44406
- capName: "recording",
44906
+ "recordingArchive.getDeviceSettingsContribution": {
44907
+ capName: "recording-archive",
44407
44908
  capScope: "system",
44408
44909
  addonId: null,
44409
44910
  access: "view"
44410
44911
  },
44411
- "recording.getPlaybackManifest": {
44412
- capName: "recording",
44912
+ "recordingArchive.getPlacement": {
44913
+ capName: "recording-archive",
44413
44914
  capScope: "system",
44414
44915
  addonId: null,
44415
44916
  access: "view"
44416
44917
  },
44417
- "recording.getRelocateResidue": {
44418
- capName: "recording",
44918
+ "recordingArchive.getRelocateResidue": {
44919
+ capName: "recording-archive",
44419
44920
  capScope: "system",
44420
44921
  addonId: null,
44421
44922
  access: "view"
44422
44923
  },
44423
- "recording.getStatus": {
44424
- capName: "recording",
44924
+ "recordingArchive.getStatus": {
44925
+ capName: "recording-archive",
44425
44926
  capScope: "system",
44426
44927
  addonId: null,
44427
44928
  access: "view"
44428
44929
  },
44429
- "recording.getStorageMigrationMoveStatus": {
44430
- capName: "recording",
44930
+ "recordingArchive.getStorageMigrationMoveStatus": {
44931
+ capName: "recording-archive",
44431
44932
  capScope: "system",
44432
44933
  addonId: null,
44433
44934
  access: "view"
44434
44935
  },
44435
- "recording.getStorageUsage": {
44436
- capName: "recording",
44936
+ "recordingArchive.getStorageUsage": {
44937
+ capName: "recording-archive",
44437
44938
  capScope: "system",
44438
44939
  addonId: null,
44439
44940
  access: "view"
44440
44941
  },
44441
- "recording.listOpsLog": {
44442
- capName: "recording",
44942
+ "recordingArchive.listOpsLog": {
44943
+ capName: "recording-archive",
44443
44944
  capScope: "system",
44444
44945
  addonId: null,
44445
44946
  access: "view"
44446
44947
  },
44447
- "recording.listRelocateJobs": {
44448
- capName: "recording",
44948
+ "recordingArchive.listRelocateJobs": {
44949
+ capName: "recording-archive",
44449
44950
  capScope: "system",
44450
44951
  addonId: null,
44451
44952
  access: "view"
44452
44953
  },
44453
- "recording.locateSegment": {
44454
- capName: "recording",
44954
+ "recordingArchive.locateSegment": {
44955
+ capName: "recording-archive",
44455
44956
  capScope: "system",
44456
44957
  addonId: null,
44457
44958
  access: "view"
44458
44959
  },
44459
- "recording.pauseForStorageMigration": {
44460
- capName: "recording",
44960
+ "recordingArchive.pauseForStorageMigration": {
44961
+ capName: "recording-archive",
44461
44962
  capScope: "system",
44462
44963
  addonId: null,
44463
44964
  access: "create"
44464
44965
  },
44465
- "recording.planStorageRebalance": {
44466
- capName: "recording",
44966
+ "recordingArchive.planStorageRebalance": {
44967
+ capName: "recording-archive",
44467
44968
  capScope: "system",
44468
44969
  addonId: null,
44469
44970
  access: "view"
44470
44971
  },
44471
- "recording.pruneFootage": {
44472
- capName: "recording",
44972
+ "recordingArchive.pruneFootage": {
44973
+ capName: "recording-archive",
44473
44974
  capScope: "system",
44474
44975
  addonId: null,
44475
44976
  access: "create"
44476
44977
  },
44477
- "recording.readGopBytes": {
44478
- capName: "recording",
44978
+ "recordingArchive.readGopBytes": {
44979
+ capName: "recording-archive",
44479
44980
  capScope: "system",
44480
44981
  addonId: null,
44481
44982
  access: "view"
44482
44983
  },
44483
- "recording.readSegmentBytes": {
44484
- capName: "recording",
44984
+ "recordingArchive.readSegmentBytes": {
44985
+ capName: "recording-archive",
44485
44986
  capScope: "system",
44486
44987
  addonId: null,
44487
44988
  access: "view"
44488
44989
  },
44489
- "recording.readWindowBytes": {
44490
- capName: "recording",
44990
+ "recordingArchive.readWindowBytes": {
44991
+ capName: "recording-archive",
44491
44992
  capScope: "system",
44492
44993
  addonId: null,
44493
44994
  access: "view"
44494
44995
  },
44495
- "recording.reconcileLedgerAgainstDisk": {
44496
- capName: "recording",
44996
+ "recordingArchive.reconcileLedgerAgainstDisk": {
44997
+ capName: "recording-archive",
44497
44998
  capScope: "system",
44498
44999
  addonId: null,
44499
45000
  access: "create"
44500
45001
  },
44501
- "recording.refreshStorageLocationsForMigration": {
44502
- capName: "recording",
45002
+ "recordingArchive.refreshStorageLocationsForMigration": {
45003
+ capName: "recording-archive",
44503
45004
  capScope: "system",
44504
45005
  addonId: null,
44505
45006
  access: "create"
44506
45007
  },
44507
- "recording.relocateFootage": {
44508
- capName: "recording",
45008
+ "recordingArchive.relocateFootage": {
45009
+ capName: "recording-archive",
44509
45010
  capScope: "system",
44510
45011
  addonId: null,
44511
45012
  access: "create"
44512
45013
  },
44513
- "recording.renderClip": {
44514
- capName: "recording",
45014
+ "recordingArchive.renderClip": {
45015
+ capName: "recording-archive",
44515
45016
  capScope: "system",
44516
45017
  addonId: null,
44517
45018
  access: "create"
44518
45019
  },
44519
- "recording.renderGif": {
44520
- capName: "recording",
45020
+ "recordingArchive.renderGif": {
45021
+ capName: "recording-archive",
44521
45022
  capScope: "system",
44522
45023
  addonId: null,
44523
45024
  access: "create"
44524
45025
  },
44525
- "recording.rescanStorage": {
44526
- capName: "recording",
45026
+ "recordingArchive.rescanStorage": {
45027
+ capName: "recording-archive",
44527
45028
  capScope: "system",
44528
45029
  addonId: null,
44529
45030
  access: "create"
44530
45031
  },
44531
- "recording.resumeForStorageMigration": {
44532
- capName: "recording",
45032
+ "recordingArchive.resumeForStorageMigration": {
45033
+ capName: "recording-archive",
44533
45034
  capScope: "system",
44534
45035
  addonId: null,
44535
45036
  access: "create"
44536
45037
  },
44537
- "recording.setDeviceConfig": {
44538
- capName: "recording",
45038
+ "recordingArchive.setDeviceConfig": {
45039
+ capName: "recording-archive",
44539
45040
  capScope: "system",
44540
45041
  addonId: null,
44541
45042
  access: "create"
44542
45043
  },
44543
- "recording.setDevicePlacement": {
44544
- capName: "recording",
45044
+ "recordingArchive.setDevicePlacement": {
45045
+ capName: "recording-archive",
44545
45046
  capScope: "system",
44546
45047
  addonId: null,
44547
45048
  access: "create"
44548
45049
  },
44549
- "recording.startStorageMigrationMove": {
44550
- capName: "recording",
45050
+ "recordingArchive.startStorageMigrationMove": {
45051
+ capName: "recording-archive",
44551
45052
  capScope: "system",
44552
45053
  addonId: null,
44553
45054
  access: "create"
44554
45055
  },
44555
- "recording.startStorageRebalance": {
44556
- capName: "recording",
45056
+ "recordingArchive.startStorageRebalance": {
45057
+ capName: "recording-archive",
44557
45058
  capScope: "system",
44558
45059
  addonId: null,
44559
45060
  access: "create"
@@ -46082,6 +46583,12 @@ Object.freeze({
46082
46583
  addonId: null,
46083
46584
  access: "view"
46084
46585
  },
46586
+ "videoclips.getPlaybackOptions": {
46587
+ capName: "videoclips",
46588
+ capScope: "device",
46589
+ addonId: null,
46590
+ access: "view"
46591
+ },
46085
46592
  "videoclips.listClips": {
46086
46593
  capName: "videoclips",
46087
46594
  capScope: "device",
@@ -46094,6 +46601,12 @@ Object.freeze({
46094
46601
  addonId: null,
46095
46602
  access: "view"
46096
46603
  },
46604
+ "videoclips.offerClipBytes": {
46605
+ capName: "videoclips",
46606
+ capScope: "device",
46607
+ addonId: null,
46608
+ access: "view"
46609
+ },
46097
46610
  "videoclips.readClipBytes": {
46098
46611
  capName: "videoclips",
46099
46612
  capScope: "device",
@@ -46846,21 +47359,6 @@ Object.freeze({
46846
47359
  form: "single",
46847
47360
  optional: false
46848
47361
  }],
46849
- "events.getEventClipUrl": [{
46850
- name: "deviceId",
46851
- form: "single",
46852
- optional: false
46853
- }],
46854
- "events.getEvents": [{
46855
- name: "deviceId",
46856
- form: "single",
46857
- optional: false
46858
- }],
46859
- "events.getEventThumbnail": [{
46860
- name: "deviceId",
46861
- form: "single",
46862
- optional: false
46863
- }],
46864
47362
  "faceGallery.getFaceByTrack": [{
46865
47363
  name: "deviceId",
46866
47364
  form: "single",
@@ -47779,107 +48277,117 @@ Object.freeze({
47779
48277
  form: "single",
47780
48278
  optional: false
47781
48279
  }],
47782
- "recording.deleteFootprint": [{
48280
+ "recording.getAvailability": [{
47783
48281
  name: "deviceId",
47784
48282
  form: "single",
47785
48283
  optional: false
47786
48284
  }],
47787
- "recording.getAvailability": [{
48285
+ "recording.getDaysWithRecordings": [{
47788
48286
  name: "deviceId",
47789
48287
  form: "single",
47790
48288
  optional: false
47791
48289
  }],
47792
- "recording.getAvailabilityBatch": [{
47793
- name: "deviceIds",
47794
- form: "array",
48290
+ "recording.getPlayback": [{
48291
+ name: "deviceId",
48292
+ form: "single",
47795
48293
  optional: false
47796
48294
  }],
47797
- "recording.getDaysWithRecordings": [{
48295
+ "recording.getPlaybackOptions": [{
47798
48296
  name: "deviceId",
47799
48297
  form: "single",
47800
48298
  optional: false
47801
48299
  }],
47802
- "recording.getDaysWithRecordingsBatch": [{
47803
- name: "deviceIds",
47804
- form: "array",
48300
+ "recording.listSources": [{
48301
+ name: "deviceId",
48302
+ form: "single",
47805
48303
  optional: false
47806
48304
  }],
47807
- "recording.getDeviceConfig": [{
48305
+ "recordingArchive.deleteFootprint": [{
47808
48306
  name: "deviceId",
47809
48307
  form: "single",
47810
48308
  optional: false
47811
48309
  }],
47812
- "recording.getPlaybackManifest": [{
48310
+ "recordingArchive.getAvailabilityBatch": [{
48311
+ name: "deviceIds",
48312
+ form: "array",
48313
+ optional: false
48314
+ }],
48315
+ "recordingArchive.getDaysWithRecordingsBatch": [{
48316
+ name: "deviceIds",
48317
+ form: "array",
48318
+ optional: false
48319
+ }],
48320
+ "recordingArchive.getDeviceConfig": [{
47813
48321
  name: "deviceId",
47814
48322
  form: "single",
47815
48323
  optional: false
47816
48324
  }],
47817
- "recording.listOpsLog": [{
48325
+ "recordingArchive.listOpsLog": [{
47818
48326
  name: "deviceId",
47819
48327
  form: "single",
47820
48328
  optional: true
47821
48329
  }],
47822
- "recording.locateSegment": [{
48330
+ "recordingArchive.locateSegment": [{
47823
48331
  name: "deviceId",
47824
48332
  form: "single",
47825
48333
  optional: false
47826
48334
  }],
47827
- "recording.pruneFootage": [{
48335
+ "recordingArchive.pruneFootage": [{
47828
48336
  name: "deviceId",
47829
48337
  form: "single",
47830
48338
  optional: false
47831
48339
  }],
47832
- "recording.readGopBytes": [{
48340
+ "recordingArchive.readGopBytes": [{
47833
48341
  name: "deviceId",
47834
48342
  form: "single",
47835
48343
  optional: false
47836
48344
  }],
47837
- "recording.readSegmentBytes": [{
48345
+ "recordingArchive.readSegmentBytes": [{
47838
48346
  name: "deviceId",
47839
48347
  form: "single",
47840
48348
  optional: false
47841
48349
  }],
47842
- "recording.readWindowBytes": [{
48350
+ "recordingArchive.readWindowBytes": [{
47843
48351
  name: "deviceId",
47844
48352
  form: "single",
47845
48353
  optional: false
47846
48354
  }],
47847
- "recording.reconcileLedgerAgainstDisk": [{
48355
+ "recordingArchive.reconcileLedgerAgainstDisk": [{
47848
48356
  name: "deviceId",
47849
48357
  form: "single",
47850
48358
  optional: true
47851
48359
  }],
47852
- "recording.relocateFootage": [{
48360
+ "recordingArchive.relocateFootage": [{
47853
48361
  name: "deviceId",
47854
48362
  form: "single",
47855
48363
  optional: true
47856
48364
  }],
47857
- "recording.renderClip": [{
48365
+ "recordingArchive.renderClip": [{
47858
48366
  name: "deviceId",
47859
48367
  form: "single",
47860
48368
  optional: false
47861
48369
  }],
47862
- "recording.renderGif": [{
48370
+ "recordingArchive.renderGif": [{
47863
48371
  name: "deviceId",
47864
48372
  form: "single",
47865
48373
  optional: false
47866
48374
  }],
47867
- "recording.rescanStorage": [{
48375
+ "recordingArchive.rescanStorage": [{
47868
48376
  name: "deviceId",
47869
48377
  form: "single",
47870
48378
  optional: false
47871
48379
  }],
47872
- "recording.setDeviceConfig": [{
48380
+ "recordingArchive.setDeviceConfig": [{
47873
48381
  name: "deviceId",
47874
48382
  form: "single",
47875
48383
  optional: false
47876
48384
  }],
47877
- "recording.setDevicePlacement": [{
48385
+ "recordingArchive.setDevicePlacement": [{
47878
48386
  name: "deviceId",
47879
48387
  form: "single",
47880
48388
  optional: false
47881
48389
  }],
47882
- "recording.startStorageMigrationMove": [{
48390
+ "recordingArchive.startStorageMigrationMove": [{
47883
48391
  name: "deviceId",
47884
48392
  form: "single",
47885
48393
  optional: true
@@ -48140,6 +48648,11 @@ Object.freeze({
48140
48648
  form: "single",
48141
48649
  optional: false
48142
48650
  }],
48651
+ "videoclips.getPlaybackOptions": [{
48652
+ name: "deviceId",
48653
+ form: "single",
48654
+ optional: false
48655
+ }],
48143
48656
  "videoclips.listClips": [{
48144
48657
  name: "deviceId",
48145
48658
  form: "single",
@@ -48150,6 +48663,11 @@ Object.freeze({
48150
48663
  form: "single",
48151
48664
  optional: false
48152
48665
  }],
48666
+ "videoclips.offerClipBytes": [{
48667
+ name: "deviceId",
48668
+ form: "single",
48669
+ optional: false
48670
+ }],
48153
48671
  "videoclips.readClipBytes": [{
48154
48672
  name: "deviceId",
48155
48673
  form: "single",
@@ -48545,6 +49063,41 @@ function prepareNotification(caps, n) {
48545
49063
  };
48546
49064
  }
48547
49065
  NC_AUDIO_DEFAULTS.hitPercent, NC_AUDIO_DEFAULTS.samplingSeconds;
49066
+ var RULE_BODY_ONLY = ["body"];
49067
+ var RULE_TEXT = ["title", "body"];
49068
+ var BATTERY = ["device-battery-low", "device-battery-normal"];
49069
+ var CONSUMABLE = ["device-consumable-low", "device-consumable-normal"];
49070
+ var UPDATES = [
49071
+ "addon-update-available",
49072
+ "server-update-available",
49073
+ "wrapper-update-available"
49074
+ ];
49075
+ var PACKAGE_UPDATES = ["addon-update-available", "server-update-available"];
49076
+ var ALARM = [
49077
+ "alarm-triggered",
49078
+ "alarm-armed",
49079
+ "alarm-disarmed",
49080
+ "alarm-arming",
49081
+ "alarm-arm-refused",
49082
+ "alarm-pending",
49083
+ "alarm-rearmed",
49084
+ "alarm-sensor-bypass",
49085
+ "alarm-check-failed"
49086
+ ];
49087
+ var COMBINED_ALARM = ["alarm-triggered"];
49088
+ var DEVICE_EVENTS = [
49089
+ "device-online",
49090
+ "device-offline",
49091
+ "device-disabled",
49092
+ "device-enabled",
49093
+ ...BATTERY,
49094
+ ...CONSUMABLE,
49095
+ "stream-online",
49096
+ "stream-offline",
49097
+ "detection-blind",
49098
+ ...ALARM
49099
+ ];
49100
+ [...DEVICE_EVENTS], [...RULE_TEXT], [...COMBINED_ALARM], [...RULE_TEXT], [...COMBINED_ALARM], [...RULE_TEXT], [...RULE_TEXT], [...COMBINED_ALARM], [...RULE_TEXT], [...PACKAGE_UPDATES], [...RULE_TEXT], [...RULE_TEXT], [...COMBINED_ALARM], [...RULE_TEXT], [...COMBINED_ALARM], [...RULE_TEXT], [...COMBINED_ALARM], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_BODY_ONLY], [...RULE_TEXT], [...RULE_TEXT], [...DEVICE_EVENTS], [...RULE_TEXT], [...DEVICE_EVENTS], [...RULE_TEXT], [...BATTERY, ...CONSUMABLE], [...RULE_TEXT], [...CONSUMABLE], [...RULE_TEXT], [...RULE_TEXT], [...UPDATES], [...RULE_TEXT], [...UPDATES], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...UPDATES], [...RULE_TEXT], [...PACKAGE_UPDATES], [...RULE_TEXT], [...PACKAGE_UPDATES], [...RULE_TEXT], [...UPDATES], [...RULE_TEXT], [...UPDATES], [...RULE_TEXT], [...PACKAGE_UPDATES], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT], [...RULE_TEXT];
48548
49101
  /**
48549
49102
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
48550
49103
  *