@camstack/server 1.2.892 → 1.2.894

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/api/core/api-catalog.js +93 -0
  3. package/dist/api/core/api-catalog.router.js +74 -0
  4. package/dist/api/trpc/generated-cap-routers.js +10 -0
  5. package/dist/api/trpc/trpc.middleware.js +17 -0
  6. package/dist/api/trpc/trpc.router.js +10 -3
  7. package/package.json +16 -29
  8. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  9. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  10. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  11. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  12. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  13. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  14. package/system/dist/builtins/autotrack/index.js +1 -1
  15. package/system/dist/builtins/autotrack/index.mjs +1 -1
  16. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  17. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  18. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  19. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  20. package/system/dist/builtins/camera-grid/index.js +1 -1
  21. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  22. package/system/dist/builtins/composer/composer.addon.js +4 -4
  23. package/system/dist/builtins/composer/composer.addon.mjs +4 -4
  24. package/system/dist/builtins/console-logging/index.js +1 -1
  25. package/system/dist/builtins/console-logging/index.mjs +1 -1
  26. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  27. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  28. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  29. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  30. package/system/dist/builtins/device-manager/device-identity-index.d.ts +73 -0
  31. package/system/dist/builtins/device-manager/device-manager.addon.js +308 -17
  32. package/system/dist/builtins/device-manager/device-manager.addon.mjs +308 -17
  33. package/system/dist/builtins/device-manager/device-provider-context.d.ts +5 -0
  34. package/system/dist/builtins/device-manager/device-row-store.d.ts +4 -1
  35. package/system/dist/builtins/device-manager/device-state-mirror.d.ts +10 -0
  36. package/system/dist/builtins/device-manager/runtime-state-persist-gate.d.ts +20 -1
  37. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  38. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  39. package/system/dist/builtins/keychain/index.js +4 -4
  40. package/system/dist/builtins/keychain/index.mjs +4 -4
  41. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  42. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  43. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  44. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  45. package/system/dist/builtins/local-network/local-network.addon.js +3 -3
  46. package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
  47. package/system/dist/builtins/loki-logging/index.js +1 -1
  48. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  49. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  50. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  51. package/system/dist/builtins/platform-probe/index.js +1 -1
  52. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  53. package/system/dist/builtins/record-entries/index.js +1 -1
  54. package/system/dist/builtins/record-entries/index.mjs +1 -1
  55. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  56. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  57. package/system/dist/builtins/snapshot/index.js +1 -1
  58. package/system/dist/builtins/snapshot/index.mjs +1 -1
  59. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  60. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  61. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  62. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  63. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  64. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  65. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  66. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  67. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  68. package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
  69. package/system/dist/builtins/winston-logging/index.js +1 -1
  70. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  71. package/system/dist/{capture-engine-sl6e9f9S.mjs → capture-engine-6UsbHfRF.mjs} +1 -1
  72. package/system/dist/{capture-engine-DHmlkW_d.js → capture-engine-DhqkkOfH.js} +1 -1
  73. package/system/dist/{composition-sources-PqcZfe3j.js → composition-sources-AbyhP_uF.js} +1 -1
  74. package/system/dist/{composition-sources-CznD85Ri.mjs → composition-sources-DmDAqBqM.mjs} +1 -1
  75. package/system/dist/{constants-_2SOk0By.js → constants-CLyC9O9i.js} +1 -1
  76. package/system/dist/{constants-CHwj_mIM.mjs → constants-DMeh8SL7.mjs} +1 -1
  77. package/system/dist/{device-ca-D2H1EMUY.mjs → device-ca-BJ714blt.mjs} +1 -1
  78. package/system/dist/{device-ca-WIEO5ZcE.js → device-ca-C4odTE-a.js} +1 -1
  79. package/system/dist/{dist-yx2KHo3b.js → dist-BDciHA-9.js} +207 -25
  80. package/system/dist/{dist-DbAhCrHy.mjs → dist-DLp5CYDy.mjs} +196 -26
  81. package/system/dist/file-host-worker.js +1 -1
  82. package/system/dist/file-host-worker.mjs +1 -1
  83. package/system/dist/{hub-identity-Buegac-w.js → hub-identity-BLkehzWw.js} +1 -1
  84. package/system/dist/{hub-identity-BcvZqT0L.mjs → hub-identity-C6c6E6Xn.mjs} +1 -1
  85. package/system/dist/{hub-mdns-ciao-DcNPj7WJ.js → hub-mdns-ciao-ByOblmkT.js} +2 -2
  86. package/system/dist/{hub-mdns-ciao-B6K_dO2s.mjs → hub-mdns-ciao-oQtUklUf.mjs} +2 -2
  87. package/system/dist/index.js +8 -8
  88. package/system/dist/index.mjs +8 -8
  89. package/system/dist/{legacy-integration-rows-door-BsZyVNiR.js → legacy-integration-rows-door-CVwsY9u6.js} +1 -1
  90. package/system/dist/{legacy-integration-rows-door-DHOJeDPG.mjs → legacy-integration-rows-door-D_FBo1b1.mjs} +1 -1
  91. package/system/dist/{rename-composition-block-DcVS1LuC.mjs → rename-composition-block-CnA_Dslb.mjs} +1 -1
  92. package/system/dist/{rename-composition-block-BXMor7MR.js → rename-composition-block-_LotNQv9.js} +1 -1
  93. package/system/dist/{restore-archive-BURufVQd.js → restore-archive-CXPBPM61.js} +1 -1
  94. package/system/dist/{restore-archive-BG8VJ8Ar.mjs → restore-archive-WMuoi9Ve.mjs} +82 -82
  95. package/system/dist/{wal-maintenance-B4wGD6QR.mjs → wal-maintenance-COXWd5qA.mjs} +0 -0
  96. package/system/dist/{wal-maintenance-CeaJyKNT.js → wal-maintenance-h2cm6gDJ.js} +0 -0
  97. package/system/package.json +1 -1
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-yx2KHo3b.js");
6
+ const require_dist = require("../../dist-BDciHA-9.js");
7
7
  const require_formatter = require("../../formatter-xbxeV4GD.js");
8
8
  const require_log_file_read_protocol = require("../../log-file-read-protocol-DSV_vQRb.js");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { Ra as preconditionOf, ll as defineAddonMigrations, na as logDestinationCapability, uc as BaseAddon } from "../../dist-DbAhCrHy.mjs";
1
+ import { Ba as preconditionOf, dl as defineAddonMigrations, fc as BaseAddon, ia as logDestinationCapability } from "../../dist-DLp5CYDy.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
3
3
  import { a as LogFileIndexStore, i as serveRead, n as isFromReader, t as CancelBook } from "../../log-file-read-protocol-hTaAsYlX.mjs";
4
4
  import { createRequire } from "node:module";
@@ -1,4 +1,4 @@
1
- import { bc as HISTORY_DEFAULT_MIN_INTERVAL_MS, lu as DeviceType, yl as historyItemFieldPath } from "./dist-DbAhCrHy.mjs";
1
+ import { Sc as HISTORY_DEFAULT_MIN_INTERVAL_MS, du as DeviceType, xl as historyItemFieldPath } from "./dist-DLp5CYDy.mjs";
2
2
  //#region src/builtins/device-history/store/series-registry.ts
3
3
  function subjectIdOf(subject) {
4
4
  return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-yx2KHo3b.js");
1
+ const require_dist = require("./dist-BDciHA-9.js");
2
2
  //#region src/builtins/device-history/store/series-registry.ts
3
3
  function subjectIdOf(subject) {
4
4
  return subject.kind === "device" ? `d:${subject.deviceId}` : `n:${subject.nodeId}`;
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-yx2KHo3b.js");
1
+ const require_dist = require("./dist-BDciHA-9.js");
2
2
  //#region src/builtins/shared/device-state-changed.ts
3
3
  /** Structural narrowing helper for untrusted bus payloads. */
4
4
  function isRecord(value) {
@@ -1,4 +1,4 @@
1
- import { Ws as compositionSourceKey, uu as errMsg } from "./dist-DbAhCrHy.mjs";
1
+ import { Ks as compositionSourceKey, fu as errMsg } from "./dist-DLp5CYDy.mjs";
2
2
  //#region src/builtins/shared/device-state-changed.ts
3
3
  /** Structural narrowing helper for untrusted bus payloads. */
4
4
  function isRecord(value) {
@@ -1,5 +1,5 @@
1
1
  /** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
2
- var MESH_CA_KEY_REF = require("./dist-yx2KHo3b.js").buildSecretRef({
2
+ var MESH_CA_KEY_REF = require("./dist-BDciHA-9.js").buildSecretRef({
3
3
  owner: "system",
4
4
  scope: { kind: "global" },
5
5
  fieldPath: "meshCaKey"
@@ -1,4 +1,4 @@
1
- import { el as buildSecretRef } from "./dist-DbAhCrHy.mjs";
1
+ import { nl as buildSecretRef } from "./dist-DLp5CYDy.mjs";
2
2
  /** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
3
3
  var MESH_CA_KEY_REF = buildSecretRef({
4
4
  owner: "system",
@@ -1,4 +1,4 @@
1
- import { K as DEVICE_SAN_CREDENTIAL_PREFIX, el as buildSecretRef, q as DEVICE_SAN_USER_PREFIX } from "./dist-DbAhCrHy.mjs";
1
+ import { J as DEVICE_SAN_USER_PREFIX, nl as buildSecretRef, q as DEVICE_SAN_CREDENTIAL_PREFIX } from "./dist-DLp5CYDy.mjs";
2
2
  import { C as backdatedNotBefore, S as withUtcTimeEncoding, a as KeyUsageFlags, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension } from "./x509.es-BRiJgOvu.mjs";
3
3
  import { X509Certificate, createPublicKey, randomBytes, verify, webcrypto } from "node:crypto";
4
4
  //#region src/auth/jwt-signing-key.ts
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-yx2KHo3b.js");
1
+ const require_dist = require("./dist-BDciHA-9.js");
2
2
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  //#region src/auth/jwt-signing-key.ts
@@ -832,7 +832,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
832
832
  return EventCategory;
833
833
  }({});
834
834
  //#endregion
835
- //#region ../types/dist/composed-stable-id-BBL71oUQ.mjs
835
+ //#region ../types/dist/composed-stable-id-Kt5VKzGZ.mjs
836
836
  /**
837
837
  import { errMsg } from '@camstack/types'
838
838
  * Extract a human-readable message from an unknown error value.
@@ -1060,9 +1060,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1060
1060
  DeviceFeature["FanDirection"] = "fan-direction";
1061
1061
  /** Fan exposes an oscillation toggle. */
1062
1062
  DeviceFeature["FanOscillating"] = "fan-oscillating";
1063
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
1064
- * field on the UI lock-controls panel. */
1065
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
1066
1063
  /** Lock supports a latch-release ("open door") action distinct from
1067
1064
  * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
1068
1065
  * `supported_features`. Gates the Open Door button in the UI. */
@@ -1093,8 +1090,6 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1093
1090
  DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
1094
1091
  /** Media player exposes power on / off. */
1095
1092
  DeviceFeature["MediaPlayerPower"] = "media-player-power";
1096
- /** Alarm panel requires a PIN code on arm/disarm. */
1097
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
1098
1093
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
1099
1094
  * addition to a textual location. */
1100
1095
  DeviceFeature["PresenceGps"] = "presence-gps";
@@ -1302,7 +1297,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1302
1297
  */
1303
1298
  var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
1304
1299
  //#endregion
1305
- //#region ../types/dist/sleep-D6Pih0Qt.mjs
1300
+ //#region ../types/dist/sleep-CFN40XWx.mjs
1306
1301
  /**
1307
1302
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1308
1303
  * window to float samples (D455).
@@ -16984,7 +16979,7 @@ Object.freeze({
16984
16979
  ]
16985
16980
  },
16986
16981
  {
16987
- "path": "requiresCode",
16982
+ "path": "codeRequired",
16988
16983
  "valueType": "boolean"
16989
16984
  }
16990
16985
  ],
@@ -18052,6 +18047,9 @@ Object.freeze({
18052
18047
  "jammed",
18053
18048
  "door-open"
18054
18049
  ]
18050
+ }, {
18051
+ "path": "codeRequired",
18052
+ "valueType": "boolean"
18055
18053
  }],
18056
18054
  "media-player": [
18057
18055
  {
@@ -19361,7 +19359,7 @@ function sleep(ms) {
19361
19359
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
19362
19360
  }
19363
19361
  //#endregion
19364
- //#region ../types/dist/implemented-methods-u7ddjc-_.mjs
19362
+ //#region ../types/dist/implemented-methods-BiV3Y-40.mjs
19365
19363
  var AUDIO_ENCODER_BY_CODEC = {
19366
19364
  opus: "libopus",
19367
19365
  aac: "aac",
@@ -48256,6 +48254,68 @@ zod.z.object({
48256
48254
  /** Namespaces the client listed that no longer exist. */
48257
48255
  deleted: zod.z.array(PreferenceNamespaceSchema)
48258
48256
  });
48257
+ /**
48258
+ * The wire shapes of `apiCatalog.*` — the API explorer's data (planning#595).
48259
+ *
48260
+ * One entry per tRPC method the hub serves, capability and core routes alike,
48261
+ * read off the live router by the hub (never a hand-written list).
48262
+ */
48263
+ var ApiProcedureKindSchema = zod.z.enum([
48264
+ "query",
48265
+ "mutation",
48266
+ "subscription"
48267
+ ]);
48268
+ /** The gate a method runs behind. */
48269
+ var ApiProcedureTierSchema = zod.z.enum([
48270
+ "public",
48271
+ "protected",
48272
+ "admin"
48273
+ ]);
48274
+ /** The token scope a capability route is matched against (its `METHOD_ACCESS_MAP` row). */
48275
+ var ApiCatalogScopeSchema = zod.z.object({
48276
+ capName: zod.z.string(),
48277
+ capScope: zod.z.enum(["device", "system"]),
48278
+ access: zod.z.enum([
48279
+ "view",
48280
+ "create",
48281
+ "delete"
48282
+ ]),
48283
+ role: zod.z.string()
48284
+ });
48285
+ var ApiCatalogEntrySchema = zod.z.object({
48286
+ /** `<router>.<method>` — the tRPC path. */
48287
+ path: zod.z.string(),
48288
+ router: zod.z.string(),
48289
+ method: zod.z.string(),
48290
+ kind: ApiProcedureKindSchema,
48291
+ tier: ApiProcedureTierSchema,
48292
+ source: zod.z.enum(["capability", "core"]),
48293
+ /** `null` on a core route: it needs authentication only (plus admin where its tier says so). */
48294
+ scope: ApiCatalogScopeSchema.nullable(),
48295
+ hasInput: zod.z.boolean()
48296
+ });
48297
+ /**
48298
+ * May the CALLER call a method. The list has no input, so a method reached
48299
+ * only through a device grant is `per-device`: the real call is allowed or
48300
+ * refused on the device its input names.
48301
+ */
48302
+ var ApiCallableSchema = zod.z.enum([
48303
+ "yes",
48304
+ "no",
48305
+ "per-device"
48306
+ ]);
48307
+ var ApiCatalogMethodSchema = ApiCatalogEntrySchema.extend({ callable: ApiCallableSchema });
48308
+ zod.z.object({ methods: zod.z.array(ApiCatalogMethodSchema) });
48309
+ /** A JSON Schema document, as the explorer receives it. */
48310
+ var JsonSchemaDocumentSchema = zod.z.record(zod.z.string(), zod.z.unknown());
48311
+ zod.z.object({
48312
+ path: zod.z.string(),
48313
+ hasInput: zod.z.boolean(),
48314
+ /** The INPUT JSON schema (what the caller sends); `null` without input or when it could not be produced. */
48315
+ schema: JsonSchemaDocumentSchema.nullable(),
48316
+ /** Why no schema could be produced (a non-Zod parser, an unrepresentable type). */
48317
+ error: zod.z.string().nullable()
48318
+ });
48259
48319
  zod.z.enum(["new-session", "step-up"]);
48260
48320
  /** The languages the hub's app landing pages are written in (D858). */
48261
48321
  var AppPageLangSchema = zod.z.enum(["en", "it"]);
@@ -56739,9 +56799,8 @@ var airQualitySensorCapability = {
56739
56799
  * Many panels require a PIN code on arm / disarm — the optional
56740
56800
  * `code` field on the methods passes it through to the upstream
56741
56801
  * service; it's NEVER persisted in the runtime slice or any event
56742
- * payload. The presence of a required code is signalled by
56743
- * `DeviceFeature.AlarmPinRequired` so the UI gates a code-entry
56744
- * field without a slice fetch.
56802
+ * payload. Whether a code is required is the slice's `codeRequired`
56803
+ * (#459): `null` when the provider cannot tell (D393).
56745
56804
  *
56746
56805
  * `availableModes` mirrors HA's `supported_features`-derived arm
56747
56806
  * mode list — the UI renders only the buttons the panel accepts.
@@ -56780,9 +56839,13 @@ var AlarmPanelStatusSchema = zod.z.object({
56780
56839
  /** Subset of arm modes the panel accepts. UI renders one button per
56781
56840
  * mode in this list. */
56782
56841
  availableModes: zod.z.array(AlarmArmModeSchema),
56783
- /** Whether the panel requires a PIN on arm / disarm. Mirrors
56784
- * `DeviceFeature.AlarmPinRequired` for slice consumers. */
56785
- requiresCode: zod.z.boolean(),
56842
+ /**
56843
+ * Whether the panel requires a PIN on arm / disarm (#459; the field was
56844
+ * `requiresCode`, and the `alarm-pin-required` device feature is gone).
56845
+ * `null` = the provider cannot tell (D393), never `false`. A slice restored
56846
+ * from before the rename is upgraded at boot by `restoredFieldRenames`.
56847
+ */
56848
+ codeRequired: zod.z.boolean().nullable(),
56786
56849
  /** Ms epoch when the slice was last updated. */
56787
56850
  lastChangedAt: zod.z.number()
56788
56851
  });
@@ -56839,7 +56902,7 @@ var alarmPanelCapability = {
56839
56902
  arm: method(zod.z.object({
56840
56903
  deviceId: zod.z.number().int().nonnegative(),
56841
56904
  mode: AlarmArmModeSchema,
56842
- /** Optional PIN code. Required when `requiresCode === true`.
56905
+ /** Optional PIN code. Required when `codeRequired === true`.
56843
56906
  * Passed through to the upstream service; never persisted. */
56844
56907
  code: zod.z.string().min(1).optional()
56845
56908
  }), zod.z.void(), {
@@ -56956,7 +57019,7 @@ var alarmPanelCapability = {
56956
57019
  /**
56957
57020
  * Runtime-state slice — mirrored by the kernel. UI panel reads the
56958
57021
  * full slice; renders an arm button per `availableModes` entry and
56959
- * a PIN field iff `requiresCode === true`.
57022
+ * a PIN field iff `codeRequired === true`.
56960
57023
  */
56961
57024
  runtimeState: AlarmPanelStatusSchema,
56962
57025
  /**
@@ -56967,6 +57030,13 @@ var alarmPanelCapability = {
56967
57030
  */
56968
57031
  durability: "restored",
56969
57032
  /**
57033
+ * A slice persisted before #459 carries `requiresCode`; the boot seed reads it
57034
+ * once into `codeRequired` (`restoredPart`), so no reader meets the old key,
57035
+ * and rewrites the row once without it (`seedMirrorFromRow`) — so this entry
57036
+ * can be dropped after every node has booted once on a release that has it.
57037
+ */
57038
+ restoredFieldRenames: { requiresCode: "codeRequired" },
57039
+ /**
56970
57040
  * History (D850): the panel's lifecycle state as an `enum` series —
56971
57041
  * change-only, no floor, so an `arming -> pending -> triggered` sequence of a
56972
57042
  * few seconds keeps every step. Who armed it stays in the events ledger.
@@ -71146,6 +71216,18 @@ var DeviceIdentifiersSchema = zod.z.object({
71146
71216
  hostname: HostnameEntrySchema.optional(),
71147
71217
  ip: IpEntrySchema.optional()
71148
71218
  }).strict();
71219
+ var STRENGTH = {
71220
+ mac: "strong",
71221
+ serial: "strong",
71222
+ "machine-uuid": "strong",
71223
+ "vendor-uid": "strong",
71224
+ hostname: "weak",
71225
+ ip: "weak"
71226
+ };
71227
+ /** How much a match on this key says about two devices being the same object. */
71228
+ function identifierStrength(key) {
71229
+ return STRENGTH[key];
71230
+ }
71149
71231
  /** True when the declaration carries no key at all. */
71150
71232
  function isEmptyIdentifiers(identifiers) {
71151
71233
  return DEVICE_IDENTIFIER_KEYS.every((key) => identifiers[key] === void 0);
@@ -71327,6 +71409,69 @@ function sameIdentifiers(a, b) {
71327
71409
  ])]));
71328
71410
  return canonical(a) === canonical(b);
71329
71411
  }
71412
+ /**
71413
+ * Cross-integration identity candidates (planning#593, step 2 of D1059's epic).
71414
+ *
71415
+ * Two devices brought by DIFFERENT integrations that share provider-declared
71416
+ * identifiers ({@link DeviceIdentifiers}) are candidates for being the same
71417
+ * physical object. This module holds the answer's shape; the device-manager
71418
+ * keeps the index that finds the pairs and the ONE rule that grades a match
71419
+ * (`classifyIdentityMatch`, `device-identity-index.ts`).
71420
+ *
71421
+ * The rule (operator, planning#590):
71422
+ *
71423
+ * | Matched keys | Confidence |
71424
+ * | ---------------------------------------------- | ----------- |
71425
+ * | two strong KINDS (e.g. `mac` + `serial`) | `auto` |
71426
+ * | `mac` + `ip` | `auto` |
71427
+ * | exactly one strong kind | `proposal` |
71428
+ * | weak keys only (`hostname`, `ip`) | no candidate|
71429
+ *
71430
+ * Strength counts distinct KINDS, not values: two MACs of one device matching
71431
+ * the other's two MACs are still one kind of evidence, so a proposal. In doubt,
71432
+ * no match.
71433
+ *
71434
+ * Read-only: a candidate is NOT a link. Links are step 3.
71435
+ */
71436
+ var IdentityConfidenceSchema = zod.z.enum(["auto", "proposal"]);
71437
+ /** One identifier both devices declared, with the same normalised value. */
71438
+ var IdentityMatchedKeySchema = zod.z.object({
71439
+ key: DeviceIdentifierKeySchema,
71440
+ value: zod.z.string()
71441
+ });
71442
+ /** One side of a pair: the device and the integration that brought it. */
71443
+ var IdentityCandidateDeviceSchema = zod.z.object({
71444
+ deviceId: zod.z.number().int(),
71445
+ addonId: zod.z.string(),
71446
+ /** The integration instance (`int_NNNN`) that adopted it; `null` when none was stamped. */
71447
+ integrationId: zod.z.string().nullable()
71448
+ });
71449
+ /** Two devices of different integrations sharing at least one strong identifier. `a.deviceId < b.deviceId`. */
71450
+ var IdentityCandidatePairSchema = zod.z.object({
71451
+ a: IdentityCandidateDeviceSchema,
71452
+ b: IdentityCandidateDeviceSchema,
71453
+ /** Every identifier the two share, weak ones included, ordered by key then value. */
71454
+ keys: zod.z.array(IdentityMatchedKeySchema).readonly(),
71455
+ confidence: IdentityConfidenceSchema
71456
+ });
71457
+ /**
71458
+ * The answer of `device-manager.listIdentityCandidates`.
71459
+ *
71460
+ * - `unknown` — the index has not loaded yet: nothing can be said, and it is
71461
+ * NOT an empty list (D315).
71462
+ * - `answered` — `pairs` holds every candidate. `undeclaredDeviceIds` are the
71463
+ * devices with no identifiers on record: whether they match anything is
71464
+ * UNKNOWN, never "no match" (D393). A device absent from both lists declared
71465
+ * identifiers and matched nobody.
71466
+ */
71467
+ var IdentityCandidatesSchema = zod.z.discriminatedUnion("status", [zod.z.object({
71468
+ status: zod.z.literal("unknown"),
71469
+ reason: zod.z.string()
71470
+ }), zod.z.object({
71471
+ status: zod.z.literal("answered"),
71472
+ pairs: zod.z.array(IdentityCandidatePairSchema).readonly(),
71473
+ undeclaredDeviceIds: zod.z.array(zod.z.number().int()).readonly()
71474
+ })]);
71330
71475
  var DeviceSearchRequiresSchema = zod.z.object({
71331
71476
  /** Capability names the field wants a value of. Absent when the field wants actions only. */
71332
71477
  caps: zod.z.array(zod.z.string()).readonly().optional(),
@@ -72562,6 +72707,18 @@ var deviceManagerCapability = {
72562
72707
  kind: "mutation",
72563
72708
  auth: "admin"
72564
72709
  }),
72710
+ /** Cross-integration identity candidates (planning#593) — READ-ONLY, links
72711
+ * nothing. Every pair of devices from DIFFERENT integrations that share a
72712
+ * strong identifier, with the keys they share and a confidence: `auto` (two
72713
+ * strong kinds, or `mac` + `ip`), `proposal` (one strong kind). Weak keys
72714
+ * alone never pair; a same-integration match is no candidate. Answered from
72715
+ * the device-manager's identifier index, never a fleet scan. `unknown`
72716
+ * until the index has loaded (never an empty list); `undeclaredDeviceIds`
72717
+ * are the devices whose identity is unknown, never "no match". */
72718
+ listIdentityCandidates: method(zod.z.object({}), IdentityCandidatesSchema, {
72719
+ kind: "query",
72720
+ auth: "admin"
72721
+ }),
72565
72722
  /** Operator-curated location registry. Returns the union of:
72566
72723
  * (1) labels persisted in the registry via `addLocation`, and
72567
72724
  * (2) labels currently in use on at least one device's
@@ -83315,8 +83472,8 @@ var localNetworkCapability = {
83315
83472
  * (workplace keypad locks, hospitality). The optional `code` field
83316
83473
  * on the methods passes it through to the upstream service — the
83317
83474
  * code is NEVER persisted in the runtime slice or any event payload.
83318
- * Locks that REQUIRE a code set `DeviceFeature.LockPinRequired` so
83319
- * the UI gates a code-entry field without a slice fetch.
83475
+ * Whether a lock REQUIRES a code is the slice's `codeRequired` (#459):
83476
+ * `true` / `false` when the provider knows, `null` when it does not (D393).
83320
83477
  *
83321
83478
  * Locks that support a latch-release ("open door") action advertise
83322
83479
  * `DeviceFeature.LockOpen`. The `open` method triggers the latch
@@ -83345,6 +83502,13 @@ var LockControlStatusSchema = zod.z.object({
83345
83502
  /** Lifecycle state of the lock. `jammed` means the motor reported
83346
83503
  * failure to reach the target — operator intervention required. */
83347
83504
  state: LockStateSchema,
83505
+ /**
83506
+ * Whether lock / unlock need a PIN `code` (#459, replaces the
83507
+ * `lock-pin-required` device feature). `null` = the provider cannot tell
83508
+ * (D393) — never `false`. `.optional()` so a restored slice written before
83509
+ * the field still parses; readers treat absent exactly like `null`.
83510
+ */
83511
+ codeRequired: zod.z.boolean().nullable().optional(),
83348
83512
  /** Ms epoch when the slice was last updated. */
83349
83513
  lastChangedAt: zod.z.number()
83350
83514
  });
@@ -118459,8 +118623,8 @@ var ALARM_MODES = [
118459
118623
  "vacation",
118460
118624
  "custom_bypass"
118461
118625
  ];
118462
- function alarmControls(state, modes, requiresCode) {
118463
- if (requiresCode) return [];
118626
+ function alarmControls(state, modes, codeRequired) {
118627
+ if (codeRequired) return [];
118464
118628
  const disarm = asAction(action("alarm.disarm", t("Disarm", "Disinserisci"), "shield-off", "alarm-panel", "disarm", {}, "primary"));
118465
118629
  const arm = (primaryFirst) => modes.map((mode, i) => asAction(action(`alarm.arm.${mode}`, ARM_LABELS[mode], "shield-check", "alarm-panel", "arm", { mode }, primaryFirst && i === 0 ? "primary" : "normal")));
118466
118630
  switch (state) {
@@ -118480,7 +118644,7 @@ var ACCESS_FAMILY_CONTRIBUTIONS = {
118480
118644
  const modes = slice === void 0 ? ALARM_MODES : slice.availableModes;
118481
118645
  return {
118482
118646
  reading: reading("alarm-panel", words?.state ?? "unknown", false, words?.title),
118483
- rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.requiresCode ?? false))],
118647
+ rows: [row$1("alarm", state === "triggered" ? "shield-alert" : state === "disarmed" ? "shield-off" : "shield-check", joinText([words?.title ?? NOT_REPORTED, since]), alarmControls(state, modes, slice?.codeRequired !== false))],
118484
118648
  ...since === null || words === null ? {} : { facts: [fact("since", "clock", since, state === "triggered" ? "danger" : "muted")] },
118485
118649
  ...words === null ? {} : { tiles: {
118486
118650
  left: [{
@@ -124689,6 +124853,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
124689
124853
  access: "view",
124690
124854
  role: "admin"
124691
124855
  },
124856
+ "deviceManager.listIdentityCandidates": {
124857
+ capName: "device-manager",
124858
+ capScope: "system",
124859
+ addonId: null,
124860
+ access: "view",
124861
+ role: "admin"
124862
+ },
124692
124863
  "deviceManager.listLocationDescriptions": {
124693
124864
  capName: "device-manager",
124694
124865
  capScope: "system",
@@ -133012,7 +133183,6 @@ var DEVICE_FEATURE_REQUIREMENTS = {
133012
133183
  [DeviceFeature.FanPreset]: bound("fan-control", ["setPreset"]),
133013
133184
  [DeviceFeature.FanDirection]: bound("fan-control", ["setDirection"]),
133014
133185
  [DeviceFeature.FanOscillating]: bound("fan-control", ["setOscillating"]),
133015
- [DeviceFeature.LockPinRequired]: reported(CAP_PENDING),
133016
133186
  [DeviceFeature.LockOpen]: bound("lock-control", ["open"]),
133017
133187
  [DeviceFeature.MediaPlayerSeek]: bound("media-player", ["seek"]),
133018
133188
  [DeviceFeature.MediaPlayerVolume]: bound("media-player", ["setVolume"]),
@@ -133027,7 +133197,6 @@ var DEVICE_FEATURE_REQUIREMENTS = {
133027
133197
  [DeviceFeature.MediaPlayerVolumeStep]: bound("media-player", ["volumeUp", "volumeDown"]),
133028
133198
  [DeviceFeature.MediaPlayerChannelStep]: bound("media-player", ["channelUp", "channelDown"]),
133029
133199
  [DeviceFeature.MediaPlayerPower]: bound("media-player", ["turnOn", "turnOff"]),
133030
- [DeviceFeature.AlarmPinRequired]: reported(CAP_PENDING),
133031
133200
  [DeviceFeature.PresenceGps]: reported(CAP_PENDING),
133032
133201
  [DeviceFeature.NotifierImage]: reported(CAP_PENDING),
133033
133202
  [DeviceFeature.NotifierPriority]: reported(CAP_PENDING),
@@ -136531,7 +136700,8 @@ var RUNTIME_STATE_POLICY = {
136531
136700
  },
136532
136701
  "alarm-panel": {
136533
136702
  durability: "restored",
136534
- volatileFields: ["lastChangedAt"]
136703
+ volatileFields: ["lastChangedAt"],
136704
+ renamedFields: { requiresCode: "codeRequired" }
136535
136705
  },
136536
136706
  "ambient-light-sensor": {
136537
136707
  durability: "restored",
@@ -139234,6 +139404,12 @@ Object.defineProperty(exports, "DEVICE_HISTORY_ENERGY_KEY", {
139234
139404
  return DEVICE_HISTORY_ENERGY_KEY;
139235
139405
  }
139236
139406
  });
139407
+ Object.defineProperty(exports, "DEVICE_IDENTIFIER_KEYS", {
139408
+ enumerable: true,
139409
+ get: function() {
139410
+ return DEVICE_IDENTIFIER_KEYS;
139411
+ }
139412
+ });
139237
139413
  Object.defineProperty(exports, "DEVICE_ID_FIELD", {
139238
139414
  enumerable: true,
139239
139415
  get: function() {
@@ -140944,6 +141120,12 @@ Object.defineProperty(exports, "hydrateSchema", {
140944
141120
  return hydrateSchema;
140945
141121
  }
140946
141122
  });
141123
+ Object.defineProperty(exports, "identifierStrength", {
141124
+ enumerable: true,
141125
+ get: function() {
141126
+ return identifierStrength;
141127
+ }
141128
+ });
140947
141129
  Object.defineProperty(exports, "implementedMethodsOf", {
140948
141130
  enumerable: true,
140949
141131
  get: function() {