@camstack/types 1.2.203 → 1.2.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9442,7 +9442,23 @@ var PickStreamRequirementsSchema = zod.z.object({
9442
9442
  * This is what lets one picker serve both the bypass and the full source
9443
9443
  * choice, instead of a consumer scoring privately when the bypass misses.
9444
9444
  */
9445
- allowTranscode: zod.z.boolean().optional()
9445
+ allowTranscode: zod.z.boolean().optional(),
9446
+ /**
9447
+ * Consider ONLY streams the broker has bound to a profile slot.
9448
+ *
9449
+ * A consumer that dials the broker — which is every exporter, since none
9450
+ * of them may open the camera's own URL — can do nothing with a source
9451
+ * that has no slot: there is no restream to dial. Without this the picker
9452
+ * can name such a stream, and each consumer discovers the dead end for
9453
+ * itself: Alexa's `profileForCamStream` returns `null` and it quietly
9454
+ * falls back, and HomeKit would have had to grow the same function again.
9455
+ *
9456
+ * Default `false`, and deliberately so: the BROKER itself picks through
9457
+ * here when it decides which source to BIND to a slot
9458
+ * (`computeInitialAssignment`), and it must see the unbound ones or it
9459
+ * could never bind them.
9460
+ */
9461
+ requireProfileBound: zod.z.boolean().optional()
9446
9462
  }).readonly();
9447
9463
  var PickStreamPreferencesSchema = zod.z.object({
9448
9464
  /**
@@ -9483,7 +9499,43 @@ var PickedCamStreamSchema = zod.z.object({
9483
9499
  */
9484
9500
  transcodes: zod.z.boolean(),
9485
9501
  /** One-line explanation of why this stream won — for logs / debug UI. */
9486
- reason: zod.z.string()
9502
+ reason: zod.z.string(),
9503
+ /**
9504
+ * The broker profile slot this source is bound to, when it is bound.
9505
+ *
9506
+ * Answered HERE because every consumer needs it and none of them can get it
9507
+ * from the `camStreamId` alone. Alexa wrote `profileForCamStream` for it —
9508
+ * a second cap read plus a `null` branch — and HomeKit was about to write
9509
+ * the same function a second time.
9510
+ *
9511
+ * Absent when the source has no slot, which a caller passing
9512
+ * `requireProfileBound` can never see.
9513
+ */
9514
+ profile: require_sleep.CamProfileSchema.optional(),
9515
+ /** The broker id of that slot, for logs that must name what was dialled. */
9516
+ brokerId: zod.z.string().optional(),
9517
+ /**
9518
+ * The broker restream URL to dial for this stream.
9519
+ *
9520
+ * An exporter must never open the camera's own URL — the broker is the one
9521
+ * that dials the camera, and every consumer goes through its restream. So
9522
+ * the picker answers with the thing a consumer may actually use, instead of
9523
+ * naming a source and leaving each caller to look the URL up.
9524
+ */
9525
+ url: zod.z.string().optional(),
9526
+ /**
9527
+ * Frames per second this stream really delivers, and where the number came
9528
+ * from.
9529
+ *
9530
+ * It is here because getting it wrong is expensive and silent: a HomeKit
9531
+ * accessory advertised 720p at 24 fps while the slot serving it ran at 9,
9532
+ * and the controller rendered nothing at all. The source is carried with the
9533
+ * value for the same reason the bitrate evidence is: `published` is what the
9534
+ * publisher declares and `measured` is what the broker observed, and they
9535
+ * are not interchangeable.
9536
+ */
9537
+ fps: zod.z.number().positive().optional(),
9538
+ fpsSource: zod.z.enum(["published", "measured"]).optional()
9487
9539
  });
9488
9540
  /**
9489
9541
  * Camera streams — device-scoped facade over the system `stream-broker`.
@@ -11561,6 +11613,93 @@ function resolveLocationIcon(value) {
11561
11613
  const parsed = LocationIconIdSchema.safeParse(value);
11562
11614
  return parsed.success ? parsed.data : LOCATION_ICON_FALLBACK;
11563
11615
  }
11616
+ /**
11617
+ * How long a location description may be.
11618
+ *
11619
+ * It is given to a vision model alongside the pictures, so it competes for the
11620
+ * same attention the pictures need. A cap of one short paragraph is what keeps
11621
+ * it a PLACE description rather than a second prompt — an operator who needs
11622
+ * more than this is describing events, which change, instead of the ground,
11623
+ * which does not.
11624
+ */
11625
+ var LOCATION_DESCRIPTION_MAX = 400;
11626
+ /**
11627
+ * One (location, description) assignment as it travels.
11628
+ *
11629
+ * Same key discipline as {@link LocationIconAssignmentSchema}, and for the same
11630
+ * reason: this lived for a while in the post-analysis addon's own settings,
11631
+ * keyed by a HAND-TYPED label matched exactly and case-sensitively. A rename in
11632
+ * the Locations page carried the icon and silently orphaned the description —
11633
+ * two authorities for one thing, joined by two different rules. Now both hang
11634
+ * off the location itself, on `locationIconKey`.
11635
+ */
11636
+ var LocationDescriptionAssignmentSchema = zod.z.object({
11637
+ locationKey: zod.z.string(),
11638
+ description: zod.z.string()
11639
+ });
11640
+ //#endregion
11641
+ //#region src/device/site-zone.ts
11642
+ /**
11643
+ * A SITE ZONE — a named part of the property that several locations belong to.
11644
+ *
11645
+ * "Zona notte" holds every bedroom; "Zona giorno" the living room and the
11646
+ * kitchen. A camera belongs to exactly one location, and a location to at most
11647
+ * one zone, so a camera's zone is derived and never stored on the device: the
11648
+ * whole point of this entity is that grouping rooms touches no device row.
11649
+ *
11650
+ * ## Why not `zone`
11651
+ *
11652
+ * Because `zone` is already the most loaded word in this product: 612 source
11653
+ * files and 24 Italian strings where it means a DETECTION zone drawn on a
11654
+ * camera. The two are unrelated — one is a polygon in a frame, the other is a
11655
+ * set of rooms — and a reader who confuses them will look for a camera's
11656
+ * bedrooms. So the code says `siteZone` everywhere, and the UI frees the plain
11657
+ * word by calling the drawn one what it actually is: a detection zone.
11658
+ *
11659
+ * ## The key
11660
+ *
11661
+ * `siteZoneKey(label)` — trimmed, lower-cased, the SAME derivation locations
11662
+ * use (`locationIconKey`). Membership and the icon both hang off it, so a
11663
+ * case-only rename keeps them, which is exactly the orphaning that cost us a
11664
+ * silently-dropped location description.
11665
+ *
11666
+ * The icon vocabulary is the location one, unchanged: a zone is drawn on the
11667
+ * same two surfaces by the same glyph map, so a second vocabulary would be a
11668
+ * second thing to keep drawable (`scripts/check-location-icons-drawable.ts`).
11669
+ */
11670
+ /**
11671
+ * One zone as it travels: its key, the label the operator typed, its icon and
11672
+ * the locations inside it.
11673
+ *
11674
+ * The LABEL is carried alongside the key because the key is lossy on purpose —
11675
+ * a surface must show "Zona notte", not "zona notte". Locations are carried
11676
+ * here, rather than left to a second call, because every consumer wants both
11677
+ * at once and a viewer that asked twice could render a zone whose membership
11678
+ * it has not fetched yet.
11679
+ *
11680
+ * `icon: null` means nobody chose one, which is NOT the fallback pin: only one
11681
+ * of those two is a choice, and a picker has to draw them differently.
11682
+ */
11683
+ var SiteZoneSchema = zod.z.object({
11684
+ zoneKey: zod.z.string(),
11685
+ label: zod.z.string(),
11686
+ icon: LocationIconIdSchema.nullable(),
11687
+ /** Folded location keys, sorted. A location listed here need not be
11688
+ * REGISTERED — devices carry labels nobody registered, and those rooms are
11689
+ * the ones that most want grouping. */
11690
+ locationKeys: zod.z.array(zod.z.string())
11691
+ });
11692
+ /**
11693
+ * The join key for a zone label: trimmed, lower-cased.
11694
+ *
11695
+ * Deliberately a separate export from `locationIconKey` even though the
11696
+ * derivation is identical — they key different maps, and a future change to one
11697
+ * must not silently re-key the other. Their agreement is a fact about today,
11698
+ * not a dependency.
11699
+ */
11700
+ function siteZoneKey(label) {
11701
+ return label.trim().toLowerCase();
11702
+ }
11564
11703
  //#endregion
11565
11704
  //#region src/capabilities/device-provider.cap.ts
11566
11705
  var ProviderStatusSchema = zod.z.object({
@@ -12365,6 +12504,94 @@ var deviceManagerCapability = {
12365
12504
  kind: "mutation",
12366
12505
  auth: "admin"
12367
12506
  }),
12507
+ /** Every location that carries a DESCRIPTION — what the place LOOKS like,
12508
+ * in plain words, given to the vision model alongside the pictures so it
12509
+ * knows what it is looking at. A driveway of cobbles between a brick wall
12510
+ * and three parking spaces reads very differently from a back garden.
12511
+ *
12512
+ * Same additive shape and same join key as `listLocationIcons`, and that
12513
+ * is the point of it being here at all: this lived in the post-analysis
12514
+ * addon's own settings, keyed by a hand-typed label matched exactly and
12515
+ * case-sensitively, while the icon hung off the location itself. A rename
12516
+ * carried the icon and silently orphaned the description. One location,
12517
+ * one authority, one key.
12518
+ *
12519
+ * Absent means nobody wrote one — the digest then tells the model only the
12520
+ * location NAME, exactly as it did before descriptions existed. */
12521
+ listLocationDescriptions: require_sleep.method(zod.z.void(), zod.z.array(LocationDescriptionAssignmentSchema)),
12522
+ /** Set (or clear) a location's description. `description: null`, or a
12523
+ * blank string, removes it — an empty description and no description are
12524
+ * the same thing to every reader, and storing the first would send an
12525
+ * empty line to the model.
12526
+ *
12527
+ * Like `setLocationIcon`, the label need NOT be registered, and an
12528
+ * empty / whitespace-only LABEL throws. */
12529
+ setLocationDescription: require_sleep.method(zod.z.object({
12530
+ location: zod.z.string(),
12531
+ description: zod.z.string().max(400).nullable()
12532
+ }), zod.z.void(), {
12533
+ kind: "mutation",
12534
+ auth: "admin"
12535
+ }),
12536
+ /** Every SITE ZONE — a named part of the property that groups locations
12537
+ * ("Zona notte" holds the bedrooms). One call answers the whole picture:
12538
+ * key, the label as typed, the icon, and the locations inside.
12539
+ *
12540
+ * Together, because a surface that asked for membership separately could
12541
+ * draw a zone whose rooms it has not fetched — and the strip that renders
12542
+ * these puts zones BEFORE locations, so a half-known zone is the first
12543
+ * thing an operator sees.
12544
+ *
12545
+ * Nothing here touches a device: a camera's zone is derived from its
12546
+ * location, never stored on the row. Grouping rooms must not rewrite the
12547
+ * fleet. */
12548
+ listSiteZones: require_sleep.method(zod.z.void(), zod.z.array(SiteZoneSchema)),
12549
+ /** Create a zone, or set the icon of one that exists. `icon: null` clears
12550
+ * the icon and KEEPS the zone — a zone with no icon is a normal zone, and
12551
+ * conflating "no icon" with "no zone" would delete membership on a
12552
+ * mis-click.
12553
+ *
12554
+ * Idempotent, and the label is stored as typed: the key is folded, so
12555
+ * re-running this with different casing re-labels rather than duplicating. */
12556
+ setSiteZone: require_sleep.method(zod.z.object({
12557
+ name: zod.z.string(),
12558
+ icon: LocationIconIdSchema.nullable().optional()
12559
+ }), zod.z.void(), {
12560
+ kind: "mutation",
12561
+ auth: "admin"
12562
+ }),
12563
+ /** Delete a zone. Its LOCATIONS survive — they simply stop belonging to
12564
+ * anything. Deleting a grouping must never delete what was grouped. */
12565
+ removeSiteZone: require_sleep.method(zod.z.object({ name: zod.z.string() }), zod.z.void(), {
12566
+ kind: "mutation",
12567
+ auth: "admin"
12568
+ }),
12569
+ /** Rename a zone, carrying its icon AND its membership.
12570
+ *
12571
+ * It exists so that renaming is not delete-then-recreate, which would drop
12572
+ * both — the exact orphaning that lost a location's description when the
12573
+ * two hung off different keys. Renaming onto an existing zone MERGES into
12574
+ * it and the target keeps its own icon. */
12575
+ renameSiteZone: require_sleep.method(zod.z.object({
12576
+ from: zod.z.string(),
12577
+ to: zod.z.string()
12578
+ }), zod.z.void(), {
12579
+ kind: "mutation",
12580
+ auth: "admin"
12581
+ }),
12582
+ /** Put a location in a zone, or take it out with `zone: null`.
12583
+ *
12584
+ * At most one zone per location, by construction: this writes one key, so
12585
+ * there is no state in which a room is in two places at once. The zone
12586
+ * need not exist yet — it is created empty-labelled from this call, the
12587
+ * same way `setLocationIcon` does not require a registered location. */
12588
+ setLocationZone: require_sleep.method(zod.z.object({
12589
+ location: zod.z.string(),
12590
+ zone: zod.z.string().nullable()
12591
+ }), zod.z.void(), {
12592
+ kind: "mutation",
12593
+ auth: "admin"
12594
+ }),
12368
12595
  /** Soft-disable / re-enable the device. Drivers consult
12369
12596
  * `BaseDevice.disabled` to gate lifecycle hooks. */
12370
12597
  setDisabled: require_sleep.method(zod.z.object({
@@ -44999,6 +45226,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
44999
45226
  addonId: null,
45000
45227
  access: "view"
45001
45228
  },
45229
+ "deviceManager.listLocationDescriptions": {
45230
+ capName: "device-manager",
45231
+ capScope: "system",
45232
+ addonId: null,
45233
+ access: "view"
45234
+ },
45002
45235
  "deviceManager.listLocationIcons": {
45003
45236
  capName: "device-manager",
45004
45237
  capScope: "system",
@@ -45017,6 +45250,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
45017
45250
  addonId: null,
45018
45251
  access: "view"
45019
45252
  },
45253
+ "deviceManager.listSiteZones": {
45254
+ capName: "device-manager",
45255
+ capScope: "system",
45256
+ addonId: null,
45257
+ access: "view"
45258
+ },
45020
45259
  "deviceManager.listWrappersForCap": {
45021
45260
  capName: "device-manager",
45022
45261
  capScope: "system",
@@ -45101,12 +45340,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
45101
45340
  addonId: null,
45102
45341
  access: "delete"
45103
45342
  },
45343
+ "deviceManager.removeSiteZone": {
45344
+ capName: "device-manager",
45345
+ capScope: "system",
45346
+ addonId: null,
45347
+ access: "delete"
45348
+ },
45104
45349
  "deviceManager.renameLocation": {
45105
45350
  capName: "device-manager",
45106
45351
  capScope: "system",
45107
45352
  addonId: null,
45108
45353
  access: "create"
45109
45354
  },
45355
+ "deviceManager.renameSiteZone": {
45356
+ capName: "device-manager",
45357
+ capScope: "system",
45358
+ addonId: null,
45359
+ access: "create"
45360
+ },
45110
45361
  "deviceManager.runDeviceAction": {
45111
45362
  capName: "device-manager",
45112
45363
  capScope: "system",
@@ -45149,12 +45400,24 @@ var METHOD_ACCESS_MAP = Object.freeze({
45149
45400
  addonId: null,
45150
45401
  access: "create"
45151
45402
  },
45403
+ "deviceManager.setLocationDescription": {
45404
+ capName: "device-manager",
45405
+ capScope: "system",
45406
+ addonId: null,
45407
+ access: "create"
45408
+ },
45152
45409
  "deviceManager.setLocationIcon": {
45153
45410
  capName: "device-manager",
45154
45411
  capScope: "system",
45155
45412
  addonId: null,
45156
45413
  access: "create"
45157
45414
  },
45415
+ "deviceManager.setLocationZone": {
45416
+ capName: "device-manager",
45417
+ capScope: "system",
45418
+ addonId: null,
45419
+ access: "create"
45420
+ },
45158
45421
  "deviceManager.setMetadata": {
45159
45422
  capName: "device-manager",
45160
45423
  capScope: "system",
@@ -45185,6 +45448,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
45185
45448
  addonId: null,
45186
45449
  access: "create"
45187
45450
  },
45451
+ "deviceManager.setSiteZone": {
45452
+ capName: "device-manager",
45453
+ capScope: "system",
45454
+ addonId: null,
45455
+ access: "create"
45456
+ },
45188
45457
  "deviceManager.setStreamProfileMap": {
45189
45458
  capName: "device-manager",
45190
45459
  capScope: "system",
@@ -52775,6 +53044,13 @@ function createSystemProxy(api) {
52775
53044
  renameLocation: (input) => dispatch("deviceManager", "renameLocation", "mutation", input),
52776
53045
  listLocationIcons: (input) => dispatch("deviceManager", "listLocationIcons", "query", input),
52777
53046
  setLocationIcon: (input) => dispatch("deviceManager", "setLocationIcon", "mutation", input),
53047
+ listLocationDescriptions: (input) => dispatch("deviceManager", "listLocationDescriptions", "query", input),
53048
+ setLocationDescription: (input) => dispatch("deviceManager", "setLocationDescription", "mutation", input),
53049
+ listSiteZones: (input) => dispatch("deviceManager", "listSiteZones", "query", input),
53050
+ setSiteZone: (input) => dispatch("deviceManager", "setSiteZone", "mutation", input),
53051
+ removeSiteZone: (input) => dispatch("deviceManager", "removeSiteZone", "mutation", input),
53052
+ renameSiteZone: (input) => dispatch("deviceManager", "renameSiteZone", "mutation", input),
53053
+ setLocationZone: (input) => dispatch("deviceManager", "setLocationZone", "mutation", input),
52778
53054
  listPersistedByAddon: (input) => dispatch("deviceManager", "listPersistedByAddon", "query", input),
52779
53055
  listAll: (input) => dispatch("deviceManager", "listAll", "query", input),
52780
53056
  getChildren: (input) => dispatch("deviceManager", "getChildren", "query", input),
@@ -57752,6 +58028,7 @@ exports.KeyEventSchema = KeyEventSchema;
57752
58028
  exports.LEGACY_READ_ONLY_CONFIG_KEY = LEGACY_READ_ONLY_CONFIG_KEY;
57753
58029
  exports.LOAD_CONTRIBUTION_ATTRIBUTIONS = LOAD_CONTRIBUTION_ATTRIBUTIONS;
57754
58030
  exports.LOAD_CONTRIBUTION_ROLES = LOAD_CONTRIBUTION_ROLES;
58031
+ exports.LOCATION_DESCRIPTION_MAX = LOCATION_DESCRIPTION_MAX;
57755
58032
  exports.LOCATION_ICON_FALLBACK = LOCATION_ICON_FALLBACK;
57756
58033
  exports.LOCATION_ICON_IDS = LOCATION_ICON_IDS;
57757
58034
  exports.LOG_CHANNEL_TICK_MS = LOG_CHANNEL_TICK_MS;
@@ -57794,6 +58071,7 @@ exports.LlmUsageRollupSchema = LlmUsageRollupSchema;
57794
58071
  exports.LlmUsageSchema = LlmUsageSchema;
57795
58072
  exports.LoadContributionSchema = LoadContributionSchema;
57796
58073
  exports.LocateSegmentResultSchema = LocateSegmentResultSchema;
58074
+ exports.LocationDescriptionAssignmentSchema = LocationDescriptionAssignmentSchema;
57797
58075
  exports.LocationIconAssignmentSchema = LocationIconAssignmentSchema;
57798
58076
  exports.LocationIconIdSchema = LocationIconIdSchema;
57799
58077
  exports.LocationStatSchema = LocationStatSchema;
@@ -58271,6 +58549,7 @@ exports.ShmRingStatsSchema = ShmRingStatsSchema;
58271
58549
  exports.SiteLocationSchema = SiteLocationSchema;
58272
58550
  exports.SiteLocationSourceSchema = SiteLocationSourceSchema;
58273
58551
  exports.SiteLocationStatusSchema = SiteLocationStatusSchema;
58552
+ exports.SiteZoneSchema = SiteZoneSchema;
58274
58553
  exports.SmokeStatusSchema = SmokeStatusSchema;
58275
58554
  exports.SmtpStatusSchema = SmtpStatusSchema;
58276
58555
  exports.SnapshotImageSchema = SnapshotImageSchema;
@@ -58855,6 +59134,7 @@ exports.setByPath = setByPath;
58855
59134
  exports.settingsStoreCapability = settingsStoreCapability;
58856
59135
  exports.signalPercentFromBars = signalPercentFromBars;
58857
59136
  exports.signalPercentFromRssi = signalPercentFromRssi;
59137
+ exports.siteZoneKey = siteZoneKey;
58858
59138
  exports.sleep = require_sleep.sleep;
58859
59139
  exports.sleepCancellable = require_sleep.sleepCancellable;
58860
59140
  exports.sliceActiveValue = sliceActiveValue;