@camstack/types 1.2.592 → 1.2.594

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 (43) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/addon.js +2 -2
  3. package/dist/addon.mjs +2 -2
  4. package/dist/capabilities/composer.cap.d.ts +9 -0
  5. package/dist/capabilities/core-blocks.cap.d.ts +64 -0
  6. package/dist/capabilities/device-manager.cap.d.ts +681 -48
  7. package/dist/capabilities/device-state-refresh.cap.d.ts +58 -0
  8. package/dist/capabilities/index.d.ts +3 -1
  9. package/dist/capabilities/power-source.cap.d.ts +10 -0
  10. package/dist/client.js +10 -0
  11. package/dist/client.mjs +10 -0
  12. package/dist/composition/composition-report.d.ts +3 -0
  13. package/dist/composition/composition.d.ts +14 -0
  14. package/dist/composition/power-source-link.d.ts +8 -0
  15. package/dist/device/base-device.d.ts +8 -0
  16. package/dist/device/command-hold.d.ts +6 -0
  17. package/dist/device/device-management.d.ts +4 -0
  18. package/dist/device/identity-links.d.ts +310 -0
  19. package/dist/device/index.d.ts +2 -0
  20. package/dist/device/state-refresh.d.ts +51 -0
  21. package/dist/enums/event-category.d.ts +14 -0
  22. package/dist/enums.js +1 -1
  23. package/dist/enums.mjs +1 -1
  24. package/dist/{event-category-CY27-fF0.mjs → event-category-7P4A3bYA.mjs} +14 -0
  25. package/dist/{event-category-BKxXXxnV.js → event-category-CMA0-jGW.js} +14 -0
  26. package/dist/generated/addon-api.d.ts +57 -0
  27. package/dist/generated/cap-vocabulary.d.ts +1 -1
  28. package/dist/generated/capability-router-map.d.ts +5 -2
  29. package/dist/generated/device-proxy.d.ts +3 -1
  30. package/dist/generated/device-scoped-caps.d.ts +1 -1
  31. package/dist/generated/method-access-map.d.ts +1 -1
  32. package/dist/generated/method-device-selectors.d.ts +2 -2
  33. package/dist/generated/system-proxy.d.ts +1 -1
  34. package/dist/{implemented-methods-k3KProJd.mjs → implemented-methods-DXeNAPAS.mjs} +11 -2
  35. package/dist/{implemented-methods-BarLh7tc.js → implemented-methods-Dj_2fX8-.js} +16 -1
  36. package/dist/index.d.ts +3 -0
  37. package/dist/index.js +442 -12
  38. package/dist/index.mjs +416 -13
  39. package/dist/node.js +1 -1
  40. package/dist/node.mjs +1 -1
  41. package/dist/{sleep-D2Ny6tvi.js → sleep-Bgzv_TCG.js} +23 -3
  42. package/dist/{sleep-dgC2VKW4.mjs → sleep-C9eelFbV.mjs} +23 -3
  43. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-D2Ny6tvi.js");
3
- const require_event_category = require("./event-category-BKxXXxnV.js");
2
+ const require_sleep = require("./sleep-Bgzv_TCG.js");
3
+ const require_event_category = require("./event-category-CMA0-jGW.js");
4
4
  const require_composed_stable_id = require("./composed-stable-id-BdeYe5dD.js");
5
- const require_implemented_methods = require("./implemented-methods-BarLh7tc.js");
5
+ const require_implemented_methods = require("./implemented-methods-Dj_2fX8-.js");
6
6
  const require_node_color = require("./node-color.js");
7
7
  const require_convert = require("./convert-BI8iTXn6.js");
8
8
  const require_device_template_catalogue = require("./device-template-catalogue.js");
@@ -4578,7 +4578,7 @@ function ordinalOf(id) {
4578
4578
  function defaultIntegrationOf(integrations, eligible) {
4579
4579
  return [...eligible === void 0 ? integrations : integrations.filter(eligible)].sort((a, b) => ordinalOf(a.id) - ordinalOf(b.id) || (a.id < b.id ? -1 : 1))[0] ?? null;
4580
4580
  }
4581
- function unstamped(device) {
4581
+ function unstamped$1(device) {
4582
4582
  return device.integrationId === void 0 || device.integrationId === null || device.integrationId === "";
4583
4583
  }
4584
4584
  /**
@@ -4595,8 +4595,8 @@ async function claimDevicesToDefaultIntegration(ports, spec) {
4595
4595
  const all = await ports.listDevices(spec.addonId);
4596
4596
  const byId = new Map(all.map((d) => [d.id, d]));
4597
4597
  const reservations = /* @__PURE__ */ new Set();
4598
- for (const device of all) if (unstamped(device) && await isReservation(ports, device)) reservations.add(device.id);
4599
- const orphans = all.filter((d) => unstamped(d) && !reservations.has(d.id));
4598
+ for (const device of all) if (unstamped$1(device) && await isReservation(ports, device)) reservations.add(device.id);
4599
+ const orphans = all.filter((d) => unstamped$1(d) && !reservations.has(d.id));
4600
4600
  const summaryBase = { reservations: reservations.size };
4601
4601
  if (orphans.length === 0) return {
4602
4602
  outcome: "already-done",
@@ -4611,7 +4611,7 @@ async function claimDevicesToDefaultIntegration(ports, spec) {
4611
4611
  const unresolved = /* @__PURE__ */ new Set();
4612
4612
  const failed = /* @__PURE__ */ new Set();
4613
4613
  const resolve = (device, seen) => {
4614
- if (!unstamped(device)) return device.integrationId ?? null;
4614
+ if (!unstamped$1(device)) return device.integrationId ?? null;
4615
4615
  const planned = plan.get(device.id);
4616
4616
  if (planned !== void 0) return planned;
4617
4617
  if (failed.has(device.id)) return null;
@@ -47132,7 +47132,8 @@ var CompositionProblemCodeSchema = zod.z.enum([
47132
47132
  "command-source-unknown",
47133
47133
  "command-input-unknown",
47134
47134
  "command-input-missing",
47135
- "power-source-is-actuator"
47135
+ "power-source-is-actuator",
47136
+ "link-contribution-removed"
47136
47137
  ]);
47137
47138
  /** One refusal, named (D391). `path` points into the composition, e.g. `features[0].fields.temperature`. */
47138
47139
  var CompositionProblemSchema = zod.z.object({
@@ -53484,7 +53485,9 @@ var PowerSourceRefusalReasonSchema = zod.z.enum([
53484
53485
  "switch-call-failed",
53485
53486
  "switch-options-unreadable",
53486
53487
  "not-settable",
53487
- "switch-is-actuator"
53488
+ "switch-is-actuator",
53489
+ "link-lost",
53490
+ "link-unknown"
53488
53491
  ]);
53489
53492
  var PowerSourceActionResultSchema = zod.z.discriminatedUnion("accepted", [zod.z.object({ accepted: zod.z.literal(true) }), zod.z.object({
53490
53493
  accepted: zod.z.literal(false),
@@ -53681,7 +53684,8 @@ function powerSourceLinkOfComposition(composition, blockId) {
53681
53684
  return {
53682
53685
  device,
53683
53686
  switch: read.source,
53684
- offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
53687
+ offSeconds: normalizeOffSeconds(storedOffSeconds(composition)),
53688
+ ...feature.contributedBy === void 0 ? {} : { contributedBy: feature.contributedBy }
53685
53689
  };
53686
53690
  }
53687
53691
  var ACTUATOR_CAP = "switch";
@@ -57037,6 +57041,143 @@ var IdentityCandidatesSchema = zod.z.discriminatedUnion("status", [zod.z.object(
57037
57041
  undeclaredDeviceIds: zod.z.array(zod.z.number().int()).readonly()
57038
57042
  })]);
57039
57043
  //#endregion
57044
+ //#region src/device/identity-links.ts
57045
+ /**
57046
+ * Identity links (planning#594, D1063): a RELATION between two devices of
57047
+ * different integrations, decided from the identifiers their providers declared
57048
+ * (D1059) — never from location, never from a name.
57049
+ *
57050
+ * A link is not a merge: both devices keep their provider, their id and their
57051
+ * bindings. What a link adds to one of them is a Customize feature, stamped
57052
+ * with the link's id (`CompositionFieldsFeature.contributedBy`), so the
57053
+ * operator's switch for it is the feature's own `enabled` (D62, D676) and the
57054
+ * link record never holds a second copy of it.
57055
+ *
57056
+ * | Kind | Sides | Evidence |
57057
+ * | ------------- | -------------------------------------------- | ---------------------------------------- |
57058
+ * | `same-device` | two views of ONE object, unordered | `identifiers` ↔ `identifiers` |
57059
+ * | `poe-power` | `a` = the PoE port, `b` = the device it feeds | port `attachedIdentifiers` ↔ `identifiers` |
57060
+ *
57061
+ * The row id names the two sides by `<addonId>/<stableId>`, so a link survives
57062
+ * a device re-registered under a new numeric id. A symmetric kind sorts its two
57063
+ * refs; a directional kind keeps `a` as the attaching side.
57064
+ */
57065
+ var IDENTITY_LINK_KIND_NAMES = ["same-device", "poe-power"];
57066
+ var IdentityLinkKindSchema = zod.z.enum(IDENTITY_LINK_KIND_NAMES);
57067
+ /**
57068
+ * - `proposed` — one strong key matched: waits for the operator;
57069
+ * - `linked` — confirmed by the operator, or auto-linked on strong evidence;
57070
+ * - `dismissed` — the operator said no (or unlinked): sticky, never re-proposed.
57071
+ */
57072
+ var IdentityLinkStateSchema = zod.z.enum([
57073
+ "proposed",
57074
+ "linked",
57075
+ "dismissed"
57076
+ ]);
57077
+ /** Who decided the current state: the matcher (`auto`) or the operator. */
57078
+ var IdentityLinkOriginSchema = zod.z.enum(["auto", "operator"]);
57079
+ /** One side: the device ref that survives re-registration, plus its current numeric id. */
57080
+ var IdentityLinkSideSchema = zod.z.object({
57081
+ addonId: zod.z.string().min(1),
57082
+ stableId: zod.z.string().min(1),
57083
+ deviceId: zod.z.number().int()
57084
+ });
57085
+ /** The stored body of one `identity-links` record. */
57086
+ var IdentityLinkBodySchema = zod.z.object({
57087
+ kind: IdentityLinkKindSchema,
57088
+ a: IdentityLinkSideSchema,
57089
+ b: IdentityLinkSideSchema,
57090
+ state: IdentityLinkStateSchema,
57091
+ origin: IdentityLinkOriginSchema,
57092
+ /** The identifiers that matched when the link was last evaluated, ordered by key then value. */
57093
+ evidence: zod.z.array(IdentityMatchedKeySchema).readonly(),
57094
+ /** An operator-confirmed link whose evidence no longer matches: kept, flagged. */
57095
+ evidenceGone: zod.z.literal(true).optional(),
57096
+ createdAt: zod.z.number().int().nonnegative(),
57097
+ decidedAt: zod.z.number().int().nonnegative().optional()
57098
+ });
57099
+ var IdentityLinkSchema = IdentityLinkBodySchema.extend({ id: zod.z.string().min(1) });
57100
+ /** The one table of link kinds. */
57101
+ var IDENTITY_LINK_KINDS = {
57102
+ "same-device": {
57103
+ directional: false,
57104
+ attachingRole: null,
57105
+ contributions: []
57106
+ },
57107
+ "poe-power": {
57108
+ directional: true,
57109
+ attachingRole: require_composed_stable_id.DeviceRole.PoePort,
57110
+ contributions: [{
57111
+ cap: "power-source",
57112
+ targetId: "switch",
57113
+ host: "b",
57114
+ source: "a",
57115
+ sourceCap: "switch",
57116
+ sourceField: "on"
57117
+ }]
57118
+ }
57119
+ };
57120
+ /** Whether the attaching side of `kind` may be a device of `aRole`. */
57121
+ function identityLinkSidesRefusal(kind, aRole) {
57122
+ const required = IDENTITY_LINK_KINDS[kind].attachingRole;
57123
+ if (required === null) return null;
57124
+ return aRole === required ? null : "attaching-side-role";
57125
+ }
57126
+ function refKey(ref) {
57127
+ return `${ref.addonId}/${ref.stableId}`;
57128
+ }
57129
+ /**
57130
+ * The record id of a link: `<kind>:<refA>|<refB>`. A symmetric kind sorts the
57131
+ * two refs, so either order names one row; a directional kind keeps `a` first.
57132
+ */
57133
+ function identityLinkId(kind, a, b) {
57134
+ const x = refKey(a);
57135
+ const y = refKey(b);
57136
+ if (IDENTITY_LINK_KINDS[kind].directional || x <= y) return `${kind}:${x}|${y}`;
57137
+ return `${kind}:${y}|${x}`;
57138
+ }
57139
+ /**
57140
+ * The answer of `device-manager.listIdentityLinks`. `not-loaded` until the
57141
+ * links have been read — never an empty list (D315).
57142
+ */
57143
+ var IdentityLinksReadSchema = zod.z.discriminatedUnion("status", [zod.z.object({
57144
+ status: zod.z.literal("not-loaded"),
57145
+ reason: zod.z.string()
57146
+ }), zod.z.object({
57147
+ status: zod.z.literal("answered"),
57148
+ links: zod.z.array(IdentityLinkSchema).readonly()
57149
+ })]);
57150
+ /** Why an operator decision on a link was refused. */
57151
+ var IdentityLinkDecisionRefusalSchema = zod.z.enum([
57152
+ "not-loaded",
57153
+ "unknown-link",
57154
+ "wrong-state"
57155
+ ]);
57156
+ /** The answer of `confirmIdentityLink` / `dismissIdentityLink` / `unlinkIdentity`. */
57157
+ var IdentityLinkDecisionSchema = zod.z.discriminatedUnion("ok", [zod.z.object({
57158
+ ok: zod.z.literal(true),
57159
+ link: IdentityLinkSchema
57160
+ }), zod.z.object({
57161
+ ok: zod.z.literal(false),
57162
+ reason: IdentityLinkDecisionRefusalSchema,
57163
+ message: zod.z.string()
57164
+ })]);
57165
+ /** Why a link was lost. */
57166
+ var IdentityLinkLostReasonSchema = zod.z.enum([
57167
+ "evidence-gone",
57168
+ "device-removed",
57169
+ "operator-unlinked"
57170
+ ]);
57171
+ /** The payload of `identity-link.created` / `identity-link.lost` (telemetry; the record is the truth). */
57172
+ var IdentityLinkEventPayloadSchema = zod.z.object({
57173
+ linkId: zod.z.string(),
57174
+ kind: IdentityLinkKindSchema,
57175
+ aDeviceId: zod.z.number().int(),
57176
+ bDeviceId: zod.z.number().int(),
57177
+ origin: IdentityLinkOriginSchema,
57178
+ reason: IdentityLinkLostReasonSchema.optional()
57179
+ });
57180
+ //#endregion
57040
57181
  //#region src/capabilities/device-search.ts
57041
57182
  /**
57042
57183
  * `deviceManager.search` — the query behind the device → value picker.
@@ -57623,6 +57764,11 @@ var DeviceInfoSchema = zod.z.object({
57623
57764
  * the owning provider via `setIdentifiers`; read-only for the operator.
57624
57765
  * Absent ⇒ the provider declared none. */
57625
57766
  identifiers: DeviceIdentifiersSchema.optional(),
57767
+ /** The identity of the device at the far end of this device's physical
57768
+ * link (D1059 amended by D1063) — a PoE port's wired client. Written only by
57769
+ * the owning provider via `setAttachedIdentifiers`; it never makes the two
57770
+ * devices the same device. Absent ⇒ none declared. */
57771
+ attachedIdentifiers: DeviceIdentifiersSchema.optional(),
57626
57772
  /** Optional upstream-system identity + rendering envelope. See
57627
57773
  * `SourceInfo` in `packages/types/src/device/source-info.ts`. */
57628
57774
  sourceInfo: SourceInfoSchema.optional(),
@@ -57791,6 +57937,8 @@ var DeviceMetaSchema = zod.z.object({
57791
57937
  metadata: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional(),
57792
57938
  /** Provider-declared identifiers (D1059). See `DeviceMeta.identifiers`. */
57793
57939
  identifiers: DeviceIdentifiersSchema.optional(),
57940
+ /** The far end of the device's physical link (D1063). See `DeviceMeta.attachedIdentifiers`. */
57941
+ attachedIdentifiers: DeviceIdentifiersSchema.optional(),
57794
57942
  /** Optional upstream-system identity + rendering envelope. See
57795
57943
  * `SourceInfo`. Present when the device has been persisted with a
57796
57944
  * non-synthetic source identifier (HA entities, vendor MAC, …);
@@ -58304,6 +58452,46 @@ var deviceManagerCapability = {
58304
58452
  kind: "query",
58305
58453
  auth: "admin"
58306
58454
  }),
58455
+ /** Declare the identity of the device at the FAR END of this device's
58456
+ * physical link (D1063 amending D1059) — a PoE port's wired client: its MAC,
58457
+ * its IP. Same owner check, normalisation and merge as `setIdentifiers`
58458
+ * (`unread` keeps the stored value), its own column. It never makes the two
58459
+ * devices the same device: it feeds directional identity links only. */
58460
+ setAttachedIdentifiers: require_sleep.method(zod.z.object({
58461
+ deviceId: zod.z.number(),
58462
+ identifiers: DeviceIdentifiersSchema.nullable(),
58463
+ /** Kinds the provider tried to read and could not: their stored value is kept. */
58464
+ unread: zod.z.array(DeviceIdentifierKeySchema).optional()
58465
+ }), zod.z.void(), {
58466
+ kind: "mutation",
58467
+ auth: "admin"
58468
+ }),
58469
+ /** Identity links (D1063): `proposed`, `linked` and `dismissed` relations
58470
+ * between devices of different integrations, decided from their declared
58471
+ * identifiers. With `deviceId`, only the links naming that device.
58472
+ * `not-loaded` until the links have been read — never an empty list. */
58473
+ listIdentityLinks: require_sleep.method(zod.z.object({ deviceId: zod.z.number().int().optional() }), IdentityLinksReadSchema, {
58474
+ kind: "query",
58475
+ auth: "admin"
58476
+ }),
58477
+ /** Confirm a `proposed` link: it becomes `linked` by the operator and its
58478
+ * default contributions are added. Refused by name when the link is unknown
58479
+ * or not `proposed`. */
58480
+ confirmIdentityLink: require_sleep.method(zod.z.object({ linkId: zod.z.string().min(1) }), IdentityLinkDecisionSchema, {
58481
+ kind: "mutation",
58482
+ auth: "admin"
58483
+ }),
58484
+ /** Dismiss a `proposed` link: sticky, never proposed again. */
58485
+ dismissIdentityLink: require_sleep.method(zod.z.object({ linkId: zod.z.string().min(1) }), IdentityLinkDecisionSchema, {
58486
+ kind: "mutation",
58487
+ auth: "admin"
58488
+ }),
58489
+ /** Unlink a `linked` link: it becomes `dismissed` (sticky) and its stamped
58490
+ * contributions are removed. */
58491
+ unlinkIdentity: require_sleep.method(zod.z.object({ linkId: zod.z.string().min(1) }), IdentityLinkDecisionSchema, {
58492
+ kind: "mutation",
58493
+ auth: "admin"
58494
+ }),
58307
58495
  /** Operator-curated location registry. Returns the union of:
58308
58496
  * (1) labels persisted in the registry via `addLocation`, and
58309
58497
  * (2) labels currently in use on at least one device's
@@ -60182,6 +60370,116 @@ onChanged: require_sleep.event(zod.z.object({
60182
60370
  vocabulary: { notOperatorFacing: "the runtime-state mirror every trigger already reads through" }
60183
60371
  };
60184
60372
  //#endregion
60373
+ //#region src/device/state-refresh.ts
60374
+ /**
60375
+ * Server-driven device state refresh (D1062): the core decides WHEN a device is
60376
+ * re-read, the integration only knows HOW.
60377
+ *
60378
+ * A provider states its policy where it registers the device's
60379
+ * `device-state-refresh` cap (`ctx.registerNativeCap(cap, provider, {
60380
+ * stateRefresh })`). It reaches the hub by the road the command-hold options
60381
+ * take (D1061): written directly in-process, carried on a forked child's cap
60382
+ * descriptors otherwise. Plain data, wire-safe.
60383
+ */
60384
+ /** Why the core asks for a refresh. */
60385
+ var StateRefreshReasonSchema = zod.z.enum([
60386
+ "schedule",
60387
+ "command",
60388
+ "burst"
60389
+ ]);
60390
+ /**
60391
+ * What arrives without asking: `none` (everything is read), `partial` (some
60392
+ * fields arrive by push, the rest is read on the schedule), `full` (everything
60393
+ * arrives by push — never read on a schedule).
60394
+ */
60395
+ var StateRefreshPushSchema = zod.z.enum([
60396
+ "none",
60397
+ "partial",
60398
+ "full"
60399
+ ]);
60400
+ /** The fastest base cadence the core accepts from any provider. */
60401
+ var MIN_STATE_REFRESH_INTERVAL_MS = 1e3;
60402
+ var StateRefreshPolicySchema = zod.z.object({
60403
+ /**
60404
+ * The integration instance the device belongs to. Devices of one instance
60405
+ * share one schedule group: a batching provider is asked once for all of
60406
+ * them, and the heartbeat is judged across them.
60407
+ */
60408
+ integrationId: zod.z.string().min(1),
60409
+ /** The fastest interval the integration can afford for its devices. The core polls at it by default. */
60410
+ minIntervalMs: zod.z.number().int().min(MIN_STATE_REFRESH_INTERVAL_MS),
60411
+ /**
60412
+ * The operator's per-integration setting, when there is one. It can only SLOW
60413
+ * the cadence: the core polls at `max(minIntervalMs, intervalMs)`.
60414
+ */
60415
+ intervalMs: zod.z.number().int().positive().optional(),
60416
+ /** One `refresh` call can read every device of the integration at once. */
60417
+ batch: zod.z.boolean(),
60418
+ push: StateRefreshPushSchema,
60419
+ /** Longest silence a push integration may keep before the core re-reads it and asks it to resubscribe. */
60420
+ heartbeatMs: zod.z.number().int().positive().optional(),
60421
+ /**
60422
+ * Bumped by the provider each time its push subscription reconnected on its
60423
+ * own. A change makes the core re-read every device of the integration
60424
+ * (pushes lost while it was down; events may be dropped, D8).
60425
+ */
60426
+ connectionEpoch: zod.z.number().int().nonnegative().optional()
60427
+ });
60428
+ /** The cadence the core runs a policy at: the declared minimum, slowed (never sped up) by the setting. */
60429
+ function effectiveRefreshIntervalMs(policy) {
60430
+ const setting = policy.intervalMs ?? 0;
60431
+ return Math.max(policy.minIntervalMs, setting);
60432
+ }
60433
+ /** The burst after a command on a read (non-push) device: offsets from the command, in ms. */
60434
+ var COMMAND_BURST_OFFSETS_MS = [3e3, 1e4];
60435
+ /** How long the core waits for a push device to confirm a command before reading it once. */
60436
+ var PUSH_CONFIRM_WINDOW_MS = 2500;
60437
+ //#endregion
60438
+ //#region src/capabilities/device-state-refresh.cap.ts
60439
+ /**
60440
+ * device-state-refresh — the HOW of a device's state refresh, called by the
60441
+ * core, which owns the WHEN (D1062).
60442
+ *
60443
+ * The provider registers it per device with its policy
60444
+ * (`registerNativeCap(cap, provider, { stateRefresh })`). The hub's scheduler
60445
+ * calls `refresh` on the schedule, after a command and in the burst that
60446
+ * follows it, and `resubscribe` when a push integration fell silent. The
60447
+ * provider re-reads and writes the slices it already writes; nothing is
60448
+ * returned but completion.
60449
+ */
60450
+ var DeviceStateRefreshInputSchema = zod.z.object({
60451
+ /** The device the call is routed by (one of `deviceIds`). */
60452
+ deviceId: zod.z.number().int().nonnegative(),
60453
+ /** Every device to re-read: one, or the integration's whole set when the provider batches. */
60454
+ deviceIds: zod.z.array(zod.z.number().int().nonnegative()).min(1),
60455
+ reason: StateRefreshReasonSchema
60456
+ });
60457
+ var DeviceStateResubscribeInputSchema = zod.z.object({ deviceId: zod.z.number().int().nonnegative() });
60458
+ var DeviceStateRefreshResultSchema = zod.z.object({ ok: zod.z.literal(true) });
60459
+ var NOT_OPERATOR_FACING = "the core schedules state refreshes itself; an operator never asks for one";
60460
+ var deviceStateRefreshCapability = {
60461
+ name: "device-state-refresh",
60462
+ scope: "device",
60463
+ deviceNative: true,
60464
+ mode: "singleton",
60465
+ methods: {
60466
+ refresh: require_sleep.method(DeviceStateRefreshInputSchema, DeviceStateRefreshResultSchema, {
60467
+ kind: "mutation",
60468
+ auth: "admin",
60469
+ notOperatorFacing: NOT_OPERATOR_FACING
60470
+ }),
60471
+ resubscribe: require_sleep.method(DeviceStateResubscribeInputSchema, DeviceStateRefreshResultSchema, {
60472
+ kind: "mutation",
60473
+ auth: "admin",
60474
+ notOperatorFacing: NOT_OPERATOR_FACING
60475
+ })
60476
+ },
60477
+ vocabulary: {
60478
+ noun: require_sleep.t("State refresh", "Aggiornamento dello stato"),
60479
+ order: 3247
60480
+ }
60481
+ };
60482
+ //#endregion
60185
60483
  //#region src/capabilities/device-status.cap.ts
60186
60484
  /**
60187
60485
  * Generic device-level status snapshot. Auto-registered by `BaseDevice`
@@ -104597,6 +104895,7 @@ var CAPABILITY_NAMES = {
104597
104895
  deviceRemovalHook: "device-removal-hook",
104598
104896
  deviceRuns: "device-runs",
104599
104897
  deviceState: "device-state",
104898
+ deviceStateRefresh: "device-state-refresh",
104600
104899
  deviceStatus: "device-status",
104601
104900
  deviceTransitions: "device-transitions",
104602
104901
  dishwasher: "dishwasher",
@@ -105002,6 +105301,10 @@ var CAPABILITY_ROUTER_KEYS = [
105002
105301
  key: "deviceState",
105003
105302
  name: "device-state"
105004
105303
  },
105304
+ {
105305
+ key: "deviceStateRefresh",
105306
+ name: "device-state-refresh"
105307
+ },
105005
105308
  {
105006
105309
  key: "deviceStatus",
105007
105310
  name: "device-status"
@@ -105676,6 +105979,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
105676
105979
  deviceRemovalHookCapability,
105677
105980
  deviceRunsCapability,
105678
105981
  deviceStateCapability,
105982
+ deviceStateRefreshCapability,
105679
105983
  deviceStatusCapability,
105680
105984
  deviceTransitionsCapability,
105681
105985
  dishwasherCapability,
@@ -112247,6 +112551,11 @@ function ownedPaths(target) {
112247
112551
  function find(cap, targetId) {
112248
112552
  return scalarTargets(cap).find((target) => target.id === targetId) ?? null;
112249
112553
  }
112554
+ /** The feature without its identity-link stamp. */
112555
+ function unstamped(feature) {
112556
+ const { contributedBy, ...rest } = feature;
112557
+ return contributedBy === void 0 ? feature : rest;
112558
+ }
112250
112559
  function without(fields, paths) {
112251
112560
  return Object.fromEntries(Object.entries(fields).filter(([path]) => !paths.has(path)));
112252
112561
  }
@@ -112259,7 +112568,7 @@ function mergeScalarTarget(current, compiled, cap, targetId) {
112259
112568
  if (current === null || target === null || scalarTargetCount(cap) < 2) return compiled;
112260
112569
  const kept = without(current.fields, new Set(ownedPaths(target)));
112261
112570
  return {
112262
- ...current,
112571
+ ...unstamped(current),
112263
112572
  ...compiled,
112264
112573
  fields: {
112265
112574
  ...kept,
@@ -112277,7 +112586,7 @@ function removeScalarTarget(current, cap, targetId) {
112277
112586
  const needed = new Set(stillAssigned.flatMap((row) => ownedPaths(row)));
112278
112587
  const drop = new Set(ownedPaths(target).filter((path) => !needed.has(path)));
112279
112588
  return {
112280
- ...current,
112589
+ ...unstamped(current),
112281
112590
  fields: without(current.fields, drop)
112282
112591
  };
112283
112592
  }
@@ -114357,6 +114666,20 @@ var BaseDevice = class {
114357
114666
  }, raw, options);
114358
114667
  }
114359
114668
  /**
114669
+ * Declare the identity of the device at the FAR END of this device's physical
114670
+ * link (D1063): a PoE port's wired client. Same normalisation, `unread`
114671
+ * rule and owner check as {@link declareIdentifiers}, written through
114672
+ * `device-manager.setAttachedIdentifiers`. It never makes the two devices the
114673
+ * same device. Best-effort: never throws.
114674
+ */
114675
+ async declareAttachedIdentifiers(raw, options) {
114676
+ return declareDeviceIdentifiers({
114677
+ deviceId: this.id,
114678
+ logger: this.ctx.logger,
114679
+ writer: this.ctx.api.deviceManager?.setAttachedIdentifiers
114680
+ }, raw, options);
114681
+ }
114682
+ /**
114360
114683
  * Re-publish the device's current `features` array to the persisted
114361
114684
  * meta blob. Drivers call this after a probe finishes when the live
114362
114685
  * `features` getter has gained new flags (e.g. `hasIntercom` flips
@@ -122506,6 +122829,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
122506
122829
  access: "create",
122507
122830
  role: "admin"
122508
122831
  },
122832
+ "deviceManager.confirmIdentityLink": {
122833
+ capName: "device-manager",
122834
+ capScope: "system",
122835
+ addonId: null,
122836
+ access: "create",
122837
+ role: "admin"
122838
+ },
122509
122839
  "deviceManager.createDevice": {
122510
122840
  capName: "device-manager",
122511
122841
  capScope: "system",
@@ -122555,6 +122885,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
122555
122885
  access: "create",
122556
122886
  role: "admin"
122557
122887
  },
122888
+ "deviceManager.dismissIdentityLink": {
122889
+ capName: "device-manager",
122890
+ capScope: "system",
122891
+ addonId: null,
122892
+ access: "create",
122893
+ role: "admin"
122894
+ },
122558
122895
  "deviceManager.enable": {
122559
122896
  capName: "device-manager",
122560
122897
  capScope: "system",
@@ -122751,6 +123088,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
122751
123088
  access: "view",
122752
123089
  role: "admin"
122753
123090
  },
123091
+ "deviceManager.listIdentityLinks": {
123092
+ capName: "device-manager",
123093
+ capScope: "system",
123094
+ addonId: null,
123095
+ access: "view",
123096
+ role: "admin"
123097
+ },
122754
123098
  "deviceManager.listLocationDescriptions": {
122755
123099
  capName: "device-manager",
122756
123100
  capScope: "system",
@@ -122947,6 +123291,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
122947
123291
  access: "create",
122948
123292
  role: "admin"
122949
123293
  },
123294
+ "deviceManager.setAttachedIdentifiers": {
123295
+ capName: "device-manager",
123296
+ capScope: "system",
123297
+ addonId: null,
123298
+ access: "create",
123299
+ role: "admin"
123300
+ },
122950
123301
  "deviceManager.setChildLayout": {
122951
123302
  capName: "device-manager",
122952
123303
  capScope: "system",
@@ -123108,6 +123459,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
123108
123459
  access: "create",
123109
123460
  role: "admin"
123110
123461
  },
123462
+ "deviceManager.unlinkIdentity": {
123463
+ capName: "device-manager",
123464
+ capScope: "system",
123465
+ addonId: null,
123466
+ access: "delete",
123467
+ role: "admin"
123468
+ },
123111
123469
  "deviceManager.updateConfig": {
123112
123470
  capName: "device-manager",
123113
123471
  capScope: "system",
@@ -123388,6 +123746,20 @@ var METHOD_ACCESS_MAP = Object.freeze({
123388
123746
  access: "create",
123389
123747
  role: "admin"
123390
123748
  },
123749
+ "deviceStateRefresh.refresh": {
123750
+ capName: "device-state-refresh",
123751
+ capScope: "device",
123752
+ addonId: null,
123753
+ access: "create",
123754
+ role: "admin"
123755
+ },
123756
+ "deviceStateRefresh.resubscribe": {
123757
+ capName: "device-state-refresh",
123758
+ capScope: "device",
123759
+ addonId: null,
123760
+ access: "create",
123761
+ role: "admin"
123762
+ },
123391
123763
  "deviceStatus.getStatus": {
123392
123764
  capName: "device-status",
123393
123765
  capScope: "device",
@@ -131028,6 +131400,7 @@ var KNOWN_CAP_NAMES = [
131028
131400
  "device-removal-hook",
131029
131401
  "device-runs",
131030
131402
  "device-state",
131403
+ "device-state-refresh",
131031
131404
  "device-status",
131032
131405
  "device-transitions",
131033
131406
  "dishwasher",
@@ -131210,6 +131583,7 @@ var DEVICE_CAP_NAMES = [
131210
131583
  "device-extension",
131211
131584
  "device-ops",
131212
131585
  "device-runs",
131586
+ "device-state-refresh",
131213
131587
  "device-status",
131214
131588
  "device-transitions",
131215
131589
  "dishwasher",
@@ -134085,6 +134459,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
134085
134459
  form: "array",
134086
134460
  optional: true
134087
134461
  }],
134462
+ "deviceManager.listIdentityLinks": [{
134463
+ name: "deviceId",
134464
+ form: "single",
134465
+ optional: true
134466
+ }],
134088
134467
  "deviceManager.loadConfig": [{
134089
134468
  name: "deviceId",
134090
134469
  form: "single",
@@ -134135,6 +134514,11 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
134135
134514
  form: "single",
134136
134515
  optional: false
134137
134516
  }],
134517
+ "deviceManager.setAttachedIdentifiers": [{
134518
+ name: "deviceId",
134519
+ form: "single",
134520
+ optional: false
134521
+ }],
134138
134522
  "deviceManager.setChildLayout": [{
134139
134523
  name: "deviceId",
134140
134524
  form: "single",
@@ -134329,6 +134713,20 @@ var METHOD_DEVICE_SELECTORS = Object.freeze({
134329
134713
  form: "single",
134330
134714
  optional: false
134331
134715
  }],
134716
+ "deviceStateRefresh.refresh": [{
134717
+ name: "deviceId",
134718
+ form: "single",
134719
+ optional: false
134720
+ }, {
134721
+ name: "deviceIds",
134722
+ form: "array",
134723
+ optional: false
134724
+ }],
134725
+ "deviceStateRefresh.resubscribe": [{
134726
+ name: "deviceId",
134727
+ form: "single",
134728
+ optional: false
134729
+ }],
134332
134730
  "deviceStatus.getStatus": [{
134333
134731
  name: "deviceId",
134334
134732
  form: "single",
@@ -136751,6 +137149,7 @@ var SYSTEM_SCOPE_DEVICE_METHODS = [
136751
137149
  "deviceManager.getWireableFields",
136752
137150
  "deviceManager.getWrapperActivation",
136753
137151
  "deviceManager.listAll",
137152
+ "deviceManager.listIdentityLinks",
136754
137153
  "deviceManager.loadConfig",
136755
137154
  "deviceManager.loadMeta",
136756
137155
  "deviceManager.loadRuntimeState",
@@ -136761,6 +137160,7 @@ var SYSTEM_SCOPE_DEVICE_METHODS = [
136761
137160
  "deviceManager.removeDevice",
136762
137161
  "deviceManager.runDeviceAction",
136763
137162
  "deviceManager.setAlias",
137163
+ "deviceManager.setAttachedIdentifiers",
136764
137164
  "deviceManager.setChildLayout",
136765
137165
  "deviceManager.setDisabled",
136766
137166
  "deviceManager.setDisplay",
@@ -138145,6 +138545,9 @@ function createSystemProxy(api) {
138145
138545
  getRoleDisplayDefaults: (input) => dispatch("deviceManager", "getRoleDisplayDefaults", "query", input),
138146
138546
  setRoleDisplayDefaults: (input) => dispatch("deviceManager", "setRoleDisplayDefaults", "mutation", input),
138147
138547
  listIdentityCandidates: (input) => dispatch("deviceManager", "listIdentityCandidates", "query", input),
138548
+ confirmIdentityLink: (input) => dispatch("deviceManager", "confirmIdentityLink", "mutation", input),
138549
+ dismissIdentityLink: (input) => dispatch("deviceManager", "dismissIdentityLink", "mutation", input),
138550
+ unlinkIdentity: (input) => dispatch("deviceManager", "unlinkIdentity", "mutation", input),
138148
138551
  listLocations: (input) => dispatch("deviceManager", "listLocations", "query", input),
138149
138552
  addLocation: (input) => dispatch("deviceManager", "addLocation", "mutation", input),
138150
138553
  removeLocation: (input) => dispatch("deviceManager", "removeLocation", "mutation", input),
@@ -151365,6 +151768,7 @@ exports.CLUSTER_MODEL_SECTION_ID = CLUSTER_MODEL_SECTION_ID;
151365
151768
  exports.CLUSTER_STEP_SETTING_FIELDS = CLUSTER_STEP_SETTING_FIELDS;
151366
151769
  exports.COCO_80_LABELS = COCO_80_LABELS;
151367
151770
  exports.COCO_TO_MACRO = COCO_TO_MACRO;
151771
+ exports.COMMAND_BURST_OFFSETS_MS = COMMAND_BURST_OFFSETS_MS;
151368
151772
  exports.COMPOSED_DEVICE_STABLE_ID_PREFIX = require_composed_stable_id.COMPOSED_DEVICE_STABLE_ID_PREFIX;
151369
151773
  exports.COMPOSED_ITEM_FIXED_FIELDS = COMPOSED_ITEM_FIXED_FIELDS;
151370
151774
  exports.COMPOSER_ADDON_ID = require_implemented_methods.COMPOSER_ADDON_ID;
@@ -151514,6 +151918,7 @@ exports.CompositionBlockInputSchema = CompositionBlockInputSchema;
151514
151918
  exports.CompositionBlockStateSchema = CompositionBlockStateSchema;
151515
151919
  exports.CompositionCodeSourceSchema = require_implemented_methods.CompositionCodeSourceSchema;
151516
151920
  exports.CompositionCommandTargetSchema = require_implemented_methods.CompositionCommandTargetSchema;
151921
+ exports.CompositionContributedBySchema = require_implemented_methods.CompositionContributedBySchema;
151517
151922
  exports.CompositionCustomizationReadSchema = CompositionCustomizationReadSchema;
151518
151923
  exports.CompositionEventPlanSchema = CompositionEventPlanSchema;
151519
151924
  exports.CompositionExistingTargetSchema = require_implemented_methods.CompositionExistingTargetSchema;
@@ -151810,6 +152215,9 @@ exports.DeviceSearchRequiresSchema = DeviceSearchRequiresSchema;
151810
152215
  exports.DeviceSearchResultSchema = DeviceSearchResultSchema;
151811
152216
  exports.DeviceSelectorSchema = DeviceSelectorSchema;
151812
152217
  exports.DeviceSignaturePurposeSchema = DeviceSignaturePurposeSchema;
152218
+ exports.DeviceStateRefreshInputSchema = DeviceStateRefreshInputSchema;
152219
+ exports.DeviceStateRefreshResultSchema = DeviceStateRefreshResultSchema;
152220
+ exports.DeviceStateResubscribeInputSchema = DeviceStateResubscribeInputSchema;
151813
152221
  exports.DeviceStatusSchema = DeviceStatusSchema;
151814
152222
  exports.DeviceTemplateRefusalSchema = DeviceTemplateRefusalSchema;
151815
152223
  exports.DeviceTemplateRenderSchema = DeviceTemplateRenderSchema;
@@ -152159,6 +152567,8 @@ exports.ICON_CATEGORIES = ICON_CATEGORIES;
152159
152567
  exports.ICON_ENTRIES = ICON_ENTRIES;
152160
152568
  exports.ICON_KEYS = ICON_KEYS;
152161
152569
  exports.ICON_VIEWER_MODULES = ICON_VIEWER_MODULES;
152570
+ exports.IDENTITY_LINK_KINDS = IDENTITY_LINK_KINDS;
152571
+ exports.IDENTITY_LINK_KIND_NAMES = IDENTITY_LINK_KIND_NAMES;
152162
152572
  exports.IDLE_ACTION_STATUS = IDLE_ACTION_STATUS;
152163
152573
  exports.INFERENCE_DEVICE_EXCLUSION_REASONS = INFERENCE_DEVICE_EXCLUSION_REASONS;
152164
152574
  exports.INITIAL_PULSE = INITIAL_PULSE;
@@ -152177,6 +152587,17 @@ exports.IdentityCandidateDeviceSchema = IdentityCandidateDeviceSchema;
152177
152587
  exports.IdentityCandidatePairSchema = IdentityCandidatePairSchema;
152178
152588
  exports.IdentityCandidatesSchema = IdentityCandidatesSchema;
152179
152589
  exports.IdentityConfidenceSchema = IdentityConfidenceSchema;
152590
+ exports.IdentityLinkBodySchema = IdentityLinkBodySchema;
152591
+ exports.IdentityLinkDecisionRefusalSchema = IdentityLinkDecisionRefusalSchema;
152592
+ exports.IdentityLinkDecisionSchema = IdentityLinkDecisionSchema;
152593
+ exports.IdentityLinkEventPayloadSchema = IdentityLinkEventPayloadSchema;
152594
+ exports.IdentityLinkKindSchema = IdentityLinkKindSchema;
152595
+ exports.IdentityLinkLostReasonSchema = IdentityLinkLostReasonSchema;
152596
+ exports.IdentityLinkOriginSchema = IdentityLinkOriginSchema;
152597
+ exports.IdentityLinkSchema = IdentityLinkSchema;
152598
+ exports.IdentityLinkSideSchema = IdentityLinkSideSchema;
152599
+ exports.IdentityLinkStateSchema = IdentityLinkStateSchema;
152600
+ exports.IdentityLinksReadSchema = IdentityLinksReadSchema;
152180
152601
  exports.IdentityMatchedKeySchema = IdentityMatchedKeySchema;
152181
152602
  exports.ImageContractSchema = ImageContractSchema;
152182
152603
  exports.ImageContractStateSchema = ImageContractStateSchema;
@@ -152409,6 +152830,7 @@ exports.MIN_CUSTOM_MINUTES = require_implemented_methods.MIN_CUSTOM_MINUTES;
152409
152830
  exports.MIN_RUN_MS = MIN_RUN_MS;
152410
152831
  exports.MIN_SCRUBBED_LENGTH = require_sleep.MIN_SCRUBBED_LENGTH;
152411
152832
  exports.MIN_SESSIONS_PER_DEVICE_RANGE = MIN_SESSIONS_PER_DEVICE_RANGE;
152833
+ exports.MIN_STATE_REFRESH_INTERVAL_MS = MIN_STATE_REFRESH_INTERVAL_MS;
152412
152834
  exports.MODEL_FORMATS = require_sleep.MODEL_FORMATS;
152413
152835
  exports.MODEL_HOSTING = MODEL_HOSTING;
152414
152836
  exports.MODEL_PROVIDER_IDS = MODEL_PROVIDER_IDS;
@@ -152885,6 +153307,7 @@ exports.PROVIDER_KIND_CAP_NAMES = PROVIDER_KIND_CAP_NAMES;
152885
153307
  exports.PROVIDER_PIN_FIELD = require_sleep.PROVIDER_PIN_FIELD;
152886
153308
  exports.PUBLIC_ENDPOINT_HTTP_REASON = PUBLIC_ENDPOINT_HTTP_REASON;
152887
153309
  exports.PULSE_MAX_MS = PULSE_MAX_MS;
153310
+ exports.PUSH_CONFIRM_WINDOW_MS = PUSH_CONFIRM_WINDOW_MS;
152888
153311
  exports.PYTHON_SCRIPT = PYTHON_SCRIPT;
152889
153312
  exports.PackageInstallationSchema = PackageInstallationSchema;
152890
153313
  exports.PackageInstallationsSchema = PackageInstallationsSchema;
@@ -153433,6 +153856,9 @@ exports.StaleSettingsKeyFindingSchema = StaleSettingsKeyFindingSchema;
153433
153856
  exports.StartClusterUpdateResultSchema = StartClusterUpdateResultSchema;
153434
153857
  exports.StartEmbeddedInputSchema = StartEmbeddedInputSchema;
153435
153858
  exports.StartEnrollmentOutputSchema = StartEnrollmentOutputSchema;
153859
+ exports.StateRefreshPolicySchema = StateRefreshPolicySchema;
153860
+ exports.StateRefreshPushSchema = StateRefreshPushSchema;
153861
+ exports.StateRefreshReasonSchema = StateRefreshReasonSchema;
153436
153862
  exports.StationaryObjectSchema = StationaryObjectSchema;
153437
153863
  exports.StationarySubjectSchema = StationarySubjectSchema;
153438
153864
  exports.StatisticHelperSpecSchema = require_implemented_methods.StatisticHelperSpecSchema;
@@ -154197,6 +154623,7 @@ exports.deviceRunsCapability = deviceRunsCapability;
154197
154623
  exports.deviceSelectorMatches = deviceSelectorMatches;
154198
154624
  exports.deviceSleeps = deviceSleeps;
154199
154625
  exports.deviceStateCapability = deviceStateCapability;
154626
+ exports.deviceStateRefreshCapability = deviceStateRefreshCapability;
154200
154627
  exports.deviceStatusCapability = deviceStatusCapability;
154201
154628
  exports.deviceTemplateCallableBounds = require_device_template_catalogue.deviceTemplateCallableBounds;
154202
154629
  exports.deviceTemplateCameraValues = require_device_template_catalogue.deviceTemplateCameraValues;
@@ -154223,6 +154650,7 @@ exports.doorbellCapability = doorbellCapability;
154223
154650
  exports.droppedConditionsForKind = droppedConditionsForKind;
154224
154651
  exports.edgetpuDelegateDevice = edgetpuDelegateDevice;
154225
154652
  exports.effectConditionHolds = require_sleep.effectConditionHolds;
154653
+ exports.effectiveRefreshIntervalMs = effectiveRefreshIntervalMs;
154226
154654
  exports.effectiveStepSettings = effectiveStepSettings;
154227
154655
  exports.egressTranscodeSharingKey = egressTranscodeSharingKey;
154228
154656
  exports.egressTransportFromRequest = egressTransportFromRequest;
@@ -154418,6 +154846,8 @@ exports.iconEntry = iconEntry;
154418
154846
  exports.iconsInCategory = iconsInCategory;
154419
154847
  exports.identifiedEventLeaves = identifiedEventLeaves;
154420
154848
  exports.identifierStrength = identifierStrength;
154849
+ exports.identityLinkId = identityLinkId;
154850
+ exports.identityLinkSidesRefusal = identityLinkSidesRefusal;
154421
154851
  exports.imageCapability = imageCapability;
154422
154852
  exports.imageModesForKind = imageModesForKind;
154423
154853
  exports.imageSettingsCapability = imageSettingsCapability;