@camstack/addon-export-alexa 1.2.178 → 1.2.179

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.
@@ -791,7 +791,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
791
791
  return EventCategory;
792
792
  }({});
793
793
  //#endregion
794
- //#region ../types/dist/device-type-BOWLtoOt.mjs
794
+ //#region ../types/dist/device-type-CfHw_quR.mjs
795
795
  /**
796
796
  import { errMsg } from '@camstack/types'
797
797
  * Extract a human-readable message from an unknown error value.
@@ -980,6 +980,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
980
980
  DeviceFeature["CoverPositionable"] = "cover-positionable";
981
981
  /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
982
982
  DeviceFeature["CoverTilt"] = "cover-tilt";
983
+ /** Cover has a real stop: `stop` halts the travel in place. Gates the stop
984
+ * control in exporters; a provider whose `stop` is a no-op never declares it. */
985
+ DeviceFeature["CoverStoppable"] = "cover-stoppable";
983
986
  /** Valve exposes intermediate position control (0..100). Gates the
984
987
  * position slider / drag surface UI. */
985
988
  DeviceFeature["ValvePositionable"] = "valve-positionable";
@@ -5845,7 +5848,7 @@ var ZodIssueCode = {
5845
5848
  var ZodFirstPartyTypeKind;
5846
5849
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5847
5850
  //#endregion
5848
- //#region ../types/dist/sleep-_4vKNWxb.mjs
5851
+ //#region ../types/dist/sleep-hmSP-eJt.mjs
5849
5852
  /**
5850
5853
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5851
5854
  * window to float samples (D455).
@@ -5962,7 +5965,7 @@ function isKeychainStoredField(field) {
5962
5965
  var SECRET_CLEAR = { $secretClear: true };
5963
5966
  /** The `'***'` token D634 redaction writes for non-admins. */
5964
5967
  var LEGACY_DEVICE_REDACTION = "***";
5965
- function isRecord$6(value) {
5968
+ function isRecord$7(value) {
5966
5969
  return typeof value === "object" && value !== null && !Array.isArray(value);
5967
5970
  }
5968
5971
  function makeSecretMarker(ref) {
@@ -5973,12 +5976,12 @@ function makeSecretMarker(ref) {
5973
5976
  }
5974
5977
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5975
5978
  function isSecretMarker(value) {
5976
- if (!isRecord$6(value)) return false;
5979
+ if (!isRecord$7(value)) return false;
5977
5980
  const ref = value["$secret"];
5978
5981
  return typeof ref === "string" && ref.length > 0;
5979
5982
  }
5980
5983
  function isSecretClear(value) {
5981
- return isRecord$6(value) && value["$secretClear"] === true;
5984
+ return isRecord$7(value) && value["$secretClear"] === true;
5982
5985
  }
5983
5986
  /**
5984
5987
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6361,6 +6364,53 @@ function emitReadiness(bus, params) {
6361
6364
  ts
6362
6365
  }));
6363
6366
  }
6367
+ /** Why a catalogue entry is not a runnable body of its declared kind. */
6368
+ var AddonMigrationDefinitionError = class extends Error {
6369
+ id;
6370
+ constructor(id, message) {
6371
+ super(`${id}: ${message}`);
6372
+ this.id = id;
6373
+ this.name = "AddonMigrationDefinitionError";
6374
+ }
6375
+ };
6376
+ /**
6377
+ * Bind a catalogue to the addon's ports. Throws {@link AddonMigrationDefinitionError} when
6378
+ * an entry's `bodyKind` does not match the body it carries, or is `sql` (a hub-only
6379
+ * body). A throwing body never escapes `execute`: it is reported as a failed result.
6380
+ */
6381
+ function defineAddonMigrations(catalogue, ports) {
6382
+ return catalogue.map((entry) => {
6383
+ const { meta } = entry;
6384
+ if ("plan" in entry) {
6385
+ if (meta.bodyKind !== "plan") throw new AddonMigrationDefinitionError(meta.id, `carries a plan body but declares "${meta.bodyKind}"`);
6386
+ return {
6387
+ meta,
6388
+ execute: () => guarded(async () => ({
6389
+ kind: "plan",
6390
+ plan: await entry.plan(ports)
6391
+ }))
6392
+ };
6393
+ }
6394
+ if (meta.bodyKind !== "procedure") throw new AddonMigrationDefinitionError(meta.id, `carries a procedure body but declares "${meta.bodyKind}"`);
6395
+ return {
6396
+ meta,
6397
+ execute: () => guarded(async () => ({
6398
+ kind: "procedure",
6399
+ result: await entry.procedure(ports)
6400
+ }))
6401
+ };
6402
+ });
6403
+ }
6404
+ async function guarded(work) {
6405
+ try {
6406
+ return await work();
6407
+ } catch (err) {
6408
+ return {
6409
+ kind: "failed",
6410
+ error: errMsg$1(err)
6411
+ };
6412
+ }
6413
+ }
6364
6414
  var NOT_RUN = {
6365
6415
  declared: false,
6366
6416
  snapshot: null,
@@ -6684,7 +6734,7 @@ var KeychainWriteRefusedError = class extends Error {
6684
6734
  }
6685
6735
  };
6686
6736
  var KEEP = { kind: "keep" };
6687
- function isRecord$5(value) {
6737
+ function isRecord$6(value) {
6688
6738
  return typeof value === "object" && value !== null && !Array.isArray(value);
6689
6739
  }
6690
6740
  function defaultMintId() {
@@ -6697,7 +6747,7 @@ function collectSecretMarkerRefs(value, out = []) {
6697
6747
  return out;
6698
6748
  }
6699
6749
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6700
- else if (isRecord$5(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6750
+ else if (isRecord$6(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6701
6751
  return out;
6702
6752
  }
6703
6753
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6752,7 +6802,7 @@ function rowId(row, idKey) {
6752
6802
  return null;
6753
6803
  }
6754
6804
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6755
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$5) : [];
6805
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$6) : [];
6756
6806
  if (!Array.isArray(incoming)) {
6757
6807
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6758
6808
  return {
@@ -6768,7 +6818,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6768
6818
  const kept = /* @__PURE__ */ new Set();
6769
6819
  const rows = [];
6770
6820
  for (const row of incoming) {
6771
- if (!isRecord$5(row)) {
6821
+ if (!isRecord$6(row)) {
6772
6822
  rows.push(row);
6773
6823
  continue;
6774
6824
  }
@@ -6793,7 +6843,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6793
6843
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6794
6844
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6795
6845
  case "object": {
6796
- if (!isRecord$5(incoming)) {
6846
+ if (!isRecord$6(incoming)) {
6797
6847
  if (incoming === void 0) return KEEP;
6798
6848
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6799
6849
  return {
@@ -6801,7 +6851,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6801
6851
  value: incoming
6802
6852
  };
6803
6853
  }
6804
- const storedObj = isRecord$5(stored) ? stored : {};
6854
+ const storedObj = isRecord$6(stored) ? stored : {};
6805
6855
  return {
6806
6856
  kind: "value",
6807
6857
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6924,7 +6974,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6924
6974
  value: items
6925
6975
  };
6926
6976
  }
6927
- if (isRecord$5(v)) {
6977
+ if (isRecord$6(v)) {
6928
6978
  const out = {};
6929
6979
  for (const [k, child] of Object.entries(v)) {
6930
6980
  const s = substitute(child);
@@ -6956,7 +7006,7 @@ var SecretOverwriteRefusedError = class extends Error {
6956
7006
  this.name = "SecretOverwriteRefusedError";
6957
7007
  }
6958
7008
  };
6959
- function isRecord$4(value) {
7009
+ function isRecord$5(value) {
6960
7010
  return typeof value === "object" && value !== null && !Array.isArray(value);
6961
7011
  }
6962
7012
  function resolvedValue(pass, marker) {
@@ -6985,7 +7035,7 @@ function inArray(pass, incoming, stored) {
6985
7035
  return incoming.map((item, index) => {
6986
7036
  const twin = stored[index];
6987
7037
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6988
- if (isRecord$4(item) && isRecord$4(twin)) return inArrayRow(pass, item, twin);
7038
+ if (isRecord$5(item) && isRecord$5(twin)) return inArrayRow(pass, item, twin);
6989
7039
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6990
7040
  return item;
6991
7041
  });
@@ -6996,7 +7046,7 @@ function inArrayRow(pass, incoming, stored) {
6996
7046
  const twin = stored[key];
6997
7047
  if (isSecretMarker(twin)) {
6998
7048
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6999
- } else if (isRecord$4(value) && isRecord$4(twin)) out[key] = inArrayRow(pass, value, twin);
7049
+ } else if (isRecord$5(value) && isRecord$5(twin)) out[key] = inArrayRow(pass, value, twin);
7000
7050
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
7001
7051
  }
7002
7052
  return out;
@@ -7004,7 +7054,7 @@ function inArrayRow(pass, incoming, stored) {
7004
7054
  async function walk(pass, incoming, stored) {
7005
7055
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
7006
7056
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
7007
- if (!isRecord$4(incoming) || !isRecord$4(stored)) return incoming;
7057
+ if (!isRecord$5(incoming) || !isRecord$5(stored)) return incoming;
7008
7058
  const out = { ...incoming };
7009
7059
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
7010
7060
  return out;
@@ -7035,7 +7085,7 @@ async function restoreUnchangedSecrets(input) {
7035
7085
  function isJsonEqual(a, b) {
7036
7086
  if (Object.is(a, b)) return true;
7037
7087
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
7038
- if (isRecord$4(a) && isRecord$4(b)) {
7088
+ if (isRecord$5(a) && isRecord$5(b)) {
7039
7089
  const keys = Object.keys(a);
7040
7090
  if (keys.length !== Object.keys(b).length) return false;
7041
7091
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -7059,7 +7109,7 @@ function markerKeysOf(blob, owner) {
7059
7109
  }
7060
7110
  function nodeFromStored(value, owner) {
7061
7111
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
7062
- if (!isRecord$4(value)) return null;
7112
+ if (!isRecord$5(value)) return null;
7063
7113
  const children = /* @__PURE__ */ new Map();
7064
7114
  for (const [key, child] of Object.entries(value)) {
7065
7115
  const node = nodeFromStored(child, owner);
@@ -7678,6 +7728,44 @@ var BaseAddon = class {
7678
7728
  return null;
7679
7729
  }
7680
7730
  /**
7731
+ * D986 scoped settings: the form shape of the CLUSTER-wide settings one capability this addon
7732
+ * provides owns, or `null` when it has none. `cap` is a capability name the addon's manifest
7733
+ * declares. Stored as `addon-settings` rows `<addonId>.<field>`. The keys of this schema, of
7734
+ * {@link nodeSettingsSchema} and of {@link deviceDefaultsSchema} are disjoint, and a key never
7735
+ * contains `@` (guard `check-scoped-settings-declared`). SHAPE only: values are read by scope.
7736
+ */
7737
+ async clusterSettingsSchema(_cap) {
7738
+ return null;
7739
+ }
7740
+ /**
7741
+ * D986: the form shape of the settings one capability owns PER NODE, or `null`. Stored as
7742
+ * `addon-settings` rows `<addonId>.<field>@<nodeId>` carrying `nodeId` in the row data, so a
7743
+ * forgotten node's rows go in one central delete.
7744
+ */
7745
+ async nodeSettingsSchema(_cap) {
7746
+ return null;
7747
+ }
7748
+ /**
7749
+ * D986: the form shape of the FLEET DEFAULTS of the per-device settings one capability owns,
7750
+ * or `null`. Stored as `addon-settings` rows `<addonId>.<field>`; a device resolves its value
7751
+ * as device row, then this default, then the schema default (`resolveDeviceSettings`).
7752
+ */
7753
+ async deviceDefaultsSchema(_cap) {
7754
+ return null;
7755
+ }
7756
+ /**
7757
+ * The host's read of the scoped declarations: the schema one capability declares for `scope`,
7758
+ * or `null`. Beside {@link getIntegrationFormSchema}, the same shape: the hook is protected, the
7759
+ * host asks this method.
7760
+ */
7761
+ async getScopedSettingsSchema(scope, cap) {
7762
+ switch (scope) {
7763
+ case "cluster": return this.clusterSettingsSchema(cap);
7764
+ case "node": return this.nodeSettingsSchema(cap);
7765
+ case "device-defaults": return this.deviceDefaultsSchema(cap);
7766
+ }
7767
+ }
7768
+ /**
7681
7769
  * What the create wizard and the integration edit page render for one instance: the addon's
7682
7770
  * per-instance schema when it declares one, else its global schema (what they always showed).
7683
7771
  */
@@ -8471,6 +8559,21 @@ function normalizeAddonInitResult(result) {
8471
8559
  if (Array.isArray(result)) return { providers: result };
8472
8560
  return result;
8473
8561
  }
8562
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8563
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
8564
+ var RECORD_DATABASES = ["settings", "events"];
8565
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8566
+ var RECORD_CLASSES = [
8567
+ "config",
8568
+ "ledger",
8569
+ "audit",
8570
+ "mirror",
8571
+ "ephemeral"
8572
+ ];
8573
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8574
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8575
+ var RECORD_BATCH_MAX = 1e3;
8576
+ var RECORD_QUERY_MAX = 1e3;
8474
8577
  /**
8475
8578
  * The share-view scope kinds a share-link token can carry. The hub mints
8476
8579
  * and validates them (`ShareViewGrantSchema` builds its
@@ -8495,21 +8598,6 @@ var PeerBytesTicketSchema = object({
8495
8598
  */
8496
8599
  declaredBytes: number().int().nonnegative().nullable()
8497
8600
  });
8498
- /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8499
- /** The files a kind may live in. `history` is device-history's (D850), never records. */
8500
- var RECORD_DATABASES = ["settings", "events"];
8501
- /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8502
- var RECORD_CLASSES = [
8503
- "config",
8504
- "ledger",
8505
- "audit",
8506
- "mirror",
8507
- "ephemeral"
8508
- ];
8509
- var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8510
- var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8511
- var RECORD_BATCH_MAX = 1e3;
8512
- var RECORD_QUERY_MAX = 1e3;
8513
8601
  /**
8514
8602
  * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8515
8603
  * Zod row schema that describes it, and the helper that turns the two into the
@@ -9250,6 +9338,7 @@ var CAP_NAMES = Object.freeze([
9250
9338
  "backup",
9251
9339
  "battery",
9252
9340
  "binary",
9341
+ "board-key-source",
9253
9342
  "brightness",
9254
9343
  "broker",
9255
9344
  "button",
@@ -9292,6 +9381,7 @@ var CAP_NAMES = Object.freeze([
9292
9381
  "device-status",
9293
9382
  "dishwasher",
9294
9383
  "display-palette",
9384
+ "do-not-disturb",
9295
9385
  "doorbell",
9296
9386
  "embedding-encoder",
9297
9387
  "enum-sensor",
@@ -9312,6 +9402,7 @@ var CAP_NAMES = Object.freeze([
9312
9402
  "humidity-sensor",
9313
9403
  "image",
9314
9404
  "image-settings",
9405
+ "integration-instances",
9315
9406
  "integrations",
9316
9407
  "intercom",
9317
9408
  "ir-transmitter",
@@ -9369,6 +9460,7 @@ var CAP_NAMES = Object.freeze([
9369
9460
  "privacy-mask",
9370
9461
  "ptz",
9371
9462
  "ptz-autotrack",
9463
+ "pump-cycle",
9372
9464
  "reboot",
9373
9465
  "record-entries",
9374
9466
  "recording",
@@ -10051,6 +10143,10 @@ Object.freeze({
10051
10143
  "valueType": "string"
10052
10144
  }
10053
10145
  ],
10146
+ "do-not-disturb": [{
10147
+ "path": "enabled",
10148
+ "valueType": "boolean"
10149
+ }],
10054
10150
  "doorbell": [{
10055
10151
  "path": "lastPressedAt",
10056
10152
  "valueType": "number"
@@ -10657,18 +10753,6 @@ Object.freeze({
10657
10753
  "path": "pumpRunning",
10658
10754
  "valueType": "boolean"
10659
10755
  },
10660
- {
10661
- "path": "pumpIntervalEnabled",
10662
- "valueType": "boolean"
10663
- },
10664
- {
10665
- "path": "pumpOnTime",
10666
- "valueType": "number"
10667
- },
10668
- {
10669
- "path": "pumpOffTime",
10670
- "valueType": "number"
10671
- },
10672
10756
  {
10673
10757
  "path": "lastDrink",
10674
10758
  "valueType": "number"
@@ -10792,6 +10876,20 @@ Object.freeze({
10792
10876
  "valueType": "number"
10793
10877
  }
10794
10878
  ],
10879
+ "pump-cycle": [
10880
+ {
10881
+ "path": "enabled",
10882
+ "valueType": "boolean"
10883
+ },
10884
+ {
10885
+ "path": "onTime",
10886
+ "valueType": "number"
10887
+ },
10888
+ {
10889
+ "path": "offTime",
10890
+ "valueType": "number"
10891
+ }
10892
+ ],
10795
10893
  "recording-archive": [
10796
10894
  {
10797
10895
  "path": "deviceId",
@@ -11241,7 +11339,7 @@ object({
11241
11339
  params: record(string(), union([string(), number()])).optional()
11242
11340
  });
11243
11341
  //#endregion
11244
- //#region ../types/dist/composition-kKKOdFIG.mjs
11342
+ //#region ../types/dist/composition-Dh3RfMx5.mjs
11245
11343
  /**
11246
11344
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11247
11345
  *
@@ -12455,6 +12553,73 @@ var NodeColorIdSchema = _enum([
12455
12553
  "node-g",
12456
12554
  "node-h"
12457
12555
  ]);
12556
+ //#endregion
12557
+ //#region ../types/dist/index.mjs
12558
+ var SMTP_INBOUND_DEFAULT_PORT = 2525;
12559
+ var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
12560
+ var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
12561
+ /** The text excerpt a message carries on the bus. */
12562
+ var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
12563
+ var PortSchema = number().int().min(1).max(65535);
12564
+ /** A recipient local-part: what stands before the `@`. */
12565
+ var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
12566
+ object({
12567
+ port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
12568
+ bindHost: string().min(1).default("0.0.0.0"),
12569
+ domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
12570
+ requireAuth: boolean().default(true),
12571
+ username: string().default(""),
12572
+ password: string().default("").meta({ secret: true }),
12573
+ starttls: boolean().default(false),
12574
+ maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
12575
+ });
12576
+ object({
12577
+ host: string().min(1).nullable(),
12578
+ hostReason: string().nullable(),
12579
+ port: PortSchema,
12580
+ domain: string().min(1),
12581
+ requireAuth: boolean(),
12582
+ username: string(),
12583
+ password: string(),
12584
+ starttls: boolean()
12585
+ });
12586
+ object({
12587
+ recipients: array(SmtpRecipientSchema).min(1),
12588
+ /**
12589
+ * Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
12590
+ * recipients (the way a consumer that restarted, or lost a device, declares its set again);
12591
+ * a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
12592
+ * Absent, the subscriber is anonymous and unique.
12593
+ */
12594
+ subscriberId: string().min(1).max(64).optional()
12595
+ });
12596
+ var SmtpInboundAttachmentSchema = object({
12597
+ filename: string(),
12598
+ contentType: string(),
12599
+ bytes: number().int().nonnegative()
12600
+ });
12601
+ /** The payload of one `broker.message` (the key is the recipient local-part). */
12602
+ var SmtpInboundMessageSchema = object({
12603
+ /** Monotonic per mailbox; a gap tells a consumer it missed an event. */
12604
+ seq: number().int().positive(),
12605
+ messageId: string(),
12606
+ receivedAt: number().int().nonnegative(),
12607
+ from: string(),
12608
+ to: string(),
12609
+ subject: string(),
12610
+ text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
12611
+ attachments: array(SmtpInboundAttachmentSchema)
12612
+ });
12613
+ object({
12614
+ /** The newest seq issued so far (0 before any mail). */
12615
+ lastSeq: number().int().nonnegative(),
12616
+ /** The oldest seq still retained; messages below it are gone. */
12617
+ oldestSeq: number().int().nonnegative(),
12618
+ messages: array(object({
12619
+ key: string(),
12620
+ message: SmtpInboundMessageSchema
12621
+ }))
12622
+ });
12458
12623
  new Set([
12459
12624
  "track",
12460
12625
  "face",
@@ -13718,6 +13883,16 @@ var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
13718
13883
  precondition: PreconditionSchema
13719
13884
  })
13720
13885
  ])) });
13886
+ /** `JSON.stringify` with object keys sorted, so equal values spell the same. */
13887
+ function canonicalJson(value) {
13888
+ if (Array.isArray(value)) return `[${value.map((item) => canonicalJson(item)).join(",")}]`;
13889
+ if (typeof value === "object" && value !== null) return `{${Object.entries(value).filter(([, item]) => item !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, item]) => `${JSON.stringify(key)}:${canonicalJson(item)}`).join(",")}}`;
13890
+ return JSON.stringify(value) ?? "null";
13891
+ }
13892
+ /** The precondition string for a value a plan read (`null` when it read nothing). */
13893
+ function preconditionOf(value) {
13894
+ return canonicalJson(value ?? null);
13895
+ }
13721
13896
  /**
13722
13897
  * What a `procedure` body reports. `already-done` means the rerun observed the
13723
13898
  * work finished (a crash between the work and the ledger row, or a manual fix)
@@ -15666,8 +15841,18 @@ var LogChannelDescriptorSchema = object({
15666
15841
  * the operator narrows to one camera, sees nothing, and concludes the code
15667
15842
  * path was never taken.
15668
15843
  */
15669
- perDevice: boolean()
15670
- });
15844
+ perDevice: boolean(),
15845
+ /**
15846
+ * What the channel is FOR, so the UI can list the channels an addon offers.
15847
+ *
15848
+ * - `diagnostic` (the default): a per-component diagnostic armed from the
15849
+ * Levels page, emitted at its declared level.
15850
+ * - `debug`: a `debug.<channel>` dump watched live for a short window
15851
+ * (`ctx.debug`). Always per-device, and its lines are denied by the log
15852
+ * ring unless somebody is watching that device.
15853
+ */
15854
+ kind: _enum(["diagnostic", "debug"]).default("diagnostic")
15855
+ }).refine((d) => d.kind !== "debug" || d.name.startsWith("debug.") && d.perDevice, { message: "a debug channel is named debug.<channel> and is per-device" });
15671
15856
  /**
15672
15857
  * An armed window over one channel, as the document hands it to a mirror.
15673
15858
  *
@@ -19004,24 +19189,52 @@ var APPLIANCE_CAP_VOCABULARY = {
19004
19189
  args: { on: false }
19005
19190
  },
19006
19191
  {
19007
- id: "petFountain.intervalOn",
19008
- method: "setPumpInterval",
19192
+ id: "petFountain.resetDailyConsumption",
19193
+ method: "resetDailyConsumption",
19194
+ label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
19195
+ phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
19196
+ icon: "rotate-ccw"
19197
+ }
19198
+ ],
19199
+ state: [{
19200
+ kind: "boolean",
19201
+ field: "empty",
19202
+ label: t("Tank empty", "Serbatoio vuoto"),
19203
+ whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
19204
+ whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
19205
+ icon: "droplet"
19206
+ }, {
19207
+ kind: "numeric",
19208
+ field: "waterLevel",
19209
+ quantity: t("the water level", "il livello dell’acqua"),
19210
+ label: t("Water level", "Livello dell’acqua"),
19211
+ unit: "%",
19212
+ icon: "droplets"
19213
+ }]
19214
+ },
19215
+ "pump-cycle": {
19216
+ scope: "device",
19217
+ noun: t("Pump cycle", "Ciclo della pompa"),
19218
+ actions: [
19219
+ {
19220
+ id: "pumpCycle.on",
19221
+ method: "setEnabled",
19009
19222
  label: t("Pump cycle on", "Ciclo pompa attivo"),
19010
19223
  phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
19011
19224
  icon: "timer",
19012
19225
  args: { on: true }
19013
19226
  },
19014
19227
  {
19015
- id: "petFountain.intervalOff",
19016
- method: "setPumpInterval",
19228
+ id: "pumpCycle.off",
19229
+ method: "setEnabled",
19017
19230
  label: t("Pump cycle off", "Ciclo pompa spento"),
19018
19231
  phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
19019
19232
  icon: "timer-off",
19020
19233
  args: { on: false }
19021
19234
  },
19022
19235
  {
19023
- id: "petFountain.pumpOnMinutes",
19024
- method: "setPumpOnMinutes",
19236
+ id: "pumpCycle.onMinutes",
19237
+ method: "setOnMinutes",
19025
19238
  label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
19026
19239
  phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
19027
19240
  icon: "timer",
@@ -19037,8 +19250,8 @@ var APPLIANCE_CAP_VOCABULARY = {
19037
19250
  }]
19038
19251
  },
19039
19252
  {
19040
- id: "petFountain.pumpOffMinutes",
19041
- method: "setPumpOffMinutes",
19253
+ id: "pumpCycle.offMinutes",
19254
+ method: "setOffMinutes",
19042
19255
  label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
19043
19256
  phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
19044
19257
  icon: "timer-off",
@@ -19052,29 +19265,15 @@ var APPLIANCE_CAP_VOCABULARY = {
19052
19265
  unit: "min"
19053
19266
  }
19054
19267
  }]
19055
- },
19056
- {
19057
- id: "petFountain.resetDailyConsumption",
19058
- method: "resetDailyConsumption",
19059
- label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
19060
- phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
19061
- icon: "rotate-ccw"
19062
19268
  }
19063
19269
  ],
19064
19270
  state: [{
19065
19271
  kind: "boolean",
19066
- field: "empty",
19067
- label: t("Tank empty", "Serbatoio vuoto"),
19068
- whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
19069
- whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
19070
- icon: "droplet"
19071
- }, {
19072
- kind: "numeric",
19073
- field: "waterLevel",
19074
- quantity: t("the water level", "il livello dell’acqua"),
19075
- label: t("Water level", "Livello dell’acqua"),
19076
- unit: "%",
19077
- icon: "droplets"
19272
+ field: "enabled",
19273
+ label: t("Pump cycle", "Ciclo pompa"),
19274
+ whenTrue: t("When {device} starts running its pump on a cycle", "Quando {device} inizia a far lavorare la pompa a ciclo"),
19275
+ whenFalse: t("When {device} runs its pump continuously", "Quando {device} fa lavorare la pompa in continuo"),
19276
+ icon: "timer"
19078
19277
  }]
19079
19278
  },
19080
19279
  "media-player": {
@@ -19760,6 +19959,33 @@ var APPLIANCE_CAP_VOCABULARY = {
19760
19959
  }
19761
19960
  ]
19762
19961
  },
19962
+ "do-not-disturb": {
19963
+ scope: "device",
19964
+ noun: t("Do not disturb", "Non disturbare"),
19965
+ actions: [{
19966
+ id: "dnd.on",
19967
+ method: "setEnabled",
19968
+ label: t("Do not disturb on", "Attiva Non disturbare"),
19969
+ phrase: t("Turn on Do not disturb on {device}", "Attiva Non disturbare su {device}"),
19970
+ icon: "bell-off",
19971
+ args: { enabled: true }
19972
+ }, {
19973
+ id: "dnd.off",
19974
+ method: "setEnabled",
19975
+ label: t("Do not disturb off", "Disattiva Non disturbare"),
19976
+ phrase: t("Turn off Do not disturb on {device}", "Disattiva Non disturbare su {device}"),
19977
+ icon: "bell",
19978
+ args: { enabled: false }
19979
+ }],
19980
+ state: [{
19981
+ kind: "boolean",
19982
+ field: "enabled",
19983
+ label: t("Do not disturb", "Non disturbare"),
19984
+ whenTrue: t("When Do not disturb turns on on {device}", "Quando {device} attiva Non disturbare"),
19985
+ whenFalse: t("When Do not disturb turns off on {device}", "Quando {device} disattiva Non disturbare"),
19986
+ icon: "bell-off"
19987
+ }]
19988
+ },
19763
19989
  update: {
19764
19990
  scope: "device",
19765
19991
  noun: t("Firmware update", "Aggiornamento firmware"),
@@ -20940,6 +21166,7 @@ var SYSTEM_CAP_VOCABULARY = {
20940
21166
  "audio-analyzer": system(PIPELINE),
20941
21167
  "audio-codec": system(INTERNAL),
20942
21168
  "auth-provider": system(IDENTITY),
21169
+ "board-key-source": system(INTERNAL),
20943
21170
  backup: system("system backups — run and restored from the Backups page"),
20944
21171
  broker: system("message-broker connections — configured, not actuated"),
20945
21172
  "calendar-source": system(INTERNAL),
@@ -20974,6 +21201,7 @@ var SYSTEM_CAP_VOCABULARY = {
20974
21201
  "load-contribution": system(INTERNAL),
20975
21202
  "local-network": system(NETWORK),
20976
21203
  "log-channels": system(INTERNAL),
21204
+ "integration-instances": system(INTERNAL),
20977
21205
  "log-destination": system(INTERNAL),
20978
21206
  "login-method": system(IDENTITY),
20979
21207
  "mesh-network": system(NETWORK),
@@ -41816,14 +42044,16 @@ var DeviceIsLeafSchema = object({
41816
42044
  });
41817
42045
  /**
41818
42046
  * True when the camera currently has a PARKED object matching `subjects` in at
41819
- * least one of `zones`. Reads the zone-analytics snapshot through the same
42047
+ * least one of `zones` (`minCount` of them, default one). Reads the zone-analytics snapshot through the same
41820
42048
  * mirror as every other state leaf, so a dropped event never decides it (D49).
41821
42049
  */
41822
42050
  var StationaryPresentLeafSchema = object({
41823
42051
  kind: literal("stationary-present"),
41824
42052
  deviceId: number().int().nonnegative(),
41825
42053
  subjects: array(StationarySubjectSchema).min(1).optional(),
41826
- zones: array(string().min(1)).min(1).optional()
42054
+ zones: array(string().min(1)).min(1).optional(),
42055
+ /** How many matching parked objects must be there; absent means one. */
42056
+ minCount: number().int().positive().optional()
41827
42057
  });
41828
42058
  /**
41829
42059
  * The escape hatch: the bounded expression engine over named device bindings.
@@ -42335,6 +42565,28 @@ function convertLegacyRecipe(legacy) {
42335
42565
  * it. The output type is always the new one.
42336
42566
  */
42337
42567
  var AutomationRecipeSchema = union([CurrentAutomationRecipeSchema, LegacyAutomationRecipeSchema.transform(convertLegacyRecipe)]);
42568
+ var DETECTION_DESCRIPTIONS = {
42569
+ deviceId: "the camera that saw it",
42570
+ className: "what it saw",
42571
+ trackId: "the track",
42572
+ score: "how sure the detector was",
42573
+ label: "the label it matched (a name, a plate), empty when none"
42574
+ };
42575
+ var STATIONARY_DESCRIPTIONS = {
42576
+ deviceId: "the camera that saw it",
42577
+ className: "what it saw",
42578
+ zones: "the zones it is in",
42579
+ phase: "appeared or departed",
42580
+ entryId: "the stopped object"
42581
+ };
42582
+ function describe$1(descriptions) {
42583
+ return Object.entries(descriptions).map(([name, description]) => ({
42584
+ name,
42585
+ description
42586
+ }));
42587
+ }
42588
+ describe$1(DETECTION_DESCRIPTIONS);
42589
+ describe$1(STATIONARY_DESCRIPTIONS);
42338
42590
  new Set(Object.values(COCO_TO_MACRO.mapping));
42339
42591
  /**
42340
42592
  * Schedulers (D983) — an entity that performs actions over the day.
@@ -43096,7 +43348,7 @@ var TargetKindCapsSchema = object({
43096
43348
  * the union is large and not meant for runtime validation here; the exported
43097
43349
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
43098
43350
  */
43099
- var ConfigSchemaPassthrough$3 = unknown();
43351
+ var ConfigSchemaPassthrough$4 = unknown();
43100
43352
  var TargetKindSchema = object({
43101
43353
  kind: string(),
43102
43354
  label: string(),
@@ -43133,7 +43385,7 @@ var TargetKindSchema = object({
43133
43385
  * its raster path, which is the safe default for an unknown image.
43134
43386
  */
43135
43387
  iconMediaType: string().optional(),
43136
- configSchema: ConfigSchemaPassthrough$3,
43388
+ configSchema: ConfigSchemaPassthrough$4,
43137
43389
  /**
43138
43390
  * The config keys that decide WHERE this kind's secrets are sent (server,
43139
43391
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -45461,6 +45713,49 @@ object({
45461
45713
  });
45462
45714
  DeviceType.Sensor;
45463
45715
  /**
45716
+ * Why a board key could not be read. Typed so a caller reports the cause and
45717
+ * never treats "could not read" as "has no key" (D49).
45718
+ */
45719
+ var BoardKeyFailureReasonSchema = _enum([
45720
+ "unknown-source",
45721
+ "not-admin",
45722
+ "no-builder",
45723
+ "no-ingress-url",
45724
+ "unreachable",
45725
+ "unknown-board",
45726
+ "no-encryption-key",
45727
+ "unreadable-config"
45728
+ ]);
45729
+ var BoardKeySourceSchema = object({
45730
+ sourceId: string(),
45731
+ name: string()
45732
+ });
45733
+ var BoardKeyBoardSchema = object({
45734
+ /** The builder's file name, e.g. `kitchen.yaml`: the handle `getBoardKey` takes. */
45735
+ configuration: string(),
45736
+ /** The node name the builder gives the board. */
45737
+ name: string(),
45738
+ /** The address the builder knows the board by, when it has one. */
45739
+ address: string().nullable()
45740
+ });
45741
+ var BoardKeyFailureSchema = object({
45742
+ ok: literal(false),
45743
+ reason: BoardKeyFailureReasonSchema,
45744
+ detail: string().optional()
45745
+ });
45746
+ var ListBoardsResultSchema = discriminatedUnion("ok", [object({
45747
+ ok: literal(true),
45748
+ boards: array(BoardKeyBoardSchema).readonly()
45749
+ }), BoardKeyFailureSchema]);
45750
+ var GetBoardKeyResultSchema = discriminatedUnion("ok", [object({
45751
+ ok: literal(true),
45752
+ key: string()
45753
+ }), BoardKeyFailureSchema]);
45754
+ method(_void(), array(BoardKeySourceSchema).readonly(), { auth: "admin" }), method(object({ sourceId: string().min(1) }), ListBoardsResultSchema, { auth: "admin" }), method(object({
45755
+ sourceId: string().min(1),
45756
+ configuration: string().min(1)
45757
+ }), GetBoardKeyResultSchema, { auth: "admin" });
45758
+ /**
45464
45759
  * Dimmable-light brightness control. Co-exists with `switch` on the
45465
45760
  * same device — the switch toggles on/off, this cap sets the level
45466
45761
  * applied when the light is on. Drivers map their per-vendor dim
@@ -49568,6 +49863,45 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
49568
49863
  auth: "admin"
49569
49864
  });
49570
49865
  /**
49866
+ * What the passive listener of `local-network` saw on the wire, before any
49867
+ * provider classified it. Device-manager turns an observation into the hits
49868
+ * of the providers whose declared discovery modes it matches.
49869
+ */
49870
+ var DiscoveryObservationSchema = discriminatedUnion("kind", [object({
49871
+ kind: literal("mdns"),
49872
+ /** Normalised DNS-SD service type, e.g. `_esphomelib._tcp`. */
49873
+ serviceType: string(),
49874
+ instance: string(),
49875
+ host: string(),
49876
+ /** The A record address when the announcement carried one. */
49877
+ address: string().nullable(),
49878
+ port: number().int(),
49879
+ txt: record(string(), string())
49880
+ }), object({
49881
+ kind: literal("ssdp"),
49882
+ /** Sender address of the datagram. */
49883
+ host: string(),
49884
+ port: number().int(),
49885
+ /** `NT` of a NOTIFY, `ST` of a search response. */
49886
+ target: string(),
49887
+ headers: record(string(), string())
49888
+ })]);
49889
+ object({
49890
+ addonId: string(),
49891
+ candidate: DiscoveryCandidateSchema,
49892
+ firstSeenAt: number(),
49893
+ lastSeenAt: number(),
49894
+ dismissed: boolean()
49895
+ });
49896
+ var DiscoveryProposalSchema = object({
49897
+ id: string(),
49898
+ addonId: string(),
49899
+ candidate: DiscoveryCandidateSchema,
49900
+ firstSeenAt: number(),
49901
+ lastSeenAt: number(),
49902
+ dismissed: boolean()
49903
+ });
49904
+ /**
49571
49905
  * Device Manager capability — hub-side singleton that unifies device persistence,
49572
49906
  * live registry access, and all management operations into a single tRPC surface.
49573
49907
  *
@@ -50296,6 +50630,19 @@ method(object({
50296
50630
  }), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
50297
50631
  kind: "mutation",
50298
50632
  auth: "admin"
50633
+ }), method(object({}), object({ proposals: array(DiscoveryProposalSchema).readonly() }), { auth: "admin" }), method(object({ id: string() }), object({ dismissed: boolean() }), {
50634
+ kind: "mutation",
50635
+ auth: "admin"
50636
+ }), method(object({ observations: array(DiscoveryObservationSchema).max(512) }), object({ proposed: number().int() }), {
50637
+ kind: "mutation",
50638
+ auth: "admin"
50639
+ }), method(object({}), object({
50640
+ providers: number().int(),
50641
+ proposed: number().int()
50642
+ }), {
50643
+ kind: "mutation",
50644
+ auth: "admin",
50645
+ timeoutMs: 12e4
50299
50646
  }), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
50300
50647
  deviceId: number(),
50301
50648
  key: string(),
@@ -51123,7 +51470,7 @@ object({
51123
51470
  /** Ms epoch of the last value received from the appliance; 0 = never. */
51124
51471
  lastFetchedAt: number()
51125
51472
  });
51126
- var DeviceIdSchema$1 = number().int().nonnegative();
51473
+ var DeviceIdSchema$2 = number().int().nonnegative();
51127
51474
  /** A value a program option or setting can take. */
51128
51475
  var DishwasherValueSchema = union([
51129
51476
  boolean(),
@@ -51187,77 +51534,77 @@ var DishwasherOptionsSchema = object({
51187
51534
  options: array(DishwasherOptionDescriptorSchema)
51188
51535
  });
51189
51536
  DeviceType.Dishwasher, method(object({
51190
- deviceId: DeviceIdSchema$1,
51537
+ deviceId: DeviceIdSchema$2,
51191
51538
  program: string().min(1).optional(),
51192
51539
  options: record(string(), DishwasherValueSchema).optional()
51193
51540
  }), _void(), {
51194
51541
  kind: "mutation",
51195
51542
  auth: "protected"
51196
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51543
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51197
51544
  kind: "mutation",
51198
51545
  auth: "protected"
51199
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51546
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51200
51547
  kind: "mutation",
51201
51548
  auth: "protected"
51202
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51549
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51203
51550
  kind: "mutation",
51204
51551
  auth: "protected"
51205
51552
  }), method(object({
51206
- deviceId: DeviceIdSchema$1,
51553
+ deviceId: DeviceIdSchema$2,
51207
51554
  program: string().min(1)
51208
51555
  }), _void(), {
51209
51556
  kind: "mutation",
51210
51557
  auth: "protected"
51211
51558
  }), method(object({
51212
- deviceId: DeviceIdSchema$1,
51559
+ deviceId: DeviceIdSchema$2,
51213
51560
  on: boolean()
51214
51561
  }), _void(), {
51215
51562
  kind: "mutation",
51216
51563
  auth: "protected"
51217
51564
  }), method(object({
51218
- deviceId: DeviceIdSchema$1,
51565
+ deviceId: DeviceIdSchema$2,
51219
51566
  on: boolean()
51220
51567
  }), _void(), {
51221
51568
  kind: "mutation",
51222
51569
  auth: "protected"
51223
51570
  }), method(object({
51224
- deviceId: DeviceIdSchema$1,
51571
+ deviceId: DeviceIdSchema$2,
51225
51572
  on: boolean()
51226
51573
  }), _void(), {
51227
51574
  kind: "mutation",
51228
51575
  auth: "protected"
51229
51576
  }), method(object({
51230
- deviceId: DeviceIdSchema$1,
51577
+ deviceId: DeviceIdSchema$2,
51231
51578
  on: boolean()
51232
51579
  }), _void(), {
51233
51580
  kind: "mutation",
51234
51581
  auth: "protected"
51235
51582
  }), method(object({
51236
- deviceId: DeviceIdSchema$1,
51583
+ deviceId: DeviceIdSchema$2,
51237
51584
  on: boolean()
51238
51585
  }), _void(), {
51239
51586
  kind: "mutation",
51240
51587
  auth: "protected"
51241
51588
  }), method(object({
51242
- deviceId: DeviceIdSchema$1,
51589
+ deviceId: DeviceIdSchema$2,
51243
51590
  on: boolean()
51244
51591
  }), _void(), {
51245
51592
  kind: "mutation",
51246
51593
  auth: "protected"
51247
51594
  }), method(object({
51248
- deviceId: DeviceIdSchema$1,
51595
+ deviceId: DeviceIdSchema$2,
51249
51596
  on: boolean()
51250
51597
  }), _void(), {
51251
51598
  kind: "mutation",
51252
51599
  auth: "protected"
51253
51600
  }), method(object({
51254
- deviceId: DeviceIdSchema$1,
51601
+ deviceId: DeviceIdSchema$2,
51255
51602
  key: string().min(1),
51256
51603
  value: DishwasherValueSchema
51257
51604
  }), _void(), {
51258
51605
  kind: "mutation",
51259
51606
  auth: "protected"
51260
- }), method(object({ deviceId: DeviceIdSchema$1 }), DishwasherOptionsSchema, { auth: "protected" });
51607
+ }), method(object({ deviceId: DeviceIdSchema$2 }), DishwasherOptionsSchema, { auth: "protected" });
51261
51608
  /**
51262
51609
  * Palette entry ids (D939). Audio is the one gradient; `audio-*` leaves are
51263
51610
  * not entries. `heatmapScrub` is a mark, not an event kind.
@@ -51661,6 +52008,19 @@ method(_void(), paletteResultSchema, {
51661
52008
  kind: "mutation",
51662
52009
  auth: "admin"
51663
52010
  });
52011
+ object({
52012
+ /** True while Do Not Disturb is on; null when unknown. */
52013
+ enabled: boolean().nullable().meta({ label: "Do not disturb" }),
52014
+ /** Ms epoch of the last read or write that set `enabled`. */
52015
+ lastChangedAt: number()
52016
+ });
52017
+ DeviceType.MediaPlayer, method(object({
52018
+ deviceId: number().int(),
52019
+ enabled: boolean()
52020
+ }), _void(), {
52021
+ kind: "mutation",
52022
+ auth: "protected"
52023
+ });
51664
52024
  DeviceType.Camera;
51665
52025
  object({
51666
52026
  /** Ms epoch of the last press. null = never observed since this provider started. */
@@ -52951,6 +53311,89 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
52951
53311
  auth: "admin"
52952
53312
  });
52953
53313
  /**
53314
+ * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
53315
+ * (an account, a relay, a destination) as typed records (D985, D986). The addon's
53316
+ * own function page reads and writes them (Logging for Loki); the Integrations
53317
+ * page lists only the integrations that bring devices (D996).
53318
+ *
53319
+ * A collection of providers: each addon that holds connections registers one and a
53320
+ * caller reaches a provider with the pinned `addonId`.
53321
+ *
53322
+ * Identity: the instance id is immutable and opaque to the caller. A record the
53323
+ * Loki migration made keeps the `integrations` registry id it was created under
53324
+ * (`int_NNNN`); a single instance made by its function page takes the addon id.
53325
+ * `name` is the editable label.
53326
+ *
53327
+ * Secrets: every field the instance kind marks `.meta({ secret: true })` reaches
53328
+ * the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
53329
+ * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
53330
+ * clears it.
53331
+ */
53332
+ var ConfigSchemaPassthrough$3 = custom();
53333
+ var IntegrationInstanceIdSchema = string().min(1);
53334
+ var IntegrationInstanceDescriptionSchema = object({
53335
+ /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
53336
+ instanceMode: _enum(["single", "multiple"]),
53337
+ /** What the instance is, for the UI (`destination`, `relay`, `account`). */
53338
+ kind: string(),
53339
+ /** True when `testInstance` really probes the remote. */
53340
+ canTest: boolean()
53341
+ });
53342
+ var IntegrationInstanceStatusSchema = object({
53343
+ state: _enum([
53344
+ "ok",
53345
+ "off",
53346
+ "error",
53347
+ "unknown"
53348
+ ]),
53349
+ detail: string().optional()
53350
+ });
53351
+ var IntegrationInstanceSchema = object({
53352
+ id: IntegrationInstanceIdSchema,
53353
+ name: string(),
53354
+ /** The addon's own rule (an URL is present, a client id is present...). */
53355
+ configured: boolean(),
53356
+ /**
53357
+ * The instance's own on/off switch (D996): always present, derived from the record body
53358
+ * (`enabled !== false`, so a row written before the field existed is on).
53359
+ */
53360
+ enabled: boolean(),
53361
+ /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
53362
+ formValues: record(string(), unknown()),
53363
+ status: IntegrationInstanceStatusSchema.optional()
53364
+ });
53365
+ var IntegrationInstancePatchSchema = object({
53366
+ id: IntegrationInstanceIdSchema,
53367
+ name: string().min(1).optional(),
53368
+ /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
53369
+ values: record(string(), unknown())
53370
+ });
53371
+ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
53372
+ id: IntegrationInstanceIdSchema,
53373
+ name: string().min(1)
53374
+ }), object({ id: string() }), {
53375
+ kind: "mutation",
53376
+ auth: "admin"
53377
+ }), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), {
53378
+ kind: "mutation",
53379
+ auth: "admin"
53380
+ }), method(object({
53381
+ id: IntegrationInstanceIdSchema,
53382
+ enabled: boolean()
53383
+ }), object({ ok: literal(true) }), {
53384
+ kind: "mutation",
53385
+ auth: "admin"
53386
+ }), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
53387
+ kind: "mutation",
53388
+ auth: "admin"
53389
+ }), optionalMethod(object({
53390
+ id: IntegrationInstanceIdSchema.nullable(),
53391
+ values: record(string(), unknown())
53392
+ }), TestConnectionResultSchema$1, {
53393
+ kind: "mutation",
53394
+ auth: "admin"
53395
+ });
53396
+ /**
52954
53397
  * Two-way audio / talk-back cap. Clients open a WebRTC audio-only
52955
53398
  * session (server-initiated offer pattern, identical to the main
52956
53399
  * video WebRTC flow) and the browser captures the mic; the server
@@ -53539,6 +53982,14 @@ var LlmGenerateBaseInputSchema = object({
53539
53982
  topP: number().min(0).max(1).optional(),
53540
53983
  /** Per-call override of the profile default (top-k sampling). */
53541
53984
  topK: number().int().positive().optional(),
53985
+ /** Per-call override of `profile.reasoningEffort`. Sent only to a kind whose
53986
+ * descriptor offers the field; a kind that does not never sends it. */
53987
+ reasoningEffort: _enum([
53988
+ "off",
53989
+ "low",
53990
+ "medium",
53991
+ "high"
53992
+ ]).optional(),
53542
53993
  /** Per-call override of `profile.timeoutMs` — the total generation bound. */
53543
53994
  timeoutMs: number().int().positive().optional(),
53544
53995
  /** Per-call override; beats both the consumer table and the profile. */
@@ -53830,7 +54281,10 @@ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind i
53830
54281
  var LlmModelFeaturesSchema = object({
53831
54282
  vision: boolean(),
53832
54283
  tools: boolean(),
53833
- streaming: boolean()
54284
+ streaming: boolean(),
54285
+ /** Whether the model thinks before it answers. `null` = the endpoint does not
54286
+ * say; an editor then still offers the switch (unknown is not "no"). */
54287
+ reasoning: boolean().nullable().optional()
53834
54288
  });
53835
54289
  /** One model a provider offers. `features` overrides the kind's defaults, per field. */
53836
54290
  var LlmModelInfoSchema = object({
@@ -62972,7 +63426,14 @@ var NcMediaPolicySchema = object({
62972
63426
  */
62973
63427
  profile: CamProfileSchema.optional(),
62974
63428
  /** See {@link NcLinkedCameraModeSchema}. */
62975
- linkedCameras: NcLinkedCameraModeSchema.optional()
63429
+ linkedCameras: NcLinkedCameraModeSchema.optional(),
63430
+ /**
63431
+ * Sensor rules only: may this rule wake a SLEEPING battery camera to take
63432
+ * the linked still it attaches (D998)? Absent means yes, an explicit `false`
63433
+ * opts out. Deliberately not a Zod default: a rule that never chose keeps
63434
+ * following the hub's. One bounded wake per event; nothing is attached later.
63435
+ */
63436
+ wakeSleepingCamera: boolean().optional()
62976
63437
  });
62977
63438
  /**
62978
63439
  * Cooldown GRANULARITY over the subject's class — how much a fired
@@ -64983,52 +65444,27 @@ object({
64983
65444
  empty: boolean().nullable(),
64984
65445
  /** True while the pump is running. Null while unknown. */
64985
65446
  pumpRunning: boolean().nullable(),
64986
- /** True when the pump works on an on/off duty cycle rather than continuously. */
64987
- pumpIntervalEnabled: boolean().nullable(),
64988
- /** How long the pump runs per cycle, in seconds. */
64989
- pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
64990
- /** How long the pump rests per cycle, in seconds. */
64991
- pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
64992
65447
  /** Water drunk in the last drink, in litres. */
64993
65448
  lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
64994
65449
  /** Water drunk in the current hour, in litres. */
64995
65450
  currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
64996
65451
  /** Water drunk over the last 24 hours (rolling), in litres. */
64997
65452
  last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
64998
- /** Water drunk since local midnight, in litres. */
65453
+ /** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
64999
65454
  todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
65000
65455
  /** Decoded fault message. Null means healthy; a non-null string is an active fault. */
65001
65456
  error: string().nullable(),
65002
65457
  /** Ms epoch when the slice was last refreshed. */
65003
65458
  lastFetchedAt: number()
65004
65459
  });
65005
- var DeviceIdSchema = number().int().nonnegative();
65006
- var MinutesSchema = number().int().min(0);
65460
+ var DeviceIdSchema$1 = number().int().nonnegative();
65007
65461
  DeviceType.PetFountain, method(object({
65008
- deviceId: DeviceIdSchema,
65009
- on: boolean()
65010
- }), _void(), {
65011
- kind: "mutation",
65012
- auth: "protected"
65013
- }), method(object({
65014
- deviceId: DeviceIdSchema,
65462
+ deviceId: DeviceIdSchema$1,
65015
65463
  on: boolean()
65016
65464
  }), _void(), {
65017
65465
  kind: "mutation",
65018
65466
  auth: "protected"
65019
- }), method(object({
65020
- deviceId: DeviceIdSchema,
65021
- minutes: MinutesSchema
65022
- }), _void(), {
65023
- kind: "mutation",
65024
- auth: "protected"
65025
- }), method(object({
65026
- deviceId: DeviceIdSchema,
65027
- minutes: MinutesSchema
65028
- }), _void(), {
65029
- kind: "mutation",
65030
- auth: "protected"
65031
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
65467
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
65032
65468
  kind: "mutation",
65033
65469
  auth: "protected"
65034
65470
  });
@@ -66988,6 +67424,37 @@ DeviceType.Camera, method(object({ deviceId: number() }), PtzAutotrackStatusSche
66988
67424
  deviceId: number(),
66989
67425
  status: PtzAutotrackStatusSchema
66990
67426
  });
67427
+ object({
67428
+ /** True when the pump works on the on/off cycle, false when it runs continuously. Null while unknown. */
67429
+ enabled: boolean().nullable(),
67430
+ /** How long the pump runs per cycle, in seconds. Null while unknown. */
67431
+ onTime: number().min(0).nullable().meta(readingMeta("duration")),
67432
+ /** How long the pump rests per cycle, in seconds. Null while unknown. */
67433
+ offTime: number().min(0).nullable().meta(readingMeta("duration")),
67434
+ /** Ms epoch when the slice was last refreshed. */
67435
+ lastFetchedAt: number()
67436
+ });
67437
+ var DeviceIdSchema = number().int().nonnegative();
67438
+ var MinutesSchema = number().int().min(0);
67439
+ DeviceType.PetFountain, method(object({
67440
+ deviceId: DeviceIdSchema,
67441
+ on: boolean()
67442
+ }), _void(), {
67443
+ kind: "mutation",
67444
+ auth: "protected"
67445
+ }), method(object({
67446
+ deviceId: DeviceIdSchema,
67447
+ minutes: MinutesSchema
67448
+ }), _void(), {
67449
+ kind: "mutation",
67450
+ auth: "protected"
67451
+ }), method(object({
67452
+ deviceId: DeviceIdSchema,
67453
+ minutes: MinutesSchema
67454
+ }), _void(), {
67455
+ kind: "mutation",
67456
+ auth: "protected"
67457
+ });
66991
67458
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
66992
67459
  kind: "mutation",
66993
67460
  auth: "admin"
@@ -70594,9 +71061,17 @@ var ServerUpdateActionResultSchema = object({
70594
71061
  */
70595
71062
  requiredAddonUpdates: array(RequiredAddonUpdateSchema).optional()
70596
71063
  });
70597
- var LaunchOverridesSchema = object({
70598
- /** The persisted heap ceiling in MB, or `null` when none is set. */
70599
- heapMb: number().int().nullable() });
71064
+ var LaunchOverridesSchema = object({
71065
+ /** The persisted heap ceiling in MB, or `null` when none is set. */
71066
+ heapMb: number().int().nullable(),
71067
+ /** The persisted hub-main RSS budget in MB, or `null` when none is set. */
71068
+ rssBudgetMb: number().int().nullable()
71069
+ });
71070
+ var SetLaunchOverridesInputSchema = object({
71071
+ heapMb: number().int().min(512).max(65536).nullable(),
71072
+ /** Omitted keeps the stored budget; `null` clears it. */
71073
+ rssBudgetMb: number().int().min(512).max(65536).nullable().optional()
71074
+ });
70600
71075
  var SetLaunchOverridesResultSchema = LaunchOverridesSchema.extend({
70601
71076
  /** Always true: the override is read at launch, not by the running process. */
70602
71077
  restartRequired: boolean() });
@@ -70625,7 +71100,7 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
70625
71100
  }), method(_void(), ServerUpdateActionResultSchema, {
70626
71101
  kind: "mutation",
70627
71102
  auth: "admin"
70628
- }), method(_void(), LaunchOverridesSchema, { auth: "admin" }), method(object({ heapMb: number().int().min(512).max(65536).nullable() }), SetLaunchOverridesResultSchema, {
71103
+ }), method(_void(), LaunchOverridesSchema, { auth: "admin" }), method(SetLaunchOverridesInputSchema, SetLaunchOverridesResultSchema, {
70629
71104
  kind: "mutation",
70630
71105
  auth: "admin"
70631
71106
  });
@@ -70648,7 +71123,16 @@ DeviceType.Sensor;
70648
71123
  * future fields without breaking the existing call sites.
70649
71124
  */
70650
71125
  var EmailAddressSchema = email();
71126
+ /**
71127
+ * Which relay of a multi-relay provider answers (D996). Absent = the provider's first / default
71128
+ * relay, so a caller written before relays existed keeps working unchanged. A provider with one
71129
+ * fixed relay ignores it. This is the integration instance id (`int_NNNN`), NOT the addon id: the
71130
+ * collection pin `addonId` still picks the provider, `instanceId` picks the relay inside it.
71131
+ */
71132
+ var InstanceIdSchema = string().min(1).optional();
71133
+ var RelayPinSchema = object({ instanceId: InstanceIdSchema });
70651
71134
  var SendEmailInputSchema = object({
71135
+ instanceId: InstanceIdSchema,
70652
71136
  to: union([EmailAddressSchema, array(EmailAddressSchema).min(1)]),
70653
71137
  cc: array(EmailAddressSchema).optional(),
70654
71138
  bcc: array(EmailAddressSchema).optional(),
@@ -70684,11 +71168,11 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
70684
71168
  kind: "mutation",
70685
71169
  auth: "admin",
70686
71170
  access: "create"
70687
- }), method(_void(), SmtpStatusSchema, {
71171
+ }), method(RelayPinSchema, SmtpStatusSchema, {
70688
71172
  kind: "mutation",
70689
71173
  auth: "admin",
70690
71174
  access: "view"
70691
- }), method(_void(), SmtpStatusSchema, { auth: "admin" });
71175
+ }), method(RelayPinSchema, SmtpStatusSchema, { auth: "admin" });
70692
71176
  /**
70693
71177
  * A single device snapshot returned as base64 JPEG/PNG.
70694
71178
  *
@@ -70720,10 +71204,12 @@ DeviceType.Camera, method(object({
70720
71204
  * even when the cache is well within the device's
70721
71205
  * `snapshotMaxAgeS` window.
70722
71206
  *
70723
- * **`force` is an OPERATOR signal, not a freshness preference.** On a
71207
+ * **`force` is a demand with a named principal, not a freshness
71208
+ * preference** — an operator button, the scheduled refresh (D847), or a
71209
+ * notification rule that left the camera's wake allowed (D998). On a
70724
71210
  * battery camera it is the one thing that walks past the wrapper's
70725
- * sleep gate and wakes the camera, so a background caller — a poller,
70726
- * an event handler, a thumbnail — must NEVER set it. Every such caller
71211
+ * sleep gate and wakes the camera, so a poller, a thumbnail or a
71212
+ * prestream must NEVER set it. Every such caller
70727
71213
  * gets the cached frame, which on a sleeping battery camera is the
70728
71214
  * correct answer: stale but honest beats woken.
70729
71215
  */
@@ -72081,6 +72567,40 @@ var LoggingSettingsStateSchema = object({
72081
72567
  opsLogRetentionDays: number().int().min(0),
72082
72568
  persisted: boolean()
72083
72569
  });
72570
+ /**
72571
+ * Debug WATCH — a short, per-device window over `debug.<channel>` lines.
72572
+ *
72573
+ * `start` opens (or re-arms) a 10 minute window; `rearm` extends a LIVE one
72574
+ * and never revives a lapsed one; `stop` closes it; `list` only reads. No
72575
+ * chain of re-arms outlives 60 minutes from the first start. The hub holds the
72576
+ * watches in memory and pushes the interest to every node, so a watch lapses
72577
+ * by itself and survives nothing — a restart is a stop.
72578
+ */
72579
+ var DebugWatchInputSchema = object({
72580
+ action: _enum([
72581
+ "list",
72582
+ "start",
72583
+ "rearm",
72584
+ "stop"
72585
+ ]),
72586
+ /** Full channel names, `debug.<channel>`, each declared with `kind: 'debug'`. */
72587
+ channels: array(string().min(1)).readonly().default([]),
72588
+ /** Numeric device ids. Required (non-empty) for `start`. */
72589
+ deviceIds: array(number().int()).readonly().default([])
72590
+ });
72591
+ var DebugWatchStateSchema = object({
72592
+ channel: string(),
72593
+ deviceIds: array(number().int()).readonly(),
72594
+ startedAtMs: number(),
72595
+ untilMs: number(),
72596
+ capAtMs: number()
72597
+ });
72598
+ var DebugWatchResultSchema = object({
72599
+ nowMs: number(),
72600
+ watches: array(DebugWatchStateSchema).readonly(),
72601
+ /** Channels a `rearm` found already lapsed: nothing was revived. */
72602
+ lapsed: array(string()).readonly()
72603
+ });
72084
72604
  method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string(), unknown()), _null(), {
72085
72605
  kind: "mutation",
72086
72606
  auth: "admin"
@@ -72096,6 +72616,9 @@ method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_
72096
72616
  }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(_void(), array(ReportedFailureContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
72097
72617
  kind: "mutation",
72098
72618
  auth: "admin"
72619
+ }), method(DebugWatchInputSchema, DebugWatchResultSchema, {
72620
+ kind: "mutation",
72621
+ auth: "admin"
72099
72622
  });
72100
72623
  object({
72101
72624
  /** True when the device's tamper switch / case-open contact is
@@ -74663,7 +75186,7 @@ discriminatedUnion("kind", [object({
74663
75186
  kind: literal("pronto"),
74664
75187
  code: string()
74665
75188
  })]);
74666
- DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
75189
+ DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
74667
75190
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
74668
75191
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
74669
75192
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
@@ -75644,6 +76167,27 @@ Object.freeze({
75644
76167
  access: "view",
75645
76168
  role: "viewer"
75646
76169
  },
76170
+ "boardKeySource.getBoardKey": {
76171
+ capName: "board-key-source",
76172
+ capScope: "system",
76173
+ addonId: null,
76174
+ access: "view",
76175
+ role: "admin"
76176
+ },
76177
+ "boardKeySource.listBoards": {
76178
+ capName: "board-key-source",
76179
+ capScope: "system",
76180
+ addonId: null,
76181
+ access: "view",
76182
+ role: "admin"
76183
+ },
76184
+ "boardKeySource.listSources": {
76185
+ capName: "board-key-source",
76186
+ capScope: "system",
76187
+ addonId: null,
76188
+ access: "view",
76189
+ role: "admin"
76190
+ },
75647
76191
  "brightness.getStatus": {
75648
76192
  capName: "brightness",
75649
76193
  capScope: "device",
@@ -76981,6 +77525,13 @@ Object.freeze({
76981
77525
  access: "view",
76982
77526
  role: "admin"
76983
77527
  },
77528
+ "deviceManager.dismissDiscoveryProposal": {
77529
+ capName: "device-manager",
77530
+ capScope: "system",
77531
+ addonId: null,
77532
+ access: "create",
77533
+ role: "admin"
77534
+ },
76984
77535
  "deviceManager.enable": {
76985
77536
  capName: "device-manager",
76986
77537
  capScope: "system",
@@ -77163,6 +77714,13 @@ Object.freeze({
77163
77714
  access: "view",
77164
77715
  role: "viewer"
77165
77716
  },
77717
+ "deviceManager.listDiscoveryProposals": {
77718
+ capName: "device-manager",
77719
+ capScope: "system",
77720
+ addonId: null,
77721
+ access: "view",
77722
+ role: "admin"
77723
+ },
77166
77724
  "deviceManager.listLocationDescriptions": {
77167
77725
  capName: "device-manager",
77168
77726
  capScope: "system",
@@ -77317,6 +77875,13 @@ Object.freeze({
77317
77875
  access: "create",
77318
77876
  role: "admin"
77319
77877
  },
77878
+ "deviceManager.reportDiscoveryObservations": {
77879
+ capName: "device-manager",
77880
+ capScope: "system",
77881
+ addonId: null,
77882
+ access: "create",
77883
+ role: "admin"
77884
+ },
77320
77885
  "deviceManager.runDeviceAction": {
77321
77886
  capName: "device-manager",
77322
77887
  capScope: "system",
@@ -77324,6 +77889,13 @@ Object.freeze({
77324
77889
  access: "create",
77325
77890
  role: "admin"
77326
77891
  },
77892
+ "deviceManager.runDiscoverySweep": {
77893
+ capName: "device-manager",
77894
+ capScope: "system",
77895
+ addonId: null,
77896
+ access: "create",
77897
+ role: "admin"
77898
+ },
77327
77899
  "deviceManager.setChildLayout": {
77328
77900
  capName: "device-manager",
77329
77901
  capScope: "system",
@@ -77877,6 +78449,20 @@ Object.freeze({
77877
78449
  access: "create",
77878
78450
  role: "admin"
77879
78451
  },
78452
+ "doNotDisturb.getStatus": {
78453
+ capName: "do-not-disturb",
78454
+ capScope: "device",
78455
+ addonId: null,
78456
+ access: "view",
78457
+ role: "viewer"
78458
+ },
78459
+ "doNotDisturb.setEnabled": {
78460
+ capName: "do-not-disturb",
78461
+ capScope: "device",
78462
+ addonId: null,
78463
+ access: "create",
78464
+ role: "viewer"
78465
+ },
77880
78466
  "doorbell.getStatus": {
77881
78467
  capName: "doorbell",
77882
78468
  capScope: "device",
@@ -78241,6 +78827,69 @@ Object.freeze({
78241
78827
  access: "create",
78242
78828
  role: "admin"
78243
78829
  },
78830
+ "integrationInstances.createInstance": {
78831
+ capName: "integration-instances",
78832
+ capScope: "system",
78833
+ addonId: null,
78834
+ access: "create",
78835
+ role: "admin"
78836
+ },
78837
+ "integrationInstances.deleteInstance": {
78838
+ capName: "integration-instances",
78839
+ capScope: "system",
78840
+ addonId: null,
78841
+ access: "delete",
78842
+ role: "admin"
78843
+ },
78844
+ "integrationInstances.describe": {
78845
+ capName: "integration-instances",
78846
+ capScope: "system",
78847
+ addonId: null,
78848
+ access: "view",
78849
+ role: "admin"
78850
+ },
78851
+ "integrationInstances.getInstance": {
78852
+ capName: "integration-instances",
78853
+ capScope: "system",
78854
+ addonId: null,
78855
+ access: "view",
78856
+ role: "admin"
78857
+ },
78858
+ "integrationInstances.instanceFormSchema": {
78859
+ capName: "integration-instances",
78860
+ capScope: "system",
78861
+ addonId: null,
78862
+ access: "view",
78863
+ role: "admin"
78864
+ },
78865
+ "integrationInstances.listInstances": {
78866
+ capName: "integration-instances",
78867
+ capScope: "system",
78868
+ addonId: null,
78869
+ access: "view",
78870
+ role: "admin"
78871
+ },
78872
+ "integrationInstances.setInstanceEnabled": {
78873
+ capName: "integration-instances",
78874
+ capScope: "system",
78875
+ addonId: null,
78876
+ access: "create",
78877
+ role: "admin"
78878
+ },
78879
+ "integrationInstances.testInstance": {
78880
+ capName: "integration-instances",
78881
+ capScope: "system",
78882
+ addonId: null,
78883
+ access: "create",
78884
+ role: "admin"
78885
+ },
78886
+ "integrationInstances.updateInstance": {
78887
+ capName: "integration-instances",
78888
+ capScope: "system",
78889
+ addonId: null,
78890
+ access: "create",
78891
+ role: "admin"
78892
+ },
78244
78893
  "integrations.create": {
78245
78894
  capName: "integrations",
78246
78895
  capScope: "system",
@@ -80362,27 +81011,6 @@ Object.freeze({
80362
81011
  access: "create",
80363
81012
  role: "viewer"
80364
81013
  },
80365
- "petFountain.setPumpInterval": {
80366
- capName: "pet-fountain",
80367
- capScope: "device",
80368
- addonId: null,
80369
- access: "create",
80370
- role: "viewer"
80371
- },
80372
- "petFountain.setPumpOffMinutes": {
80373
- capName: "pet-fountain",
80374
- capScope: "device",
80375
- addonId: null,
80376
- access: "create",
80377
- role: "viewer"
80378
- },
80379
- "petFountain.setPumpOnMinutes": {
80380
- capName: "pet-fountain",
80381
- capScope: "device",
80382
- addonId: null,
80383
- access: "create",
80384
- role: "viewer"
80385
- },
80386
81014
  "pipelineAnalytics.addRetrainFrameFromRecording": {
80387
81015
  capName: "pipeline-analytics",
80388
81016
  capScope: "device",
@@ -82161,6 +82789,34 @@ Object.freeze({
82161
82789
  access: "create",
82162
82790
  role: "admin"
82163
82791
  },
82792
+ "pumpCycle.getStatus": {
82793
+ capName: "pump-cycle",
82794
+ capScope: "device",
82795
+ addonId: null,
82796
+ access: "view",
82797
+ role: "viewer"
82798
+ },
82799
+ "pumpCycle.setEnabled": {
82800
+ capName: "pump-cycle",
82801
+ capScope: "device",
82802
+ addonId: null,
82803
+ access: "create",
82804
+ role: "viewer"
82805
+ },
82806
+ "pumpCycle.setOffMinutes": {
82807
+ capName: "pump-cycle",
82808
+ capScope: "device",
82809
+ addonId: null,
82810
+ access: "create",
82811
+ role: "viewer"
82812
+ },
82813
+ "pumpCycle.setOnMinutes": {
82814
+ capName: "pump-cycle",
82815
+ capScope: "device",
82816
+ addonId: null,
82817
+ access: "create",
82818
+ role: "viewer"
82819
+ },
82164
82820
  "reboot.reboot": {
82165
82821
  capName: "reboot",
82166
82822
  capScope: "device",
@@ -83897,6 +84553,13 @@ Object.freeze({
83897
84553
  access: "create",
83898
84554
  role: "viewer"
83899
84555
  },
84556
+ "system.debugWatch": {
84557
+ capName: "system",
84558
+ capScope: "system",
84559
+ addonId: null,
84560
+ access: "create",
84561
+ role: "admin"
84562
+ },
83900
84563
  "system.detectSiteLocation": {
83901
84564
  capName: "system",
83902
84565
  capScope: "system",
@@ -86090,6 +86753,16 @@ Object.freeze({
86090
86753
  form: "single",
86091
86754
  optional: false
86092
86755
  }],
86756
+ "doNotDisturb.getStatus": [{
86757
+ name: "deviceId",
86758
+ form: "single",
86759
+ optional: false
86760
+ }],
86761
+ "doNotDisturb.setEnabled": [{
86762
+ name: "deviceId",
86763
+ form: "single",
86764
+ optional: false
86765
+ }],
86093
86766
  "doorbell.getStatus": [{
86094
86767
  name: "deviceId",
86095
86768
  form: "single",
@@ -86713,21 +87386,6 @@ Object.freeze({
86713
87386
  form: "single",
86714
87387
  optional: false
86715
87388
  }],
86716
- "petFountain.setPumpInterval": [{
86717
- name: "deviceId",
86718
- form: "single",
86719
- optional: false
86720
- }],
86721
- "petFountain.setPumpOffMinutes": [{
86722
- name: "deviceId",
86723
- form: "single",
86724
- optional: false
86725
- }],
86726
- "petFountain.setPumpOnMinutes": [{
86727
- name: "deviceId",
86728
- form: "single",
86729
- optional: false
86730
- }],
86731
87389
  "pipelineAnalytics.addRetrainFrameFromRecording": [{
86732
87390
  name: "deviceId",
86733
87391
  form: "single",
@@ -87363,6 +88021,26 @@ Object.freeze({
87363
88021
  form: "single",
87364
88022
  optional: false
87365
88023
  }],
88024
+ "pumpCycle.getStatus": [{
88025
+ name: "deviceId",
88026
+ form: "single",
88027
+ optional: false
88028
+ }],
88029
+ "pumpCycle.setEnabled": [{
88030
+ name: "deviceId",
88031
+ form: "single",
88032
+ optional: false
88033
+ }],
88034
+ "pumpCycle.setOffMinutes": [{
88035
+ name: "deviceId",
88036
+ form: "single",
88037
+ optional: false
88038
+ }],
88039
+ "pumpCycle.setOnMinutes": [{
88040
+ name: "deviceId",
88041
+ form: "single",
88042
+ optional: false
88043
+ }],
87366
88044
  "reboot.reboot": [{
87367
88045
  name: "deviceId",
87368
88046
  form: "single",
@@ -87830,6 +88508,11 @@ Object.freeze({
87830
88508
  form: "single",
87831
88509
  optional: false
87832
88510
  }],
88511
+ "system.debugWatch": [{
88512
+ name: "deviceIds",
88513
+ form: "array",
88514
+ optional: true
88515
+ }],
87833
88516
  "tamper.getStatus": [{
87834
88517
  name: "deviceId",
87835
88518
  form: "single",
@@ -89637,8 +90320,7 @@ object({
89637
90320
  * The settings page drives these through
89638
90321
  * `api.addons.custom.{query,mutate}({ addonId, action, input })`: every action
89639
90322
  * button there is an `addon-action-button`, which shows the result (or the
89640
- * error) under the button, and the external-address picker is an
89641
- * `addon-action-select` over `listExternalAddresses`.
90323
+ * error) under the button.
89642
90324
  *
89643
90325
  * Every action is `auth: 'admin'` (S2). The framework default is `protected` —
89644
90326
  * any authenticated user — and at that level a viewer could rotate the token
@@ -89649,15 +90331,6 @@ object({
89649
90331
  * and `undefined` so the form-builder doesn't have to know. */
89650
90332
  var NoInput = object({}).optional();
89651
90333
  var exportAlexaActions = defineCustomActions({
89652
- /**
89653
- * The external addresses the connected `network-access` providers report
89654
- * now, read live for the "External address" picker, plus the saved choice
89655
- * when it is not among them (so it is never silently dropped from view).
89656
- */
89657
- listExternalAddresses: customAction(NoInput, object({ addresses: array(object({
89658
- value: string(),
89659
- label: string()
89660
- })).readonly() }), { auth: "admin" }),
89661
90334
  regenerateIngressToken: customAction(NoInput, object({ ingressToken: string() }), {
89662
90335
  kind: "mutation",
89663
90336
  auth: "admin"
@@ -95517,12 +96190,12 @@ function entryOf(ctx, p, track) {
95517
96190
  at: track.firstSeen
95518
96191
  };
95519
96192
  }
95520
- function dataItem(ctx, p, entry, userId) {
96193
+ async function dataItem(ctx, p, entry, userId) {
95521
96194
  return {
95522
96195
  eventIdentifier: entry.e,
95523
96196
  imageNetClass: entry.c,
95524
96197
  objectIdentifier: objectIdentifierFor(ctx.namespace(), p.deviceId, entry.t),
95525
- ...ctx.imagesFor(userId, p.deviceId, entry.t, entry.at)
96198
+ ...await ctx.imagesFor(userId, p.deviceId, entry.t, entry.at)
95526
96199
  };
95527
96200
  }
95528
96201
  function rangeOf(payload) {
@@ -95628,7 +96301,7 @@ async function handleReportData(header, endpoint, payloadRaw, ctx, caller) {
95628
96301
  type: "JSON",
95629
96302
  schema: "SmartVisionData"
95630
96303
  },
95631
- data: entries.map((e) => dataItem(ctx, p, e, caller.userId))
96304
+ data: await Promise.all(entries.map((e) => dataItem(ctx, p, e, caller.userId)))
95632
96305
  });
95633
96306
  }
95634
96307
  async function handleDeleteData(header, endpoint, payloadRaw, ctx, caller) {
@@ -96026,11 +96699,13 @@ async function handleGetSnapshot(header, endpoint, deps, caller) {
96026
96699
  const parsed = parseCameraEndpointId(endpoint.endpointId);
96027
96700
  if (parsed.kind !== "camera") return errorEnvelope(header, "INVALID_DIRECTIVE", "snapshots are served for camera endpoints");
96028
96701
  const deviceId = parsed.deviceId;
96029
- const base = deps.publicHubUrl().replace(/\/+$/, "");
96030
- if (!base.startsWith("https://")) {
96031
- deps.logger.warn("alexa snapshot: no public HTTPS address — Alexa cannot fetch an image", { tags: { deviceId } });
96032
- return errorEnvelope(header, "INTERNAL_ERROR", "the hub has no public HTTPS address");
96702
+ const publicOrigin = await deps.publicEndpoint();
96703
+ if (!publicOrigin.ok || !publicOrigin.origin.startsWith("https://")) {
96704
+ const reason = publicOrigin.ok ? "public-publicOrigin-not-https" : publicOrigin.reason.code;
96705
+ deps.logger.warn(`alexa snapshot: no public HTTPS address (${reason}) — Alexa cannot fetch an image`, { tags: { deviceId } });
96706
+ return errorEnvelope(header, "INTERNAL_ERROR", `the hub has no public HTTPS address (${reason}); set the Public publicOrigin on the Network page`);
96033
96707
  }
96708
+ const base = publicOrigin.origin;
96034
96709
  const started = deps.now?.() ?? Date.now();
96035
96710
  const frame = await readFrame(deps.ctx, deviceId).catch((err) => {
96036
96711
  deps.logger.warn("alexa snapshot: snapshot read failed", {
@@ -97150,6 +97825,82 @@ function maskSecretTail(secret) {
97150
97825
  return `••••••••${secret.slice(-4)}`;
97151
97826
  }
97152
97827
  //#endregion
97828
+ //#region src/public-endpoint.ts
97829
+ /** The role resolves to no address. */
97830
+ var NO_PUBLIC_ENDPOINT_REASON = {
97831
+ code: "no-public-endpoint",
97832
+ message: "The hub has no public endpoint. Set up remote access (a tunnel) and flag an address as \"Public endpoint\" on the Network page; Alexa reaches this hub from its own cloud."
97833
+ };
97834
+ /** The palette could not be read at all. */
97835
+ var PUBLIC_ENDPOINT_UNREADABLE_REASON = {
97836
+ code: "public-endpoint-unreadable",
97837
+ message: "The hub could not read its \"Public endpoint\" address from the Network page; try again once the network service is up."
97838
+ };
97839
+ /** Trailing slashes off, surrounding space off. Nothing else is rewritten. */
97840
+ var normaliseOrigin = (raw) => raw.trim().replace(/\/+$/, "");
97841
+ var resolvePublicEndpoint = (book) => {
97842
+ const resolved = book.roles.publicEndpoint.resolved;
97843
+ const origin = resolved === null ? "" : normaliseOrigin(resolved);
97844
+ if (origin.length === 0) return {
97845
+ ok: false,
97846
+ reason: NO_PUBLIC_ENDPOINT_REASON
97847
+ };
97848
+ return {
97849
+ ok: true,
97850
+ origin
97851
+ };
97852
+ };
97853
+ /** A failed read is the unreadable refusal, never a thrown error and never an empty origin. */
97854
+ var createPublicEndpointReader = (read) => async () => {
97855
+ try {
97856
+ return resolvePublicEndpoint(await read());
97857
+ } catch {
97858
+ return {
97859
+ ok: false,
97860
+ reason: PUBLIC_ENDPOINT_UNREADABLE_REASON
97861
+ };
97862
+ }
97863
+ };
97864
+ //#endregion
97865
+ //#region src/routing-claim.ts
97866
+ /**
97867
+ * The `hubUrl` routing claim of an Alexa-bound token. The skill Lambda routes a directive back
97868
+ * to this hub on it, so it must still name the hub's current `publicEndpoint` role.
97869
+ *
97870
+ * Operator decision (planning#378, option B): there is no transition. A token issued with a
97871
+ * claim that differs from the role is refused with a named reason and the operator re-links
97872
+ * the skill once. The claim is read from a token `oauthVerifyAccessToken` has ALREADY
97873
+ * verified, so decoding the payload here trusts nothing new; the token itself is never logged.
97874
+ */
97875
+ var ClaimsSchema = object({ hubUrl: string().optional() });
97876
+ /** The claim, or null when the token carries none (or is not a JWT). */
97877
+ function readRoutingClaim(token) {
97878
+ const payload = token.split(".")[1];
97879
+ if (payload === void 0) return null;
97880
+ try {
97881
+ const parsed = ClaimsSchema.safeParse(JSON.parse(Buffer.from(payload, "base64url").toString()));
97882
+ const claim = parsed.success ? normaliseOrigin(parsed.data.hubUrl ?? "") : "";
97883
+ return claim.length > 0 ? claim : null;
97884
+ } catch {
97885
+ return null;
97886
+ }
97887
+ }
97888
+ function judgeRoutingClaim(claim, endpoint) {
97889
+ if (claim === null) return { kind: "unclaimed" };
97890
+ const normalised = normaliseOrigin(claim);
97891
+ if (!endpoint.ok) return {
97892
+ kind: "no-endpoint",
97893
+ claim: normalised,
97894
+ reason: endpoint.reason
97895
+ };
97896
+ if (normalised === endpoint.origin) return { kind: "current" };
97897
+ return {
97898
+ kind: "stale",
97899
+ claim: normalised,
97900
+ current: endpoint.origin
97901
+ };
97902
+ }
97903
+ //#endregion
97153
97904
  //#region src/snapshots/snapshot-route.ts
97154
97905
  var IMAGE_FILE = /^([0-9a-f-]{36})\.jpg$/;
97155
97906
  function bearerOf(headers) {
@@ -97324,16 +98075,6 @@ function buildRoutes(deps) {
97324
98075
  access: "public",
97325
98076
  description: "Alexa SnapshotProvider image (signed, 10 min, account-link token required)",
97326
98077
  handler: (req, reply) => handleSnapshotFetch(req, reply, deps.snapshotRoute)
97327
- },
97328
- {
97329
- method: "POST",
97330
- path: "/admin/redetect-hub-url",
97331
- access: "admin",
97332
- description: "Wizard hook — re-runs publicHubUrl auto-detection",
97333
- handler: async (_req, reply) => {
97334
- const result = await deps.redetectPublicHubUrl();
97335
- reply.code(200).send(result);
97336
- }
97337
98078
  }
97338
98079
  ];
97339
98080
  }
@@ -97418,6 +98159,16 @@ async function handleDirective(request, reply, deps) {
97418
98159
  return;
97419
98160
  }
97420
98161
  const verified = verifiedParse.data;
98162
+ const verdict = judgeRoutingClaim(readRoutingClaim(bearer), await deps.publicEndpoint());
98163
+ if (verdict.kind === "stale" || verdict.kind === "no-endpoint") {
98164
+ deps.logger.warn(verdict.kind === "stale" ? "alexa directive: refused — routing-claim-stale: the token was issued for another hub address; re-link the Alexa skill" : `alexa directive: refused — ${verdict.reason.code}: the token carries a routing claim but the hub has no public endpoint to compare it with`, { meta: {
98165
+ userId: verified.userId,
98166
+ claim: verdict.claim,
98167
+ ...verdict.kind === "stale" ? { current: verdict.current } : {}
98168
+ } });
98169
+ reply.code(200).send(preParseErrorEnvelope("INVALID_AUTHORIZATION_CREDENTIAL", verdict.kind === "stale" ? "token was issued for another hub address; re-link the Alexa skill" : `hub has no public endpoint (${verdict.reason.code}); set it on the Network page`));
98170
+ return;
98171
+ }
97421
98172
  try {
97422
98173
  assertDeviceScope(verified.scopes);
97423
98174
  } catch {
@@ -98032,7 +98783,7 @@ var LwaEventGateway = class {
98032
98783
  const d = opts.detection;
98033
98784
  for (const account of linked) {
98034
98785
  if (!this.mayPush(account.userId, opts.deviceId, "object detection")) continue;
98035
- const images = opts.imagesFor?.(account.userId) ?? {};
98786
+ const images = await opts.imagesFor?.(account.userId) ?? {};
98036
98787
  if (!this.smartVisionSampled.has(endpointId)) {
98037
98788
  this.smartVisionSampled.add(endpointId);
98038
98789
  this.deps.logger.info("alexa lwa-gateway: ObjectDetection body sample (redacted)", {
@@ -98370,9 +99121,10 @@ var LwaEventGateway = class {
98370
99121
  const retryAt = this.migrationRetryAt.get(userId) ?? 0;
98371
99122
  if (Date.now() < retryAt) return null;
98372
99123
  try {
99124
+ const endpoint = this.deps.getPublicEndpoint ? await this.deps.getPublicEndpoint() : null;
98373
99125
  const migrated = await migrateLegacyGrant(this.fetchImpl, brokerUrl, {
98374
99126
  refreshToken: entry.refreshToken,
98375
- ...this.deps.getPublicHubUrl ? { hubUrl: this.deps.getPublicHubUrl() } : {}
99127
+ ...endpoint?.ok ? { hubUrl: endpoint.origin } : {}
98376
99128
  });
98377
99129
  await this.deps.upsertToken({
98378
99130
  userId,
@@ -98719,7 +99471,7 @@ var CONNECTION_DESCRIPTION = [
98719
99471
  "Public skill (default): enable the \"CamStack\" skill in the Alexa app and link your account. No Amazon developer setup is needed.",
98720
99472
  "Custom skill: enter your skill id and deploy the skill Lambda from this addon's lambda-template in your own AWS account.",
98721
99473
  "Either way the skill's Lambda keeps the Amazon credentials (in a custom skill, in your SSM Parameter Store); this hub holds none. It receives short-lived event tokens from the Lambda's token broker with a credential unique to this link.",
98722
- "This hub must be reachable from the internet over HTTPS (Cloudflare Tunnel, Tailscale Funnel, …). The external address below is the one the skill calls back on."
99474
+ "This hub must be reachable from the internet over HTTPS (Cloudflare Tunnel, Tailscale Funnel, …). The skill calls back on the hub's \"Public endpoint\" address, set on the Network page."
98723
99475
  ].join("\n");
98724
99476
  function connectionSection(input) {
98725
99477
  const { defaults } = input;
@@ -98771,20 +99523,6 @@ function connectionSection(input) {
98771
99523
  description: "Your skill's id, format amzn1.ask.skill.xxxx, from the Alexa developer console. Directives for any other skill are refused.",
98772
99524
  default: defaults.expectedAudience,
98773
99525
  showWhen: CUSTOM_SKILL_ONLY
98774
- },
98775
- {
98776
- type: "addon-action-select",
98777
- key: "publicHubUrl",
98778
- label: "External address",
98779
- description: "The HTTPS address the skill reaches this hub on, read live from the connected remote-access providers each time this page opens. Defaults to the first one detected; a saved choice that is no longer detected stays selected until you change it.",
98780
- addonId: ADDON_ID,
98781
- action: "listExternalAddresses",
98782
- mapOption: {
98783
- value: "value",
98784
- label: "label"
98785
- },
98786
- emptyResultsMessage: "No external HTTPS address detected. Set up remote access (Cloudflare Tunnel, Tailscale Funnel, …), then reopen this page.",
98787
- default: defaults.publicHubUrl
98788
99526
  }
98789
99527
  ]
98790
99528
  };
@@ -99598,10 +100336,14 @@ var AlexaVisionRuntime = class {
99598
100336
  return reportableVisionClasses(declared, await this.state.get(deviceId));
99599
100337
  }
99600
100338
  /** Fresh, per-user, ten-minute image URIs for one event — or none. */
99601
- imagesFor(userId, deviceId, trackId, at) {
100339
+ async imagesFor(userId, deviceId, trackId, at) {
99602
100340
  if (!this.deps.snapshotsOn()) return {};
99603
- const base = this.deps.publicHubUrl().replace(/\/+$/, "");
99604
- if (!base.startsWith("https://")) return {};
100341
+ const endpoint = await this.deps.publicEndpoint();
100342
+ if (!endpoint.ok || !endpoint.origin.startsWith("https://")) {
100343
+ this.deps.logger.debug(`alexa vision: no image URIs — ${endpoint.ok ? "public-endpoint-not-https" : endpoint.reason.code}`, { tags: { deviceId } });
100344
+ return {};
100345
+ }
100346
+ const base = endpoint.origin;
99605
100347
  const frame = this.deps.store.mintLazy({
99606
100348
  deviceId,
99607
100349
  userId,
@@ -99675,6 +100417,59 @@ var AlexaVisionRuntime = class {
99675
100417
  }
99676
100418
  };
99677
100419
  //#endregion
100420
+ //#region src/migrations/drop-public-hub-url.ts
100421
+ /**
100422
+ * The hub's public URL is no longer a setting of this addon (planning#378): Alexa reads the
100423
+ * `publicEndpoint` role of the local-network palette on every use. The key older
100424
+ * versions persisted is deleted. Every other key is left exactly as stored.
100425
+ *
100426
+ * Idempotent: a store without the key yields an empty plan, which writes nothing.
100427
+ */
100428
+ /** The addon id, the prefix of its rows in the canonical settings table. */
100429
+ var ALEXA_ADDON_ID = "export-alexa";
100430
+ /**
100431
+ * Where the addon's global settings live: the canonical `addon-settings` table, one row per
100432
+ * key, id `<addonId>.<key>`, data `{ addonId, key, value }` (never a per-addon scoped table,
100433
+ * which exists only when something lazily declared it).
100434
+ */
100435
+ var ADDON_SETTINGS_TABLE = "addon-settings";
100436
+ var RETIRED_PUBLIC_URL_KEYS = ["publicHubUrl"];
100437
+ async function planDropPublicHubUrl(ports) {
100438
+ const stored = await ports.readStored();
100439
+ const present = RETIRED_PUBLIC_URL_KEYS.filter((key) => key in stored);
100440
+ if (present.length === 0) return { edits: [] };
100441
+ const rowId = (key) => `${ALEXA_ADDON_ID}.${key}`;
100442
+ return { edits: [{
100443
+ op: "deleteKeys",
100444
+ scope: ADDON_SETTINGS_TABLE,
100445
+ keys: present.map(rowId),
100446
+ precondition: preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
100447
+ addonId: ALEXA_ADDON_ID,
100448
+ key,
100449
+ value: stored[key]
100450
+ }])))
100451
+ }] };
100452
+ }
100453
+ //#endregion
100454
+ //#region src/migrations/index.ts
100455
+ /** The `export-alexa` catalogue (D987): offered to the engine when the addon initialises. */
100456
+ var ADDON_MIGRATIONS = [{
100457
+ meta: {
100458
+ id: "export-alexa/2026-11-02-drop-public-hub-url",
100459
+ owner: "export-alexa",
100460
+ level: "addon-state",
100461
+ seq: 1,
100462
+ dependsOn: [],
100463
+ store: "settings",
100464
+ scope: "cluster",
100465
+ onFailure: "tolerate",
100466
+ bodyKind: "plan",
100467
+ description: "Delete the retired publicHubUrl setting; the public URL is the publicEndpoint role",
100468
+ fixtureMark: "the exposed device list the migration does not know"
100469
+ },
100470
+ plan: planDropPublicHubUrl
100471
+ }];
100472
+ //#endregion
99678
100473
  //#region src/oauth-integration.ts
99679
100474
  /**
99680
100475
  * The `export-alexa` OAuth client — the descriptor behind
@@ -99731,7 +100526,7 @@ var ALEXA_REDIRECT_PREFIXES = [
99731
100526
  * no `requiresPkce` here. That is a property of the two clients, expressed
99732
100527
  * through the same descriptor field.
99733
100528
  */
99734
- function buildAlexaOauthIntegration(publicHubUrl) {
100529
+ function buildAlexaOauthIntegration(publicOrigin) {
99735
100530
  return {
99736
100531
  integrationId: "export-alexa",
99737
100532
  displayName: "Alexa Smart Home",
@@ -99768,13 +100563,13 @@ function buildAlexaOauthIntegration(publicHubUrl) {
99768
100563
  * "Unlink Amazon account" button does; see `unlinkAlexaAccounts`.
99769
100564
  */
99770
100565
  refreshTokenTtlSec: "never",
99771
- ...publicHubUrl ? { hubUrl: publicHubUrl } : {}
100566
+ ...publicOrigin ? { hubUrl: publicOrigin } : {}
99772
100567
  };
99773
100568
  }
99774
100569
  //#endregion
99775
100570
  //#region src/setup-block.ts
99776
100571
  function buildAlexaSetupBlock(input) {
99777
- const base = input.publicHubUrl.replace(/\/+$/, "");
100572
+ const base = input.publicEndpoint.ok ? input.publicEndpoint.origin : "";
99778
100573
  return {
99779
100574
  fields: [
99780
100575
  ...base ? [{
@@ -99790,9 +100585,13 @@ function buildAlexaSetupBlock(input) {
99790
100585
  value: maskSecretTail(input.ingressToken)
99791
100586
  }] : []
99792
100587
  ],
99793
- note: base ? "Account linking is handled by the core OAuth server. Use the hub's /api/oauth2/authorize endpoint with integration=export-alexa." : "Set the public hub URL on the settings form first — the directive endpoint URL is derived from it."
100588
+ note: base ? "Account linking is handled by the core OAuth server. Use the hub's /api/oauth2/authorize endpoint with integration=export-alexa." : refusalNote(input.publicEndpoint)
99794
100589
  };
99795
100590
  }
100591
+ function refusalNote(endpoint) {
100592
+ if (endpoint.ok) return "";
100593
+ return `Refused (${endpoint.reason.code}): ${endpoint.reason.message}`;
100594
+ }
99796
100595
  process.platform, process.env["SystemRoot"];
99797
100596
  /**
99798
100597
  * The ONE derivation of "a signed, expiring URL".
@@ -100966,7 +101765,6 @@ var DEFAULT_CONFIG = {
100966
101765
  tokens: [],
100967
101766
  exportedEndpoints: {},
100968
101767
  exportedSignatures: {},
100969
- publicHubUrl: "",
100970
101768
  ingressToken: "",
100971
101769
  enforceIngressToken: false,
100972
101770
  accountVisibility: {},
@@ -101048,7 +101846,13 @@ var ExportAlexaAddon = class extends BaseAddon {
101048
101846
  constructor() {
101049
101847
  super({ ...DEFAULT_CONFIG });
101050
101848
  }
101849
+ /**
101850
+ * The hub's public origin: the `publicEndpoint` role of `local-network`, read on every use
101851
+ * through `ctx.api` (planning#378). No setting holds it and nothing ranks the palette here.
101852
+ */
101853
+ publicEndpoint = createPublicEndpointReader(() => this.ctx.api.localNetwork.getAddresses.query());
101051
101854
  async onInitialize() {
101855
+ await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, { readStored: async () => this.resolveGlobalStore() }));
101052
101856
  if (!this.config.ingressToken) await this.updateGlobalSettings({ ingressToken: generateIngressToken() });
101053
101857
  if (!this.config.snapshotSigningKey) await this.updateGlobalSettings({ snapshotSigningKey: generateIngressToken() });
101054
101858
  if (!this.config.visionNamespace) await this.updateGlobalSettings({ visionNamespace: randomUUID() });
@@ -101057,9 +101861,6 @@ var ExportAlexaAddon = class extends BaseAddon {
101057
101861
  this.ctx.logger.warn("export-alexa: removed a stored LWA client secret — the hub no longer uses one; your skill Lambda holds it (D753)");
101058
101862
  }
101059
101863
  await this.backfillLinkedAccounts();
101060
- this.autoDetectPublicHubUrl().catch((err) => {
101061
- this.ctx.logger.warn("export-alexa: public hub URL auto-detect failed", { meta: { error: errMsg$1(err) } });
101062
- });
101063
101864
  this.accessGateRef = createHubAccessGate(this.ctx);
101064
101865
  this.detectionClassSource = new DetectionClassSource({
101065
101866
  readEventKinds: (deviceId) => this.ctx.api.pipelineAnalytics.listEventKinds.query({ deviceId }),
@@ -101083,7 +101884,7 @@ var ExportAlexaAddon = class extends BaseAddon {
101083
101884
  isExposed: (deviceId) => this.config.exposed.some((e) => e.deviceId === deviceId),
101084
101885
  knownClasses: (deviceId) => this.config.detectionClasses[deviceId]?.classes ?? [],
101085
101886
  namespace: () => this.config.visionNamespace,
101086
- publicHubUrl: () => this.config.publicHubUrl,
101887
+ publicEndpoint: this.publicEndpoint,
101087
101888
  store: this.snapshotStore,
101088
101889
  post: (opts) => this.requireGateway().postObjectDetection(opts)
101089
101890
  });
@@ -101108,7 +101909,7 @@ var ExportAlexaAddon = class extends BaseAddon {
101108
101909
  getStatus: async () => ({
101109
101910
  linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
101110
101911
  exposedDeviceCount: this.config.exposed.length,
101111
- setup: this.buildSetupBlock()
101912
+ setup: await this.buildSetupBlock()
101112
101913
  }),
101113
101914
  listSupportedDeviceKinds: async () => [...SUPPORTED_KINDS],
101114
101915
  listExposedDevices: async () => this.config.exposed.map((e) => ({ deviceId: String(e.deviceId) })),
@@ -101204,7 +102005,7 @@ var ExportAlexaAddon = class extends BaseAddon {
101204
102005
  logger: this.ctx.logger,
101205
102006
  store: this.snapshotStore,
101206
102007
  enabled: () => this.config.snapshots,
101207
- publicHubUrl: () => this.config.publicHubUrl
102008
+ publicEndpoint: this.publicEndpoint
101208
102009
  },
101209
102010
  vision: this.vision.context(),
101210
102011
  access: this.endpointAccess,
@@ -101221,7 +102022,7 @@ var ExportAlexaAddon = class extends BaseAddon {
101221
102022
  upsertToken: (input) => this.upsertToken(input),
101222
102023
  recordLinkedAccount: (input) => this.recordLinkedAccount(input)
101223
102024
  },
101224
- redetectPublicHubUrl: () => this.redetectPublicHubUrl(),
102025
+ publicEndpoint: this.publicEndpoint,
101225
102026
  onBrokerAdvertised: (raw) => this.rememberAdvertisedBroker(raw),
101226
102027
  snapshotRoute: {
101227
102028
  store: this.snapshotStore,
@@ -101235,7 +102036,11 @@ var ExportAlexaAddon = class extends BaseAddon {
101235
102036
  logger: this.ctx.logger
101236
102037
  }
101237
102038
  }));
101238
- const oauthIntegrationProvider = { getDescriptor: async () => buildAlexaOauthIntegration(this.config.publicHubUrl) };
102039
+ const oauthIntegrationProvider = { getDescriptor: async () => {
102040
+ const endpoint = await this.publicEndpoint();
102041
+ if (!endpoint.ok) this.ctx.logger.warn(`export-alexa: linking without a routing claim — ${endpoint.reason.code}: ${endpoint.reason.message}`);
102042
+ return buildAlexaOauthIntegration(endpoint.ok ? endpoint.origin : void 0);
102043
+ } };
101239
102044
  this.egressPrewarm = new AlexaEgressPrewarm({
101240
102045
  api: this.ctx.api,
101241
102046
  logger: this.ctx.logger,
@@ -101254,7 +102059,7 @@ var ExportAlexaAddon = class extends BaseAddon {
101254
102059
  upsertToken: (input) => this.upsertToken(input),
101255
102060
  removeLinkedAccount: (userId) => this.removeLinkedAccount(userId),
101256
102061
  getAdvertisedBrokerUrl: () => this.config.advertisedBrokerUrl || null,
101257
- getPublicHubUrl: () => this.config.publicHubUrl,
102062
+ getPublicEndpoint: this.publicEndpoint,
101258
102063
  getRegion: () => this.config.region,
101259
102064
  getExportedSignature: (deviceId) => this.config.exportedSignatures[deviceId] ?? null,
101260
102065
  accountMaySee: (userId, deviceId) => this.visibility.allows(userId, deviceId)
@@ -101333,14 +102138,6 @@ var ExportAlexaAddon = class extends BaseAddon {
101333
102138
  this.unexposeDevice(String(id));
101334
102139
  });
101335
102140
  this.ctx.addDisposer(async () => offRemoved());
101336
- const offTunnelStarted = this.ctx.eventBus.subscribe({ category: EventCategory.NetworkTunnelStarted }, () => {
101337
- this.redetectPublicHubUrl().then(({ publicHubUrl }) => {
101338
- this.ctx.logger.info("export-alexa: re-detected public hub URL after tunnel connect", { meta: { publicHubUrl } });
101339
- }).catch((err) => {
101340
- this.ctx.logger.warn("export-alexa: public hub URL re-detect after tunnel connect failed", { meta: { error: errMsg$1(err) } });
101341
- });
101342
- });
101343
- this.ctx.addDisposer(async () => offTunnelStarted());
101344
102141
  const reaper = setInterval(() => {
101345
102142
  this.reapDeadEgressHandles();
101346
102143
  }, EGRESS_REAP_INTERVAL_MS);
@@ -101370,7 +102167,6 @@ var ExportAlexaAddon = class extends BaseAddon {
101370
102167
  ],
101371
102168
  customActions: exportAlexaActions,
101372
102169
  actionHandlers: {
101373
- listExternalAddresses: async () => this.listExternalAddresses(),
101374
102170
  regenerateIngressToken: async () => this.regenerateIngressToken(),
101375
102171
  revealIngressToken: async () => {
101376
102172
  this.ctx.logger.info("export-alexa: an administrator revealed the ingress token");
@@ -101835,83 +102631,6 @@ var ExportAlexaAddon = class extends BaseAddon {
101835
102631
  };
101836
102632
  }
101837
102633
  /**
101838
- * Resolve the hub's public HTTPS URL by querying the `network-access`
101839
- * collection cap's `listEndpoints` aggregate.
101840
- *
101841
- * `network-access` is a proper codegen'd collection capability
101842
- * (`scope: 'system'`) so it IS reachable cross-process via `ctx.api` —
101843
- * unlike the `addons` core cap, which is a hub-side core tRPC router
101844
- * NOT advertised as a Moleculer service: a forked addon (export-alexa
101845
- * runs forked) calling `ctx.api.addons.*` would hang forever.
101846
- *
101847
- * `listEndpoints` with no `addonId` aggregates active ingress endpoints
101848
- * across every connected `network-access` provider. We take the first
101849
- * HTTPS entry. `listEndpoints` is optional on a provider (the cap doc
101850
- * says single-endpoint providers may omit it), so we fall back to the
101851
- * aggregate `getStatus` when `listEndpoints` yields nothing. Returns an
101852
- * empty string when none is available — the caller persists it as-is;
101853
- * the addon degrades gracefully (no public URL → directive endpoints
101854
- * unset) but never hangs.
101855
- */
101856
- async resolveEndpoints() {
101857
- const fromList = await this.detectAllFromListEndpoints();
101858
- if (fromList.length > 0) return fromList;
101859
- const single = await this.detectFromGetStatus();
101860
- if (single.length > 0) return [single];
101861
- this.ctx.logger.warn("export-alexa: no connected HTTPS remote-access endpoint — Alexa Lambda has no hub URL to route to. Set up Cloudflare Tunnel / Tailscale Funnel; the External address picker on the Alexa page lists it once connected.");
101862
- return [];
101863
- }
101864
- /** Aggregate `listEndpoints` → every HTTPS entry's url, de-duplicated. */
101865
- async detectAllFromListEndpoints() {
101866
- try {
101867
- const urls = (await this.ctx.api.networkAccess.listEndpoints.query({})).filter((e) => e.protocol === "https" && e.url.length > 0).map((e) => this.normaliseHubUrl(e.url));
101868
- return [...new Set(urls)];
101869
- } catch (err) {
101870
- this.ctx.logger.debug("export-alexa: networkAccess.listEndpoints failed", { meta: { error: errMsg$1(err) } });
101871
- return [];
101872
- }
101873
- }
101874
- /** Aggregate `getStatus` → connected HTTPS endpoint's url. '' on failure. */
101875
- async detectFromGetStatus() {
101876
- try {
101877
- const raw = await this.ctx.api.networkAccess.getStatus.query({});
101878
- const parsed = NetworkAccessStatusSchema.safeParse(raw);
101879
- const status = parsed.success ? parsed.data : null;
101880
- const endpoint = status?.endpoint;
101881
- if (!status?.connected || !endpoint || endpoint.protocol !== "https" || endpoint.url.length === 0) return "";
101882
- return this.normaliseHubUrl(endpoint.url);
101883
- } catch (err) {
101884
- this.ctx.logger.debug("export-alexa: networkAccess.getStatus failed", { meta: { error: errMsg$1(err) } });
101885
- return "";
101886
- }
101887
- }
101888
- /**
101889
- * Boot-time best-effort: default the external address to the first
101890
- * detected endpoint when the operator hasn't chosen one. The picker reads
101891
- * its options live, so nothing is cached here.
101892
- */
101893
- async autoDetectPublicHubUrl() {
101894
- if (this.config.publicHubUrl) return;
101895
- const defaulted = (await this.resolveEndpoints())[0];
101896
- if (defaulted) {
101897
- await this.updateGlobalSettings({ publicHubUrl: defaulted });
101898
- this.ctx.logger.info("export-alexa: defaulted public hub URL to first external address", { meta: { url: defaulted } });
101899
- }
101900
- }
101901
- /**
101902
- * Re-scan the connected `network-access` providers and keep the
101903
- * operator's current selection when it's still present (otherwise default
101904
- * to the first). Runs when a tunnel connects and behind the
101905
- * `/admin/redetect-hub-url` route. Returns the URL we landed on (empty
101906
- * string when nothing is connected).
101907
- */
101908
- async redetectPublicHubUrl() {
101909
- const endpoints = await this.resolveEndpoints();
101910
- const publicHubUrl = this.config.publicHubUrl.length > 0 && endpoints.includes(this.config.publicHubUrl) ? this.config.publicHubUrl : endpoints[0] ?? "";
101911
- if (publicHubUrl !== this.config.publicHubUrl) await this.updateGlobalSettings({ publicHubUrl });
101912
- return { publicHubUrl };
101913
- }
101914
- /**
101915
102634
  * Rotate the ingress token, invalidating the old value. The operator must
101916
102635
  * paste the new token into their Lambda's HUB_INGRESS_TOKEN env afterwards.
101917
102636
  * Backs the "Regenerate token" settings button.
@@ -101922,9 +102641,6 @@ var ExportAlexaAddon = class extends BaseAddon {
101922
102641
  this.ctx.logger.info("export-alexa: regenerated ingress token");
101923
102642
  return { ingressToken };
101924
102643
  }
101925
- normaliseHubUrl(raw) {
101926
- return raw.replace(/\/+$/, "");
101927
- }
101928
102644
  /**
101929
102645
  * Build the generic `device-export` `setup` block surfaced via
101930
102646
  * `getStatus` and rendered by the shared `DeviceExportPanel`: the
@@ -101932,30 +102648,13 @@ var ExportAlexaAddon = class extends BaseAddon {
101932
102648
  * from the public hub URL, and the linked-account count. Each row
101933
102649
  * gets a copy button in the panel; the secret rows are masked.
101934
102650
  */
101935
- buildSetupBlock() {
102651
+ async buildSetupBlock() {
101936
102652
  return buildAlexaSetupBlock({
101937
- publicHubUrl: this.config.publicHubUrl,
102653
+ publicEndpoint: await this.publicEndpoint(),
101938
102654
  ingressToken: this.config.ingressToken,
101939
102655
  skillMode: this.config.skillMode
101940
102656
  });
101941
102657
  }
101942
- /**
101943
- * The "External address" picker's options, read live: every HTTPS endpoint
101944
- * the connected remote-access providers report now, plus the saved choice
101945
- * when it is not among them, so a manual pick is never dropped from view.
101946
- */
101947
- async listExternalAddresses() {
101948
- const detected = await this.resolveEndpoints();
101949
- const current = this.config.publicHubUrl;
101950
- const addresses = detected.map((url) => ({
101951
- value: url,
101952
- label: url
101953
- }));
101954
- return { addresses: current.length > 0 && !detected.includes(current) ? [...addresses, {
101955
- value: current,
101956
- label: `${current} (not detected now)`
101957
- }] : addresses };
101958
- }
101959
102658
  /** The settings page: see `settings-schema.ts` for its layout. The account-
101960
102659
  * linking rows live in the `device-export` setup block instead. */
101961
102660
  globalSettingsSchema() {