@camstack/addon-provider-tuya 0.2.24 → 0.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -819,7 +819,7 @@ async function discoverDevices(options = {}, binder = createDgramBinder()) {
819
819
  return [...byId.values()];
820
820
  }
821
821
  //#endregion
822
- //#region ../types/dist/event-category-XfKNtfCc.mjs
822
+ //#region ../types/dist/event-category-CIa_iT6b.mjs
823
823
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
824
824
  EventCategory["SystemBoot"] = "system.boot";
825
825
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -835,6 +835,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
835
835
  */
836
836
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
837
837
  /**
838
+ * The hub reissued its own TLS certificate at boot (`ensureTlsCert`).
839
+ * Emitted only when the material on disk actually changed, so an
840
+ * operator who trusted the old certificate by hand is told rather than
841
+ * discovering it as a browser error. Payload `TlsCertChangedPayload`.
842
+ *
843
+ * Rule: docs/decisions/adr-0227-*.md
844
+ */
845
+ EventCategory["SystemTlsCertChanged"] = "system.tls-cert-changed";
846
+ /**
838
847
  * A newer addon or server-root package version was found by the
839
848
  * authoritative registry check. Emitted once when any observed
840
849
  * `latestVersion` changes (or a package/node first appears behind);
@@ -19818,6 +19827,12 @@ var CameraStatusSchema = object({
19818
19827
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19819
19828
  fetchedAt: number()
19820
19829
  });
19830
+ var InferenceDeviceExclusionReasonSchema = _enum([
19831
+ "disabled",
19832
+ "unavailable",
19833
+ "cannot-host-camera-root",
19834
+ "accelerator-preferred"
19835
+ ]);
19821
19836
  var NodeInferenceDeviceSchema = object({
19822
19837
  /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
19823
19838
  key: string(),
@@ -19848,7 +19863,17 @@ var NodeInferenceDeviceSchema = object({
19848
19863
  * available per format; this is the stored selection that becomes the
19849
19864
  * default for EVERY camera landing on this accelerator.
19850
19865
  */
19851
- steps: record(string(), DeviceStepConfigSchema).optional()
19866
+ steps: record(string(), DeviceStepConfigSchema).optional(),
19867
+ /**
19868
+ * `null` when the device IS a camera-root candidate on this node; otherwise
19869
+ * the reason the dispatcher drops it. Computed by the SAME
19870
+ * `resolveInferenceDeviceEligibility` the dispatcher runs, so this view can
19871
+ * never disagree with the election — deriving it in the UI from
19872
+ * `enabled`/`available` would silently miss `cannot-host-camera-root` (needs
19873
+ * the node's model catalog) and `accelerator-preferred` (needs the node-wide
19874
+ * "an accelerator is serving" predicate).
19875
+ */
19876
+ exclusion: InferenceDeviceExclusionReasonSchema.nullable()
19852
19877
  });
19853
19878
  var NodeInferenceDevicesSchema = object({
19854
19879
  nodeId: string(),
@@ -24707,7 +24732,12 @@ var ListResultSchema = object({
24707
24732
  probedAt: number()
24708
24733
  });
24709
24734
  var PreferredSchema = LocalInterfaceSchema.nullable();
24710
- var GetConnectionEndpointsResultSchema = object({ endpoints: array(object({
24735
+ /**
24736
+ * Candidate base URL for the SDK to race on connect. Order matters —
24737
+ * the SDK should attempt these top-to-bottom with a short per-candidate
24738
+ * timeout (e.g. 1500ms) and cache the winner for the session.
24739
+ */
24740
+ var ConnectionEndpointSchema = object({
24711
24741
  /** Operator-facing label (e.g. "LAN — en0", "Public tunnel"). */
24712
24742
  label: string(),
24713
24743
  /** Fully-formed base URL with scheme + host + port. */
@@ -24750,7 +24780,42 @@ var GetConnectionEndpointsResultSchema = object({ endpoints: array(object({
24750
24780
  * ordering between polls.
24751
24781
  */
24752
24782
  priority: number()
24753
- })).readonly() });
24783
+ });
24784
+ /**
24785
+ * Where the advertised local port came from. Ordered most → least
24786
+ * authoritative, and the whole point of returning it: a client must be able to
24787
+ * tell a FACT about the hub's socket from an echo of its own guess.
24788
+ */
24789
+ var LocalPortSourceEnum = _enum([
24790
+ "server-config",
24791
+ "server-env",
24792
+ "caller-hint",
24793
+ "default"
24794
+ ]);
24795
+ /** The port every LAN/loopback `baseUrl` in the same result was built with. */
24796
+ var AdvertisedLocalPortSchema = object({
24797
+ port: number().int().min(1).max(65535),
24798
+ source: LocalPortSourceEnum
24799
+ });
24800
+ var GetConnectionEndpointsResultSchema = object({
24801
+ endpoints: array(ConnectionEndpointSchema).readonly(),
24802
+ /**
24803
+ * The port the hub built the LAN/loopback URLs with, and where that number
24804
+ * came from.
24805
+ *
24806
+ * Returned rather than merely applied, because "the URL is right" and "the
24807
+ * client can KNOW the URL is right" are different properties. A client that
24808
+ * only sees a corrected URL cannot distinguish a hub that fixed the port from
24809
+ * a hub that echoed the port the client sent, so it cannot decide whether to
24810
+ * race the candidate or discard it. With `source` it can: anything but
24811
+ * `caller-hint` is the hub's own socket.
24812
+ *
24813
+ * Absent on hubs predating this field — a client that finds it missing is
24814
+ * talking to an echoing hub and must degrade exactly as it does for
24815
+ * `caller-hint`.
24816
+ */
24817
+ localPort: AdvertisedLocalPortSchema
24818
+ });
24754
24819
  /**
24755
24820
  * The chosen outbound endpoint for notification artifacts. `baseUrl: null` =
24756
24821
  * AUTO (resolved from the candidate ranking at send time); `resolved` reports
@@ -24771,8 +24836,13 @@ var AllowedAddressesSchema = object({
24771
24836
  */
24772
24837
  addresses: array(string()).readonly() });
24773
24838
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
24774
- /** Local hub HTTP port to use in base URLs. */
24775
- port: number().int().min(1).max(65535),
24839
+ /**
24840
+ * LEGACY HINT — do not send from new code. Kept optional so clients
24841
+ * written against the echoing contract keep working; the hub uses it
24842
+ * only when it cannot read its own port, and says so via
24843
+ * `localPort.source === 'caller-hint'`.
24844
+ */
24845
+ port: number().int().min(1).max(65535).optional(),
24776
24846
  /** Include `http(s)://127.0.0.1:<port>` as the lowest-priority
24777
24847
  * candidate. Default `true`. */
24778
24848
  includeLoopback: boolean().optional(),
package/dist/addon.mjs CHANGED
@@ -818,7 +818,7 @@ async function discoverDevices(options = {}, binder = createDgramBinder()) {
818
818
  return [...byId.values()];
819
819
  }
820
820
  //#endregion
821
- //#region ../types/dist/event-category-XfKNtfCc.mjs
821
+ //#region ../types/dist/event-category-CIa_iT6b.mjs
822
822
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
823
823
  EventCategory["SystemBoot"] = "system.boot";
824
824
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -834,6 +834,15 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
834
834
  */
835
835
  EventCategory["SystemRestartCompleted"] = "system.restart-completed";
836
836
  /**
837
+ * The hub reissued its own TLS certificate at boot (`ensureTlsCert`).
838
+ * Emitted only when the material on disk actually changed, so an
839
+ * operator who trusted the old certificate by hand is told rather than
840
+ * discovering it as a browser error. Payload `TlsCertChangedPayload`.
841
+ *
842
+ * Rule: docs/decisions/adr-0227-*.md
843
+ */
844
+ EventCategory["SystemTlsCertChanged"] = "system.tls-cert-changed";
845
+ /**
837
846
  * A newer addon or server-root package version was found by the
838
847
  * authoritative registry check. Emitted once when any observed
839
848
  * `latestVersion` changes (or a package/node first appears behind);
@@ -19817,6 +19826,12 @@ var CameraStatusSchema = object({
19817
19826
  /** Unix timestamp (ms) when this snapshot was composed server-side. */
19818
19827
  fetchedAt: number()
19819
19828
  });
19829
+ var InferenceDeviceExclusionReasonSchema = _enum([
19830
+ "disabled",
19831
+ "unavailable",
19832
+ "cannot-host-camera-root",
19833
+ "accelerator-preferred"
19834
+ ]);
19820
19835
  var NodeInferenceDeviceSchema = object({
19821
19836
  /** Stable per-node device key, e.g. `openvino:npu`, `edgetpu:usb`, `cpu`. */
19822
19837
  key: string(),
@@ -19847,7 +19862,17 @@ var NodeInferenceDeviceSchema = object({
19847
19862
  * available per format; this is the stored selection that becomes the
19848
19863
  * default for EVERY camera landing on this accelerator.
19849
19864
  */
19850
- steps: record(string(), DeviceStepConfigSchema).optional()
19865
+ steps: record(string(), DeviceStepConfigSchema).optional(),
19866
+ /**
19867
+ * `null` when the device IS a camera-root candidate on this node; otherwise
19868
+ * the reason the dispatcher drops it. Computed by the SAME
19869
+ * `resolveInferenceDeviceEligibility` the dispatcher runs, so this view can
19870
+ * never disagree with the election — deriving it in the UI from
19871
+ * `enabled`/`available` would silently miss `cannot-host-camera-root` (needs
19872
+ * the node's model catalog) and `accelerator-preferred` (needs the node-wide
19873
+ * "an accelerator is serving" predicate).
19874
+ */
19875
+ exclusion: InferenceDeviceExclusionReasonSchema.nullable()
19851
19876
  });
19852
19877
  var NodeInferenceDevicesSchema = object({
19853
19878
  nodeId: string(),
@@ -24706,7 +24731,12 @@ var ListResultSchema = object({
24706
24731
  probedAt: number()
24707
24732
  });
24708
24733
  var PreferredSchema = LocalInterfaceSchema.nullable();
24709
- var GetConnectionEndpointsResultSchema = object({ endpoints: array(object({
24734
+ /**
24735
+ * Candidate base URL for the SDK to race on connect. Order matters —
24736
+ * the SDK should attempt these top-to-bottom with a short per-candidate
24737
+ * timeout (e.g. 1500ms) and cache the winner for the session.
24738
+ */
24739
+ var ConnectionEndpointSchema = object({
24710
24740
  /** Operator-facing label (e.g. "LAN — en0", "Public tunnel"). */
24711
24741
  label: string(),
24712
24742
  /** Fully-formed base URL with scheme + host + port. */
@@ -24749,7 +24779,42 @@ var GetConnectionEndpointsResultSchema = object({ endpoints: array(object({
24749
24779
  * ordering between polls.
24750
24780
  */
24751
24781
  priority: number()
24752
- })).readonly() });
24782
+ });
24783
+ /**
24784
+ * Where the advertised local port came from. Ordered most → least
24785
+ * authoritative, and the whole point of returning it: a client must be able to
24786
+ * tell a FACT about the hub's socket from an echo of its own guess.
24787
+ */
24788
+ var LocalPortSourceEnum = _enum([
24789
+ "server-config",
24790
+ "server-env",
24791
+ "caller-hint",
24792
+ "default"
24793
+ ]);
24794
+ /** The port every LAN/loopback `baseUrl` in the same result was built with. */
24795
+ var AdvertisedLocalPortSchema = object({
24796
+ port: number().int().min(1).max(65535),
24797
+ source: LocalPortSourceEnum
24798
+ });
24799
+ var GetConnectionEndpointsResultSchema = object({
24800
+ endpoints: array(ConnectionEndpointSchema).readonly(),
24801
+ /**
24802
+ * The port the hub built the LAN/loopback URLs with, and where that number
24803
+ * came from.
24804
+ *
24805
+ * Returned rather than merely applied, because "the URL is right" and "the
24806
+ * client can KNOW the URL is right" are different properties. A client that
24807
+ * only sees a corrected URL cannot distinguish a hub that fixed the port from
24808
+ * a hub that echoed the port the client sent, so it cannot decide whether to
24809
+ * race the candidate or discard it. With `source` it can: anything but
24810
+ * `caller-hint` is the hub's own socket.
24811
+ *
24812
+ * Absent on hubs predating this field — a client that finds it missing is
24813
+ * talking to an echoing hub and must degrade exactly as it does for
24814
+ * `caller-hint`.
24815
+ */
24816
+ localPort: AdvertisedLocalPortSchema
24817
+ });
24753
24818
  /**
24754
24819
  * The chosen outbound endpoint for notification artifacts. `baseUrl: null` =
24755
24820
  * AUTO (resolved from the candidate ranking at send time); `resolved` reports
@@ -24770,8 +24835,13 @@ var AllowedAddressesSchema = object({
24770
24835
  */
24771
24836
  addresses: array(string()).readonly() });
24772
24837
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
24773
- /** Local hub HTTP port to use in base URLs. */
24774
- port: number().int().min(1).max(65535),
24838
+ /**
24839
+ * LEGACY HINT — do not send from new code. Kept optional so clients
24840
+ * written against the echoing contract keep working; the hub uses it
24841
+ * only when it cannot read its own port, and says so via
24842
+ * `localPort.source === 'caller-hint'`.
24843
+ */
24844
+ port: number().int().min(1).max(65535).optional(),
24775
24845
  /** Include `http(s)://127.0.0.1:<port>` as the lowest-priority
24776
24846
  * candidate. Default `true`. */
24777
24847
  includeLoopback: boolean().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-tuya",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "description": "Tuya / Smart Life device-provider addon for CamStack — account-onboarded (Tuya IoT cloud fetch of device localKeys) + LOCAL DP control via the @apocaliss92/nodetuya encrypted-LAN client, exposing switch / water-heater-family kettle entities",
5
5
  "keywords": [
6
6
  "camstack",