@camstack/server 1.2.827 → 1.2.829

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 (127) hide show
  1. package/CHANGELOG.md +20 -3
  2. package/dist/agent/agent-boot-mode.js +14 -1
  3. package/dist/agent/agent-http.js +12 -0
  4. package/dist/agent/agent-hub-rediscovery.js +205 -0
  5. package/dist/agent/agent-membership-watch.js +29 -1
  6. package/dist/agent/agent-pairing-store.js +47 -3
  7. package/dist/agent/hubs-found.js +1 -0
  8. package/dist/agent/main.js +64 -6
  9. package/dist/api/core/agent-pairing.router.js +9 -0
  10. package/dist/api/core/cluster-update.provider.js +98 -0
  11. package/dist/api/mesh-membership-routes.js +3 -2
  12. package/dist/api/trpc/generated-cap-mounts.js +2 -1
  13. package/dist/api/trpc/generated-cap-routers.js +2339 -2286
  14. package/dist/api/trpc/server-provided-caps.js +1 -0
  15. package/dist/api/trpc/trpc.router.js +5 -0
  16. package/dist/auth/auth-provider-gate.js +6 -2
  17. package/dist/core/addon/device-meta-mirror.js +1 -0
  18. package/dist/core/cluster-update/cluster-update-job-store.js +106 -0
  19. package/dist/core/cluster-update/cluster-update-plan.js +147 -0
  20. package/dist/core/cluster-update/cluster-update-seams.js +13 -0
  21. package/dist/core/cluster-update/cluster-update-steps.js +293 -0
  22. package/dist/core/cluster-update/cluster-update.service.js +319 -0
  23. package/dist/main.js +3 -0
  24. package/dist/manual-boot.js +19 -0
  25. package/package.json +17 -41
  26. package/system/dist/addon-runner.js +12 -0
  27. package/system/dist/addon-runner.mjs +12 -0
  28. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  29. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  30. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  31. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  32. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  33. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  34. package/system/dist/builtins/autotrack/index.js +1 -1
  35. package/system/dist/builtins/autotrack/index.mjs +1 -1
  36. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  37. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  38. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  39. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  40. package/system/dist/builtins/camera-grid/index.js +1 -1
  41. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  42. package/system/dist/builtins/composer/composer.addon.js +17 -6
  43. package/system/dist/builtins/composer/composer.addon.mjs +17 -6
  44. package/system/dist/builtins/composer/graft-host.d.ts +2 -0
  45. package/system/dist/builtins/console-logging/index.js +1 -1
  46. package/system/dist/builtins/console-logging/index.mjs +1 -1
  47. package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
  48. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
  49. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  50. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  51. package/system/dist/builtins/device-manager/device-aggregation.d.ts +25 -1
  52. package/system/dist/builtins/device-manager/device-manager.addon.d.ts +6 -0
  53. package/system/dist/builtins/device-manager/device-manager.addon.js +354 -7
  54. package/system/dist/builtins/device-manager/device-manager.addon.mjs +354 -7
  55. package/system/dist/builtins/device-manager/device-meta-actions.d.ts +6 -0
  56. package/system/dist/builtins/device-manager/device-meta-types.d.ts +4 -0
  57. package/system/dist/builtins/device-manager/device-row-store.d.ts +2 -1
  58. package/system/dist/builtins/device-manager/device-search.d.ts +42 -0
  59. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  60. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  61. package/system/dist/builtins/keychain/index.js +4 -4
  62. package/system/dist/builtins/keychain/index.mjs +4 -4
  63. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  64. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  65. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  66. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  67. package/system/dist/builtins/local-network/hub-mdns.d.ts +5 -1
  68. package/system/dist/builtins/local-network/local-network.addon.js +24 -13
  69. package/system/dist/builtins/local-network/local-network.addon.mjs +24 -13
  70. package/system/dist/builtins/loki-logging/index.js +1 -1
  71. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  72. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  73. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  74. package/system/dist/builtins/platform-probe/index.js +1 -1
  75. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  76. package/system/dist/builtins/record-entries/index.js +1 -1
  77. package/system/dist/builtins/record-entries/index.mjs +1 -1
  78. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  79. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  80. package/system/dist/builtins/snapshot/index.js +1 -1
  81. package/system/dist/builtins/snapshot/index.mjs +1 -1
  82. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  83. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  84. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  85. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  86. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  87. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  88. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  89. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  90. package/system/dist/builtins/system-config/system-config.addon.js +59 -20
  91. package/system/dist/builtins/system-config/system-config.addon.mjs +48 -10
  92. package/system/dist/builtins/winston-logging/index.js +1 -1
  93. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  94. package/system/dist/{capture-engine-B0yQx6hA.mjs → capture-engine-CsFrmbpC.mjs} +1 -1
  95. package/system/dist/{capture-engine-1A7HAX3x.js → capture-engine-Cvetsl63.js} +1 -1
  96. package/system/dist/{composition-sources-CyJ0d6Sc.mjs → composition-sources-Yw0KDrdI.mjs} +1 -1
  97. package/system/dist/{composition-sources-BzM19ASO.js → composition-sources-wNOckeFb.js} +1 -1
  98. package/system/dist/{constants-B_FLEjP_.mjs → constants-B7-Ccoim.mjs} +1 -1
  99. package/system/dist/{constants-DSO4ZEO3.js → constants-BqrgVNCL.js} +1 -1
  100. package/system/dist/{device-ca-CveuNCHp.mjs → device-ca-BDKMOSKW.mjs} +1 -1
  101. package/system/dist/{device-ca-DLTDsonl.js → device-ca-C9VMoted.js} +1 -1
  102. package/system/dist/{dist-CIyyHwVx.mjs → dist-Bv_ADY4Y.mjs} +385 -20
  103. package/system/dist/{dist-DhbzVygm.js → dist-KJhkakFo.js} +385 -20
  104. package/system/dist/file-host-worker.js +1 -1
  105. package/system/dist/file-host-worker.mjs +1 -1
  106. package/system/dist/{agent-https-BlLVD9hG.js → hub-identity-BS1rzEes.js} +120 -1
  107. package/system/dist/{agent-https-BSxTUzKT.mjs → hub-identity-DSLLzLph.mjs} +97 -2
  108. package/system/dist/{hub-mdns-ciao-C_ITDs0-.js → hub-mdns-ciao-BQh04Eo9.js} +18 -18
  109. package/system/dist/{hub-mdns-ciao-CQdCUsrI.mjs → hub-mdns-ciao-FVifxI5j.mjs} +2 -2
  110. package/system/dist/index.js +61 -44
  111. package/system/dist/index.mjs +22 -10
  112. package/system/dist/kernel/hub-identity.d.ts +17 -0
  113. package/system/dist/kernel/index.d.ts +2 -0
  114. package/system/dist/kernel/moleculer/mesh-mtls/mesh-membership.d.ts +7 -0
  115. package/system/dist/kernel/moleculer/mesh-mtls/pairing/agent-pairing.d.ts +11 -1
  116. package/system/dist/kernel/moleculer/mesh-mtls/pairing/hub-pairing.d.ts +5 -0
  117. package/system/dist/kernel/moleculer/mesh-mtls/pairing/index.d.ts +1 -1
  118. package/system/dist/kernel/moleculer/mesh-mtls/pairing/pairing-protocol.d.ts +2 -0
  119. package/system/dist/{legacy-integration-rows-door-D_tfRhsx.js → legacy-integration-rows-door-B3K3A9JU.js} +1 -1
  120. package/system/dist/{legacy-integration-rows-door-tX6Qktxd.mjs → legacy-integration-rows-door-Cu9uee1R.mjs} +1 -1
  121. package/system/dist/{rename-composition-block-DNhbAonr.js → rename-composition-block-31JmUak2.js} +1 -1
  122. package/system/dist/{rename-composition-block-COaMxshT.mjs → rename-composition-block-BglTrMYB.mjs} +1 -1
  123. package/system/dist/{restore-archive-BMqp_hMT.mjs → restore-archive-5UHNYi4u.mjs} +1 -1
  124. package/system/dist/{restore-archive-Dbzuv5hK.js → restore-archive-BHOc02Fh.js} +1 -1
  125. package/system/dist/{wal-maintenance-CWODOTsa.js → wal-maintenance-At5TeYwr.js} +0 -0
  126. package/system/dist/{wal-maintenance-ITsLGvFA.mjs → wal-maintenance-COJdLp-y.mjs} +0 -0
  127. package/system/package.json +1 -1
@@ -1225,7 +1225,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1225
1225
  */
1226
1226
  var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
1227
1227
  //#endregion
1228
- //#region ../types/dist/sleep-Dz1P6--1.mjs
1228
+ //#region ../types/dist/sleep-Cw1uUXvl.mjs
1229
1229
  /**
1230
1230
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1231
1231
  * window to float samples (D455).
@@ -11035,6 +11035,7 @@ var SYSTEM_CAP_VOCABULARY = {
11035
11035
  backup: system("system backups — run and restored from the Backups page"),
11036
11036
  broker: system("message-broker connections — configured, not actuated"),
11037
11037
  "calendar-source": system(INTERNAL),
11038
+ "cluster-update": system(CLUSTER),
11038
11039
  calendars: system("calendars feed schedules and conditions, not device actions"),
11039
11040
  composer: system("device composition — an authoring tool, not an action"),
11040
11041
  "core-blocks": system(INTERNAL),
@@ -11622,6 +11623,7 @@ var CAP_NAMES = Object.freeze([
11622
11623
  "camera-streams",
11623
11624
  "carbon-monoxide",
11624
11625
  "climate-control",
11626
+ "cluster-update",
11625
11627
  "color",
11626
11628
  "composer",
11627
11629
  "connectivity",
@@ -51284,6 +51286,160 @@ var climateControlCapability = {
51284
51286
  } }
51285
51287
  };
51286
51288
  /**
51289
+ * cluster-update — the ONE flow that brings the whole cluster to a release
51290
+ * (planning#493). Hub-provided (`server-provided`), hub-only: the hub runs
51291
+ * the sequence itself, so the admin UI, the MCP and the CLI all start the same
51292
+ * job and read the same report instead of each driving their own loop.
51293
+ *
51294
+ * 1. backup (`backup.trigger`) — skipped only when the caller says so
51295
+ * 2. the hub's server closure (`applyServerUpdate`); the hub restarts and the
51296
+ * job RESUMES on the new boot, verified against the hub's running version
51297
+ * 3. every online agent behind the target, one at a time, verified: runs the
51298
+ * target, settled, online, and its capabilities registered (D848) — an
51299
+ * agent that comes back capless is a FAILED step, never a done one
51300
+ * 4. every stale addon on the hub (`addons.updatePackage`); agents follow by
51301
+ * reconciliation, which is verified, never pushed
51302
+ *
51303
+ * The job stops on the first failed step with a typed reason (D877). Its state
51304
+ * is durable on the hub and read by RPC (`getClusterUpdateJob`) — events are
51305
+ * telemetry and never carry it (D8, D11).
51306
+ */
51307
+ /** The steps, in the order they run. */
51308
+ var ClusterUpdateStepKindSchema = z.enum([
51309
+ "backup",
51310
+ "hub-server",
51311
+ "agent-server",
51312
+ "addons"
51313
+ ]);
51314
+ /**
51315
+ * - `pending` — not reached yet.
51316
+ * - `running` — in progress (for `hub-server`: possibly across the restart).
51317
+ * - `ok` — done AND verified.
51318
+ * - `failed` — did not land; `reason` + `detail` say why. Stops the job.
51319
+ * - `skipped` — not run: nothing to do, opted out, the node is offline, or a
51320
+ * step before it failed. `detail` says which.
51321
+ */
51322
+ var ClusterUpdateStepStatusSchema = z.enum([
51323
+ "pending",
51324
+ "running",
51325
+ "ok",
51326
+ "failed",
51327
+ "skipped"
51328
+ ]);
51329
+ /**
51330
+ * Why a step (and with it the job) failed. Stable, greppable; `detail` carries
51331
+ * the prose.
51332
+ */
51333
+ var ClusterUpdateFailureReasonSchema = z.enum([
51334
+ "backup-unavailable",
51335
+ "backup-failed",
51336
+ "server-refused",
51337
+ "server-not-on-target",
51338
+ "node-capless",
51339
+ "status-unreadable",
51340
+ "addon-update-failed",
51341
+ "addons-not-converged",
51342
+ "interrupted"
51343
+ ]);
51344
+ var ClusterUpdateStepSchema = z.object({
51345
+ kind: ClusterUpdateStepKindSchema,
51346
+ /** The node the step acts on; absent for `backup` and `addons`. */
51347
+ nodeId: z.string().optional(),
51348
+ status: ClusterUpdateStepStatusSchema,
51349
+ /** One line for the operator: what happened, or why not. */
51350
+ detail: z.string(),
51351
+ reason: ClusterUpdateFailureReasonSchema.optional(),
51352
+ /** `hub-server` / `agent-server`: the version the node ran before. */
51353
+ fromVersion: z.string().nullable().optional(),
51354
+ /** `addons`: the packages this step updates, `name from -> to`. */
51355
+ packages: z.array(z.string()).readonly().optional(),
51356
+ startedAt: z.number().optional(),
51357
+ finishedAt: z.number().optional()
51358
+ });
51359
+ var ClusterUpdateJobStateSchema = z.enum([
51360
+ "running",
51361
+ "succeeded",
51362
+ "failed"
51363
+ ]);
51364
+ var ClusterUpdateJobSchema = z.object({
51365
+ id: z.string(),
51366
+ state: ClusterUpdateJobStateSchema,
51367
+ /** The server version every node is brought to. */
51368
+ targetVersion: z.string(),
51369
+ /** Who started it (the user name, or `system`). */
51370
+ requestedBy: z.string(),
51371
+ startedAt: z.number(),
51372
+ finishedAt: z.number().optional(),
51373
+ /** Every step, in run order; later steps stay `pending` while it runs. */
51374
+ steps: z.array(ClusterUpdateStepSchema).readonly(),
51375
+ /** On `failed`: the step that stopped it (`nodeId` or the step kind). */
51376
+ stoppedAt: z.string().optional(),
51377
+ reason: ClusterUpdateFailureReasonSchema.optional(),
51378
+ /** Agents offline when the plan was read: never touched. */
51379
+ skippedOffline: z.array(z.string()).readonly()
51380
+ });
51381
+ var ClusterUpdateOptionsSchema = z.object({
51382
+ /** Explicit server target; omitted = the hub's latest registry check. */
51383
+ version: z.string().optional(),
51384
+ /** Update the addons too (default true). */
51385
+ addons: z.boolean().optional(),
51386
+ /**
51387
+ * Back up before touching anything (default true). `false` is an explicit
51388
+ * operator opt-out; a missing backup provider is otherwise a failure.
51389
+ */
51390
+ backup: z.boolean().optional()
51391
+ });
51392
+ /** Why a plan cannot start. */
51393
+ var ClusterUpdateBlockerSchema = z.enum([
51394
+ "no-target",
51395
+ "node-busy",
51396
+ "job-running",
51397
+ "nothing-to-do",
51398
+ "status-unreadable"
51399
+ ]);
51400
+ var ClusterUpdatePlanSchema = z.object({
51401
+ /** `null` when no target could be resolved (`blocker: 'no-target'`). */
51402
+ targetVersion: z.string().nullable(),
51403
+ /** The steps the job WOULD run, all `pending` (or `skipped` with a reason). */
51404
+ steps: z.array(ClusterUpdateStepSchema).readonly(),
51405
+ skippedOffline: z.array(z.string()).readonly(),
51406
+ /** `null` = the plan can start. */
51407
+ blocker: ClusterUpdateBlockerSchema.nullable(),
51408
+ /** Prose for `blocker`. */
51409
+ blockerDetail: z.string().nullable()
51410
+ });
51411
+ var StartClusterUpdateResultSchema = z.object({
51412
+ accepted: z.boolean(),
51413
+ /** The job to follow with `getClusterUpdateJob`; `null` when refused. */
51414
+ jobId: z.string().nullable(),
51415
+ blocker: ClusterUpdateBlockerSchema.nullable(),
51416
+ message: z.string()
51417
+ });
51418
+ var clusterUpdateCapability = {
51419
+ name: "cluster-update",
51420
+ scope: "system",
51421
+ mode: "singleton",
51422
+ methods: {
51423
+ /** What `startClusterUpdate` would do now, and whether it can start. Reads only. */
51424
+ previewClusterUpdate: method(ClusterUpdateOptionsSchema, ClusterUpdatePlanSchema, { auth: "admin" }),
51425
+ /**
51426
+ * Start the job and return at once with its id; the job runs on the hub
51427
+ * (minutes to hours, across the hub's own restart). Refused, with a
51428
+ * `blocker`, when the plan cannot start — one job at a time.
51429
+ */
51430
+ startClusterUpdate: method(ClusterUpdateOptionsSchema, StartClusterUpdateResultSchema, {
51431
+ kind: "mutation",
51432
+ auth: "admin"
51433
+ }),
51434
+ /**
51435
+ * A job's state. Without `jobId`: the latest job, or `null` when none ever
51436
+ * ran. Survives the hub restart the job itself causes.
51437
+ */
51438
+ getClusterUpdateJob: method(z.object({ jobId: z.string().optional() }), ClusterUpdateJobSchema.nullable(), { auth: "admin" })
51439
+ },
51440
+ mount: { kind: "server-provided" }
51441
+ };
51442
+ /**
51287
51443
  * Color-light cap. Coexists with `switch` (on/off) and `brightness`
51288
51444
  * (level) on the same device — `switch` toggles the bulb, `brightness`
51289
51445
  * sets the dim level, this cap sets the chromaticity.
@@ -58569,6 +58725,90 @@ var SiteZoneSchema = z.object({
58569
58725
  function siteZoneKey(label) {
58570
58726
  return label.trim().toLowerCase();
58571
58727
  }
58728
+ var DeviceSearchRequiresSchema = z.object({
58729
+ /** Capability names the field wants a value of. */
58730
+ caps: z.array(z.string()).readonly(),
58731
+ /** `any` (default): a device with one of them is compatible. `all`: it must hold every one. */
58732
+ mode: z.enum(["any", "all"]).optional()
58733
+ });
58734
+ var DeviceSearchFiltersSchema = z.object({
58735
+ locations: z.array(z.string()).readonly().optional(),
58736
+ integrationIds: z.array(z.string()).readonly().optional(),
58737
+ types: z.array(z.string()).readonly().optional()
58738
+ });
58739
+ var DeviceSearchInputSchema = z.object({
58740
+ /** Matches name, location, type, integration (id and label) and id. Case-insensitive. */
58741
+ text: z.string().optional(),
58742
+ requires: DeviceSearchRequiresSchema.optional(),
58743
+ filters: DeviceSearchFiltersSchema.optional(),
58744
+ /** List the devices that do not provide the required cap too (greyed, not pickable). */
58745
+ includeIncompatible: z.boolean().optional(),
58746
+ /** The device the field belongs to: its location drives `suggested`. */
58747
+ contextDeviceId: z.number().optional(),
58748
+ /**
58749
+ * Resolve exactly these devices, regardless of every filter, so a picked
58750
+ * value can be rendered. When given, `items` is these devices in the order
58751
+ * asked (no paging, `nextCursor` null) and the ones that do not exist are
58752
+ * listed in `missingIds`.
58753
+ */
58754
+ ids: z.array(z.number()).readonly().optional(),
58755
+ cursor: z.string().nullable().optional(),
58756
+ limit: z.number().int().min(1).max(200).optional()
58757
+ });
58758
+ var DeviceValueOptionSchema = z.object({
58759
+ cap: z.string(),
58760
+ /** Status-schema field path inside the cap (same paths as `getWireableFields`). */
58761
+ path: z.string(),
58762
+ label: z.string(),
58763
+ /** The current value as text; `null` when it is unknown or the read FAILED — never `0`. */
58764
+ reading: z.string().nullable(),
58765
+ unit: z.string().nullable().optional(),
58766
+ /** The field's measured quantity, when the cap declares one, so a client can format the reading. */
58767
+ quantity: ReadingQuantitySchema.optional()
58768
+ });
58769
+ var DeviceSearchItemSchema = z.object({
58770
+ id: z.number(),
58771
+ name: z.string(),
58772
+ type: z.enum(DeviceType),
58773
+ location: z.string().nullable(),
58774
+ integrationId: z.string().nullable(),
58775
+ integrationLabel: z.string().nullable(),
58776
+ online: z.boolean().nullable(),
58777
+ disabled: z.boolean(),
58778
+ compatible: z.boolean(),
58779
+ /** Only the required caps' fields; empty when nothing was required or the device is incompatible. */
58780
+ values: z.array(DeviceValueOptionSchema).readonly()
58781
+ });
58782
+ var DeviceSearchFacetValueSchema = z.object({
58783
+ value: z.string(),
58784
+ count: z.number()
58785
+ });
58786
+ var DeviceSearchFacetIntegrationSchema = z.object({
58787
+ id: z.string(),
58788
+ label: z.string(),
58789
+ count: z.number()
58790
+ });
58791
+ var DeviceSearchFacetsSchema = z.object({
58792
+ locations: z.array(DeviceSearchFacetValueSchema).readonly(),
58793
+ integrations: z.array(DeviceSearchFacetIntegrationSchema).readonly(),
58794
+ types: z.array(DeviceSearchFacetValueSchema).readonly()
58795
+ });
58796
+ var DeviceSearchResultSchema = z.object({
58797
+ items: z.array(DeviceSearchItemSchema).readonly(),
58798
+ nextCursor: z.string().nullable(),
58799
+ /** Devices listed by this query across all pages (filters + text applied; incompatible counted only when `includeIncompatible`). */
58800
+ total: z.number(),
58801
+ /** Compatible devices after filters + text. */
58802
+ compatibleTotal: z.number(),
58803
+ /** Every device the caller's fleet holds, before anything is applied. */
58804
+ fleetTotal: z.number(),
58805
+ /** Incompatible devices after filters + text — the K of "show the K that don't". */
58806
+ hiddenIncompatible: z.number(),
58807
+ facets: DeviceSearchFacetsSchema,
58808
+ /** Same location as `contextDeviceId`; first page only. */
58809
+ suggested: z.array(DeviceSearchItemSchema).readonly(),
58810
+ missingIds: z.array(z.number()).readonly()
58811
+ });
58572
58812
  var ProviderStatusSchema = z.object({
58573
58813
  connected: z.boolean(),
58574
58814
  deviceCount: z.number(),
@@ -59054,6 +59294,9 @@ var DeviceInfoSchema = z.object({
59054
59294
  * named accordion sections (with optional intra-section order). See
59055
59295
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
59056
59296
  childLayout: z.array(ChildLayoutEntrySchema).readonly().optional(),
59297
+ /** The children a container stands for, most preferred first, by accessory
59298
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
59299
+ primaryChildPreference: z.array(z.string()).readonly().optional(),
59057
59300
  /** Operator-authored per-device display override. See `DeviceMeta.display`. */
59058
59301
  display: DeviceDisplayOverrideSchema.optional()
59059
59302
  });
@@ -59217,6 +59460,9 @@ var DeviceMetaSchema = z.object({
59217
59460
  * accordion sections (with optional intra-section order). See
59218
59461
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
59219
59462
  childLayout: z.array(ChildLayoutEntrySchema).readonly().optional(),
59463
+ /** The children a container stands for, most preferred first, by accessory
59464
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
59465
+ primaryChildPreference: z.array(z.string()).readonly().optional(),
59220
59466
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
59221
59467
  * Optional: only present for accessory children that carry a known role. */
59222
59468
  role: z.string().nullable().optional(),
@@ -59544,6 +59790,17 @@ var deviceManagerCapability = {
59544
59790
  kind: "mutation",
59545
59791
  auth: "admin"
59546
59792
  }),
59793
+ /** Set (or replace) a container's provider-declared primary-child
59794
+ * preference: accessory `childKey`s, most preferred first. Mirrors
59795
+ * `setChildLayout`; the operator's `primaryChildEntityId` still wins.
59796
+ * Persisted, projected, and preserved across re-register/restore. Idempotent. */
59797
+ setPrimaryChildPreference: method(z.object({
59798
+ deviceId: z.number(),
59799
+ primaryChildPreference: z.array(z.string()).readonly()
59800
+ }), z.void(), {
59801
+ kind: "mutation",
59802
+ auth: "admin"
59803
+ }),
59547
59804
  /** Set (or clear) the per-device display override on the meta row. Mirrors
59548
59805
  * `setChildLayout` persistence; `null` clears the override entirely. The
59549
59806
  * override unit(s) are normalized (`normalizeUnit`) at write so the render
@@ -59873,6 +60130,15 @@ var deviceManagerCapability = {
59873
60130
  */
59874
60131
  deviceIds: z.array(z.number()).optional()
59875
60132
  }), z.array(DeviceInfoSchema), { role: "viewer" }),
60133
+ /**
60134
+ * The device → value picker's one query: filter by text, capability and
60135
+ * location / integration / type, with faceted counts, cursor pagination,
60136
+ * the live reading of each matching value, suggestions by the context
60137
+ * device's location, and `ids` resolution for already-picked values.
60138
+ * See `device-search.ts`. Not in `DEVICE_ENUMERATION_METHODS`: a
60139
+ * device-scoped token is refused rather than shown the whole fleet.
60140
+ */
60141
+ search: method(DeviceSearchInputSchema, DeviceSearchResultSchema, { role: "viewer" }),
59876
60142
  /** Get a single device by numeric deviceId. */
59877
60143
  getDevice: method(z.object({ deviceId: z.number() }), DeviceInfoSchema.nullable()),
59878
60144
  /** List children of a parent device (by parent numeric id). */
@@ -64565,8 +64831,23 @@ var HeroPillSchema = z.object({
64565
64831
  text: HeroTextSchema,
64566
64832
  tone: HeroToneSchema
64567
64833
  });
64834
+ /**
64835
+ * Rows whose action and slider controls belong ON the scene (the curtain's buttons, the
64836
+ * lock's key, the player's transport) and not in a row under it. The model says it, so
64837
+ * every client draws the same placement; a control of another kind stays in a row.
64838
+ */
64839
+ var HERO_SCENE_ROW_IDS = new Set([
64840
+ "cover",
64841
+ "valve",
64842
+ "lock",
64843
+ "vacuum",
64844
+ "playback",
64845
+ "brightness"
64846
+ ]);
64568
64847
  var HeroRowSchema = z.object({
64569
64848
  id: HeroRowIdSchema,
64849
+ /** `scene`: the row's action and slider controls are drawn on the scene. Absent: an ordinary row. */
64850
+ placement: z.enum(["row", "scene"]).optional(),
64570
64851
  /** The row's own name when the kind's label would not tell rows of one kind apart (a circuit's label). */
64571
64852
  label: HeroTextSchema.optional(),
64572
64853
  /** A group header drawn above the row when it differs from the previous row's ("System"). */
@@ -67681,7 +67962,9 @@ var HUB_MDNS_TXT_KEYS = {
67681
67962
  nodeId: "nodeId",
67682
67963
  version: "version",
67683
67964
  role: "role",
67684
- url: "url"
67965
+ url: "url",
67966
+ /** The hub's announced identity (`hub-<16 hex>`), see {@link isHubId}. */
67967
+ hubId: "hubId"
67685
67968
  };
67686
67969
  /**
67687
67970
  * How a hub finds agents to pair (D857): every agent publishes ONE mDNS service for its API
@@ -79104,13 +79387,23 @@ var NcRuleTargetSchema = z.object({
79104
79387
  */
79105
79388
  params: z.record(z.string(), z.unknown()).optional()
79106
79389
  });
79390
+ /** Which picture kind one target receives (#487). */
79391
+ var NcTargetAttachmentSchema = z.enum([
79392
+ "none",
79393
+ "image",
79394
+ "clip",
79395
+ "gif"
79396
+ ]);
79107
79397
  var NcTargetOverrideSchema = z.object({
79108
79398
  template: z.object({
79109
79399
  title: z.string().max(500).optional(),
79110
79400
  body: z.string().max(2e3).optional()
79111
79401
  }).optional(),
79112
79402
  schedule: NcScheduleSchema.optional(),
79113
- priority: z.number().int().min(1).max(5).optional()
79403
+ priority: z.number().int().min(1).max(5).optional(),
79404
+ attachment: NcTargetAttachmentSchema.optional(),
79405
+ /** `false` = no buttons for this target; `true` is the same as absent. */
79406
+ actions: z.boolean().optional()
79114
79407
  });
79115
79408
  /** Per-target settings keyed by target id (#487). */
79116
79409
  var NcTargetOverridesSchema = z.record(z.string(), NcTargetOverrideSchema);
@@ -84044,18 +84337,18 @@ var powerSourceCapability = {
84044
84337
  mode: "singleton",
84045
84338
  deviceTypes: POWER_SOURCE_DEVICE_TYPES,
84046
84339
  methods: {
84047
- getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }),
84340
+ getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }),
84048
84341
  powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
84049
84342
  kind: "mutation",
84050
- auth: "admin"
84343
+ auth: "protected"
84051
84344
  }),
84052
84345
  powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
84053
84346
  kind: "mutation",
84054
- auth: "admin"
84347
+ auth: "protected"
84055
84348
  }),
84056
84349
  forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
84057
84350
  kind: "mutation",
84058
- auth: "admin"
84351
+ auth: "protected"
84059
84352
  })
84060
84353
  },
84061
84354
  runtimeState: PowerSourceStateSchema,
@@ -94990,6 +95283,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
94990
95283
  cameraStreamsCapability,
94991
95284
  carbonMonoxideCapability,
94992
95285
  climateControlCapability,
95286
+ clusterUpdateCapability,
94993
95287
  colorCapability,
94994
95288
  composerCapability,
94995
95289
  connectivityCapability,
@@ -98186,9 +98480,11 @@ function deriveBatteryPresence(input) {
98186
98480
  * priority-in-sync.ts` fails the build when either drifts — the comment that
98187
98481
  * used to ask for this could not.
98188
98482
  *
98189
- * The rule has three halves and the ORDER matters: an operator's explicit pick
98190
- * wins outright; else a declaration on the device type
98191
- * ({@link CONTAINER_PRIMARY_CHILD_RULES}); else role, namesake, then type
98483
+ * The rule has four steps and the ORDER matters: an operator's explicit pick
98484
+ * wins outright; else the container's own declaration, an ordered list of
98485
+ * child keys its provider stamped at create
98486
+ * ({@link ContainerPrimaryChildPreference}); else a declaration on the device
98487
+ * type ({@link CONTAINER_PRIMARY_CHILD_RULES}); else role, namesake, then type
98192
98488
  * priority. The pick is keyed on the child's re-sync-stable `entityId`, not
98193
98489
  * its numeric id, so it survives a re-sync that reallocates ids.
98194
98490
  */
@@ -98201,6 +98497,25 @@ var CONTAINER_PRIMARY_CHILD_RULES = [{
98201
98497
  deviceType: DeviceType.HeatPump,
98202
98498
  primary: "self"
98203
98499
  }];
98500
+ /** The declaration of a container read from its meta, or undefined when it declared none. */
98501
+ function primaryChildPreferenceOf(container) {
98502
+ const keys = container.primaryChildPreference;
98503
+ if (container.stableId === void 0 || keys === void 0 || keys === null) return void 0;
98504
+ if (keys.length === 0) return void 0;
98505
+ return {
98506
+ parentStableId: container.stableId,
98507
+ childKeys: keys
98508
+ };
98509
+ }
98510
+ /** The first declared child that exists, or undefined when none does. */
98511
+ function applyPrimaryChildPreference(preference, children) {
98512
+ if (preference === void 0) return void 0;
98513
+ for (const key of preference.childKeys) {
98514
+ const expected = `${preference.parentStableId}-${key}`;
98515
+ const match = children.find((child) => child.stableId === expected);
98516
+ if (match !== void 0) return match;
98517
+ }
98518
+ }
98204
98519
  /**
98205
98520
  * The type declaration, before the heuristic. `fall-through` means the
98206
98521
  * heuristic still decides: the type declared nothing, or it named a child
@@ -98308,7 +98623,8 @@ function rank(type) {
98308
98623
  }
98309
98624
  /**
98310
98625
  * The child a container stands for: the operator's pick when it still exists,
98311
- * else the device type's declaration, else the highest-priority type. `null`
98626
+ * else the container's declared preference, else the device type's
98627
+ * declaration, else the highest-priority type. `null`
98312
98628
  * for a childless container, and for a type that stands for itself — a caller
98313
98629
  * must decide what "no child" means for it, rather than being handed a child
98314
98630
  * that is not the device.
@@ -98340,11 +98656,13 @@ function sameName(childName, containerName) {
98340
98656
  const flatten = (v) => v.toLowerCase().replace(/[-_\s]+/g, " ").trim();
98341
98657
  return flatten(childName) === flatten(containerName);
98342
98658
  }
98343
- function resolveContainerPrimaryChild(children, overrideEntityId, containerName, containerType) {
98659
+ function resolveContainerPrimaryChild(children, overrideEntityId, containerName, containerType, preference) {
98344
98660
  if (overrideEntityId !== void 0 && overrideEntityId !== null) {
98345
98661
  const picked = children.find((c) => c.stableId === overrideEntityId) ?? children.find((c) => c.entityId !== void 0 && c.entityId === overrideEntityId);
98346
98662
  if (picked !== void 0) return picked;
98347
98663
  }
98664
+ const preferred = applyPrimaryChildPreference(preference, children);
98665
+ if (preferred !== void 0) return preferred;
98348
98666
  const declared = applyPrimaryChildRule(CONTAINER_PRIMARY_CHILD_RULES.find((entry) => entry.deviceType === containerType), children);
98349
98667
  if (declared.kind === "none") return null;
98350
98668
  if (declared.kind === "child") return declared.child;
@@ -98395,7 +98713,7 @@ function expandContainer(id, byId, byParent, visited, out) {
98395
98713
  type: c.type,
98396
98714
  ...c.role !== void 0 && c.role !== null ? { role: c.role } : {},
98397
98715
  ...c.name !== void 0 ? { name: c.name } : {}
98398
- })), byId.get(id)?.primaryChildEntityId, byId.get(id)?.name, candidate.type);
98716
+ })), candidate.primaryChildEntityId, candidate.name, candidate.type, primaryChildPreferenceOf(candidate));
98399
98717
  if (primary !== null) expandContainer(primary.id, byId, byParent, nextVisited, out);
98400
98718
  }
98401
98719
  /**
@@ -102588,7 +102906,10 @@ function buildHeroModel(input) {
102588
102906
  };
102589
102907
  const allRows = fragments.flatMap((f) => f.rows ?? []);
102590
102908
  const rows = resolveHeroLayout(device.type).rows.flatMap((id) => {
102591
- return allRows.filter((r) => r.id === id);
102909
+ return allRows.filter((r) => r.id === id).map((r) => HERO_SCENE_ROW_IDS.has(r.id) ? {
102910
+ ...r,
102911
+ placement: "scene"
102912
+ } : r);
102592
102913
  });
102593
102914
  const ownPower = resolveOwnPower(fragments.flatMap((f) => f.ownPower === void 0 ? [] : [f.ownPower]));
102594
102915
  const timedRun = fragments.find((f) => f.timedRun !== void 0)?.timedRun ?? null;
@@ -103870,6 +104191,27 @@ var METHOD_ACCESS_MAP = Object.freeze({
103870
104191
  access: "create",
103871
104192
  role: "viewer"
103872
104193
  },
104194
+ "clusterUpdate.getClusterUpdateJob": {
104195
+ capName: "cluster-update",
104196
+ capScope: "system",
104197
+ addonId: null,
104198
+ access: "view",
104199
+ role: "admin"
104200
+ },
104201
+ "clusterUpdate.previewClusterUpdate": {
104202
+ capName: "cluster-update",
104203
+ capScope: "system",
104204
+ addonId: null,
104205
+ access: "view",
104206
+ role: "admin"
104207
+ },
104208
+ "clusterUpdate.startClusterUpdate": {
104209
+ capName: "cluster-update",
104210
+ capScope: "system",
104211
+ addonId: null,
104212
+ access: "create",
104213
+ role: "admin"
104214
+ },
103873
104215
  "color.getStatus": {
103874
104216
  capName: "color",
103875
104217
  capScope: "device",
@@ -105242,6 +105584,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
105242
105584
  access: "create",
105243
105585
  role: "admin"
105244
105586
  },
105587
+ "deviceManager.search": {
105588
+ capName: "device-manager",
105589
+ capScope: "system",
105590
+ addonId: null,
105591
+ access: "view",
105592
+ role: "viewer"
105593
+ },
105245
105594
  "deviceManager.setAlias": {
105246
105595
  capName: "device-manager",
105247
105596
  capScope: "system",
@@ -105333,6 +105682,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
105333
105682
  access: "create",
105334
105683
  role: "admin"
105335
105684
  },
105685
+ "deviceManager.setPrimaryChildPreference": {
105686
+ capName: "device-manager",
105687
+ capScope: "system",
105688
+ addonId: null,
105689
+ access: "create",
105690
+ role: "admin"
105691
+ },
105336
105692
  "deviceManager.setRole": {
105337
105693
  capName: "device-manager",
105338
105694
  capScope: "system",
@@ -109972,28 +110328,28 @@ var METHOD_ACCESS_MAP = Object.freeze({
109972
110328
  capScope: "device",
109973
110329
  addonId: null,
109974
110330
  access: "create",
109975
- role: "admin"
110331
+ role: "viewer"
109976
110332
  },
109977
110333
  "powerSource.getStatus": {
109978
110334
  capName: "power-source",
109979
110335
  capScope: "device",
109980
110336
  addonId: null,
109981
110337
  access: "view",
109982
- role: "admin"
110338
+ role: "viewer"
109983
110339
  },
109984
110340
  "powerSource.powerOff": {
109985
110341
  capName: "power-source",
109986
110342
  capScope: "device",
109987
110343
  addonId: null,
109988
110344
  access: "create",
109989
- role: "admin"
110345
+ role: "viewer"
109990
110346
  },
109991
110347
  "powerSource.powerOn": {
109992
110348
  capName: "power-source",
109993
110349
  capScope: "device",
109994
110350
  addonId: null,
109995
110351
  access: "create",
109996
- role: "admin"
110352
+ role: "viewer"
109997
110353
  },
109998
110354
  "presence.getStatus": {
109999
110355
  capName: "presence",
@@ -114104,6 +114460,11 @@ Object.freeze({
114104
114460
  form: "single",
114105
114461
  optional: false
114106
114462
  }],
114463
+ "deviceManager.setPrimaryChildPreference": [{
114464
+ name: "deviceId",
114465
+ form: "single",
114466
+ optional: false
114467
+ }],
114107
114468
  "deviceManager.setRole": [{
114108
114469
  name: "deviceId",
114109
114470
  form: "single",
@@ -117992,7 +118353,9 @@ var TimelapseRuleInputSchema = z.object({
117992
118353
  /** Classes the notification counts — see {@link ReportClassesField}. */
117993
118354
  reportClasses: ReportClassesField.optional(),
117994
118355
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
117995
- priority: PriorityField.default(3)
118356
+ priority: PriorityField.default(3),
118357
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
118358
+ targetOverrides: NcTargetOverridesSchema.optional()
117996
118359
  });
117997
118360
  z.object({
117998
118361
  name: NameField.optional(),
@@ -118008,7 +118371,9 @@ z.object({
118008
118371
  previewText: PreviewTextField.optional(),
118009
118372
  previewMode: PreviewModeField.optional(),
118010
118373
  reportClasses: ReportClassesField.optional(),
118011
- priority: PriorityField.optional()
118374
+ priority: PriorityField.optional(),
118375
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
118376
+ targetOverrides: NcTargetOverridesSchema.optional()
118012
118377
  });
118013
118378
  TimelapseRuleInputSchema.extend({
118014
118379
  id: z.string(),