@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.
@@ -820,7 +820,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
820
820
  return EventCategory;
821
821
  }({});
822
822
  //#endregion
823
- //#region ../types/dist/device-type-BOWLtoOt.mjs
823
+ //#region ../types/dist/device-type-CfHw_quR.mjs
824
824
  /**
825
825
  import { errMsg } from '@camstack/types'
826
826
  * Extract a human-readable message from an unknown error value.
@@ -1009,6 +1009,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1009
1009
  DeviceFeature["CoverPositionable"] = "cover-positionable";
1010
1010
  /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
1011
1011
  DeviceFeature["CoverTilt"] = "cover-tilt";
1012
+ /** Cover has a real stop: `stop` halts the travel in place. Gates the stop
1013
+ * control in exporters; a provider whose `stop` is a no-op never declares it. */
1014
+ DeviceFeature["CoverStoppable"] = "cover-stoppable";
1012
1015
  /** Valve exposes intermediate position control (0..100). Gates the
1013
1016
  * position slider / drag surface UI. */
1014
1017
  DeviceFeature["ValvePositionable"] = "valve-positionable";
@@ -5874,7 +5877,7 @@ var ZodIssueCode = {
5874
5877
  var ZodFirstPartyTypeKind;
5875
5878
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5876
5879
  //#endregion
5877
- //#region ../types/dist/sleep-_4vKNWxb.mjs
5880
+ //#region ../types/dist/sleep-hmSP-eJt.mjs
5878
5881
  /**
5879
5882
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5880
5883
  * window to float samples (D455).
@@ -5991,7 +5994,7 @@ function isKeychainStoredField(field) {
5991
5994
  var SECRET_CLEAR = { $secretClear: true };
5992
5995
  /** The `'***'` token D634 redaction writes for non-admins. */
5993
5996
  var LEGACY_DEVICE_REDACTION = "***";
5994
- function isRecord$6(value) {
5997
+ function isRecord$7(value) {
5995
5998
  return typeof value === "object" && value !== null && !Array.isArray(value);
5996
5999
  }
5997
6000
  function makeSecretMarker(ref) {
@@ -6002,12 +6005,12 @@ function makeSecretMarker(ref) {
6002
6005
  }
6003
6006
  /** A stored marker: an object whose `$secret` is a non-empty string. */
6004
6007
  function isSecretMarker(value) {
6005
- if (!isRecord$6(value)) return false;
6008
+ if (!isRecord$7(value)) return false;
6006
6009
  const ref = value["$secret"];
6007
6010
  return typeof ref === "string" && ref.length > 0;
6008
6011
  }
6009
6012
  function isSecretClear(value) {
6010
- return isRecord$6(value) && value["$secretClear"] === true;
6013
+ return isRecord$7(value) && value["$secretClear"] === true;
6011
6014
  }
6012
6015
  /**
6013
6016
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6390,6 +6393,53 @@ function emitReadiness(bus, params) {
6390
6393
  ts
6391
6394
  }));
6392
6395
  }
6396
+ /** Why a catalogue entry is not a runnable body of its declared kind. */
6397
+ var AddonMigrationDefinitionError = class extends Error {
6398
+ id;
6399
+ constructor(id, message) {
6400
+ super(`${id}: ${message}`);
6401
+ this.id = id;
6402
+ this.name = "AddonMigrationDefinitionError";
6403
+ }
6404
+ };
6405
+ /**
6406
+ * Bind a catalogue to the addon's ports. Throws {@link AddonMigrationDefinitionError} when
6407
+ * an entry's `bodyKind` does not match the body it carries, or is `sql` (a hub-only
6408
+ * body). A throwing body never escapes `execute`: it is reported as a failed result.
6409
+ */
6410
+ function defineAddonMigrations(catalogue, ports) {
6411
+ return catalogue.map((entry) => {
6412
+ const { meta } = entry;
6413
+ if ("plan" in entry) {
6414
+ if (meta.bodyKind !== "plan") throw new AddonMigrationDefinitionError(meta.id, `carries a plan body but declares "${meta.bodyKind}"`);
6415
+ return {
6416
+ meta,
6417
+ execute: () => guarded(async () => ({
6418
+ kind: "plan",
6419
+ plan: await entry.plan(ports)
6420
+ }))
6421
+ };
6422
+ }
6423
+ if (meta.bodyKind !== "procedure") throw new AddonMigrationDefinitionError(meta.id, `carries a procedure body but declares "${meta.bodyKind}"`);
6424
+ return {
6425
+ meta,
6426
+ execute: () => guarded(async () => ({
6427
+ kind: "procedure",
6428
+ result: await entry.procedure(ports)
6429
+ }))
6430
+ };
6431
+ });
6432
+ }
6433
+ async function guarded(work) {
6434
+ try {
6435
+ return await work();
6436
+ } catch (err) {
6437
+ return {
6438
+ kind: "failed",
6439
+ error: errMsg$1(err)
6440
+ };
6441
+ }
6442
+ }
6393
6443
  var NOT_RUN = {
6394
6444
  declared: false,
6395
6445
  snapshot: null,
@@ -6713,7 +6763,7 @@ var KeychainWriteRefusedError = class extends Error {
6713
6763
  }
6714
6764
  };
6715
6765
  var KEEP = { kind: "keep" };
6716
- function isRecord$5(value) {
6766
+ function isRecord$6(value) {
6717
6767
  return typeof value === "object" && value !== null && !Array.isArray(value);
6718
6768
  }
6719
6769
  function defaultMintId() {
@@ -6726,7 +6776,7 @@ function collectSecretMarkerRefs(value, out = []) {
6726
6776
  return out;
6727
6777
  }
6728
6778
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6729
- else if (isRecord$5(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6779
+ else if (isRecord$6(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6730
6780
  return out;
6731
6781
  }
6732
6782
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6781,7 +6831,7 @@ function rowId(row, idKey) {
6781
6831
  return null;
6782
6832
  }
6783
6833
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6784
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$5) : [];
6834
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$6) : [];
6785
6835
  if (!Array.isArray(incoming)) {
6786
6836
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6787
6837
  return {
@@ -6797,7 +6847,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6797
6847
  const kept = /* @__PURE__ */ new Set();
6798
6848
  const rows = [];
6799
6849
  for (const row of incoming) {
6800
- if (!isRecord$5(row)) {
6850
+ if (!isRecord$6(row)) {
6801
6851
  rows.push(row);
6802
6852
  continue;
6803
6853
  }
@@ -6822,7 +6872,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6822
6872
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6823
6873
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6824
6874
  case "object": {
6825
- if (!isRecord$5(incoming)) {
6875
+ if (!isRecord$6(incoming)) {
6826
6876
  if (incoming === void 0) return KEEP;
6827
6877
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6828
6878
  return {
@@ -6830,7 +6880,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6830
6880
  value: incoming
6831
6881
  };
6832
6882
  }
6833
- const storedObj = isRecord$5(stored) ? stored : {};
6883
+ const storedObj = isRecord$6(stored) ? stored : {};
6834
6884
  return {
6835
6885
  kind: "value",
6836
6886
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6953,7 +7003,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6953
7003
  value: items
6954
7004
  };
6955
7005
  }
6956
- if (isRecord$5(v)) {
7006
+ if (isRecord$6(v)) {
6957
7007
  const out = {};
6958
7008
  for (const [k, child] of Object.entries(v)) {
6959
7009
  const s = substitute(child);
@@ -6985,7 +7035,7 @@ var SecretOverwriteRefusedError = class extends Error {
6985
7035
  this.name = "SecretOverwriteRefusedError";
6986
7036
  }
6987
7037
  };
6988
- function isRecord$4(value) {
7038
+ function isRecord$5(value) {
6989
7039
  return typeof value === "object" && value !== null && !Array.isArray(value);
6990
7040
  }
6991
7041
  function resolvedValue(pass, marker) {
@@ -7014,7 +7064,7 @@ function inArray(pass, incoming, stored) {
7014
7064
  return incoming.map((item, index) => {
7015
7065
  const twin = stored[index];
7016
7066
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
7017
- if (isRecord$4(item) && isRecord$4(twin)) return inArrayRow(pass, item, twin);
7067
+ if (isRecord$5(item) && isRecord$5(twin)) return inArrayRow(pass, item, twin);
7018
7068
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
7019
7069
  return item;
7020
7070
  });
@@ -7025,7 +7075,7 @@ function inArrayRow(pass, incoming, stored) {
7025
7075
  const twin = stored[key];
7026
7076
  if (isSecretMarker(twin)) {
7027
7077
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
7028
- } else if (isRecord$4(value) && isRecord$4(twin)) out[key] = inArrayRow(pass, value, twin);
7078
+ } else if (isRecord$5(value) && isRecord$5(twin)) out[key] = inArrayRow(pass, value, twin);
7029
7079
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
7030
7080
  }
7031
7081
  return out;
@@ -7033,7 +7083,7 @@ function inArrayRow(pass, incoming, stored) {
7033
7083
  async function walk(pass, incoming, stored) {
7034
7084
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
7035
7085
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
7036
- if (!isRecord$4(incoming) || !isRecord$4(stored)) return incoming;
7086
+ if (!isRecord$5(incoming) || !isRecord$5(stored)) return incoming;
7037
7087
  const out = { ...incoming };
7038
7088
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
7039
7089
  return out;
@@ -7064,7 +7114,7 @@ async function restoreUnchangedSecrets(input) {
7064
7114
  function isJsonEqual(a, b) {
7065
7115
  if (Object.is(a, b)) return true;
7066
7116
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
7067
- if (isRecord$4(a) && isRecord$4(b)) {
7117
+ if (isRecord$5(a) && isRecord$5(b)) {
7068
7118
  const keys = Object.keys(a);
7069
7119
  if (keys.length !== Object.keys(b).length) return false;
7070
7120
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -7088,7 +7138,7 @@ function markerKeysOf(blob, owner) {
7088
7138
  }
7089
7139
  function nodeFromStored(value, owner) {
7090
7140
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
7091
- if (!isRecord$4(value)) return null;
7141
+ if (!isRecord$5(value)) return null;
7092
7142
  const children = /* @__PURE__ */ new Map();
7093
7143
  for (const [key, child] of Object.entries(value)) {
7094
7144
  const node = nodeFromStored(child, owner);
@@ -7707,6 +7757,44 @@ var BaseAddon = class {
7707
7757
  return null;
7708
7758
  }
7709
7759
  /**
7760
+ * D986 scoped settings: the form shape of the CLUSTER-wide settings one capability this addon
7761
+ * provides owns, or `null` when it has none. `cap` is a capability name the addon's manifest
7762
+ * declares. Stored as `addon-settings` rows `<addonId>.<field>`. The keys of this schema, of
7763
+ * {@link nodeSettingsSchema} and of {@link deviceDefaultsSchema} are disjoint, and a key never
7764
+ * contains `@` (guard `check-scoped-settings-declared`). SHAPE only: values are read by scope.
7765
+ */
7766
+ async clusterSettingsSchema(_cap) {
7767
+ return null;
7768
+ }
7769
+ /**
7770
+ * D986: the form shape of the settings one capability owns PER NODE, or `null`. Stored as
7771
+ * `addon-settings` rows `<addonId>.<field>@<nodeId>` carrying `nodeId` in the row data, so a
7772
+ * forgotten node's rows go in one central delete.
7773
+ */
7774
+ async nodeSettingsSchema(_cap) {
7775
+ return null;
7776
+ }
7777
+ /**
7778
+ * D986: the form shape of the FLEET DEFAULTS of the per-device settings one capability owns,
7779
+ * or `null`. Stored as `addon-settings` rows `<addonId>.<field>`; a device resolves its value
7780
+ * as device row, then this default, then the schema default (`resolveDeviceSettings`).
7781
+ */
7782
+ async deviceDefaultsSchema(_cap) {
7783
+ return null;
7784
+ }
7785
+ /**
7786
+ * The host's read of the scoped declarations: the schema one capability declares for `scope`,
7787
+ * or `null`. Beside {@link getIntegrationFormSchema}, the same shape: the hook is protected, the
7788
+ * host asks this method.
7789
+ */
7790
+ async getScopedSettingsSchema(scope, cap) {
7791
+ switch (scope) {
7792
+ case "cluster": return this.clusterSettingsSchema(cap);
7793
+ case "node": return this.nodeSettingsSchema(cap);
7794
+ case "device-defaults": return this.deviceDefaultsSchema(cap);
7795
+ }
7796
+ }
7797
+ /**
7710
7798
  * What the create wizard and the integration edit page render for one instance: the addon's
7711
7799
  * per-instance schema when it declares one, else its global schema (what they always showed).
7712
7800
  */
@@ -8500,6 +8588,21 @@ function normalizeAddonInitResult(result) {
8500
8588
  if (Array.isArray(result)) return { providers: result };
8501
8589
  return result;
8502
8590
  }
8591
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8592
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
8593
+ var RECORD_DATABASES = ["settings", "events"];
8594
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8595
+ var RECORD_CLASSES = [
8596
+ "config",
8597
+ "ledger",
8598
+ "audit",
8599
+ "mirror",
8600
+ "ephemeral"
8601
+ ];
8602
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8603
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8604
+ var RECORD_BATCH_MAX = 1e3;
8605
+ var RECORD_QUERY_MAX = 1e3;
8503
8606
  /**
8504
8607
  * The share-view scope kinds a share-link token can carry. The hub mints
8505
8608
  * and validates them (`ShareViewGrantSchema` builds its
@@ -8524,21 +8627,6 @@ var PeerBytesTicketSchema = object({
8524
8627
  */
8525
8628
  declaredBytes: number().int().nonnegative().nullable()
8526
8629
  });
8527
- /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8528
- /** The files a kind may live in. `history` is device-history's (D850), never records. */
8529
- var RECORD_DATABASES = ["settings", "events"];
8530
- /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8531
- var RECORD_CLASSES = [
8532
- "config",
8533
- "ledger",
8534
- "audit",
8535
- "mirror",
8536
- "ephemeral"
8537
- ];
8538
- var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8539
- var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8540
- var RECORD_BATCH_MAX = 1e3;
8541
- var RECORD_QUERY_MAX = 1e3;
8542
8630
  /**
8543
8631
  * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8544
8632
  * Zod row schema that describes it, and the helper that turns the two into the
@@ -9279,6 +9367,7 @@ var CAP_NAMES = Object.freeze([
9279
9367
  "backup",
9280
9368
  "battery",
9281
9369
  "binary",
9370
+ "board-key-source",
9282
9371
  "brightness",
9283
9372
  "broker",
9284
9373
  "button",
@@ -9321,6 +9410,7 @@ var CAP_NAMES = Object.freeze([
9321
9410
  "device-status",
9322
9411
  "dishwasher",
9323
9412
  "display-palette",
9413
+ "do-not-disturb",
9324
9414
  "doorbell",
9325
9415
  "embedding-encoder",
9326
9416
  "enum-sensor",
@@ -9341,6 +9431,7 @@ var CAP_NAMES = Object.freeze([
9341
9431
  "humidity-sensor",
9342
9432
  "image",
9343
9433
  "image-settings",
9434
+ "integration-instances",
9344
9435
  "integrations",
9345
9436
  "intercom",
9346
9437
  "ir-transmitter",
@@ -9398,6 +9489,7 @@ var CAP_NAMES = Object.freeze([
9398
9489
  "privacy-mask",
9399
9490
  "ptz",
9400
9491
  "ptz-autotrack",
9492
+ "pump-cycle",
9401
9493
  "reboot",
9402
9494
  "record-entries",
9403
9495
  "recording",
@@ -10080,6 +10172,10 @@ Object.freeze({
10080
10172
  "valueType": "string"
10081
10173
  }
10082
10174
  ],
10175
+ "do-not-disturb": [{
10176
+ "path": "enabled",
10177
+ "valueType": "boolean"
10178
+ }],
10083
10179
  "doorbell": [{
10084
10180
  "path": "lastPressedAt",
10085
10181
  "valueType": "number"
@@ -10686,18 +10782,6 @@ Object.freeze({
10686
10782
  "path": "pumpRunning",
10687
10783
  "valueType": "boolean"
10688
10784
  },
10689
- {
10690
- "path": "pumpIntervalEnabled",
10691
- "valueType": "boolean"
10692
- },
10693
- {
10694
- "path": "pumpOnTime",
10695
- "valueType": "number"
10696
- },
10697
- {
10698
- "path": "pumpOffTime",
10699
- "valueType": "number"
10700
- },
10701
10785
  {
10702
10786
  "path": "lastDrink",
10703
10787
  "valueType": "number"
@@ -10821,6 +10905,20 @@ Object.freeze({
10821
10905
  "valueType": "number"
10822
10906
  }
10823
10907
  ],
10908
+ "pump-cycle": [
10909
+ {
10910
+ "path": "enabled",
10911
+ "valueType": "boolean"
10912
+ },
10913
+ {
10914
+ "path": "onTime",
10915
+ "valueType": "number"
10916
+ },
10917
+ {
10918
+ "path": "offTime",
10919
+ "valueType": "number"
10920
+ }
10921
+ ],
10824
10922
  "recording-archive": [
10825
10923
  {
10826
10924
  "path": "deviceId",
@@ -11270,7 +11368,7 @@ object({
11270
11368
  params: record(string(), union([string(), number()])).optional()
11271
11369
  });
11272
11370
  //#endregion
11273
- //#region ../types/dist/composition-kKKOdFIG.mjs
11371
+ //#region ../types/dist/composition-Dh3RfMx5.mjs
11274
11372
  /**
11275
11373
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11276
11374
  *
@@ -12484,6 +12582,73 @@ var NodeColorIdSchema = _enum([
12484
12582
  "node-g",
12485
12583
  "node-h"
12486
12584
  ]);
12585
+ //#endregion
12586
+ //#region ../types/dist/index.mjs
12587
+ var SMTP_INBOUND_DEFAULT_PORT = 2525;
12588
+ var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
12589
+ var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
12590
+ /** The text excerpt a message carries on the bus. */
12591
+ var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
12592
+ var PortSchema = number().int().min(1).max(65535);
12593
+ /** A recipient local-part: what stands before the `@`. */
12594
+ var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
12595
+ object({
12596
+ port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
12597
+ bindHost: string().min(1).default("0.0.0.0"),
12598
+ domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
12599
+ requireAuth: boolean().default(true),
12600
+ username: string().default(""),
12601
+ password: string().default("").meta({ secret: true }),
12602
+ starttls: boolean().default(false),
12603
+ maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
12604
+ });
12605
+ object({
12606
+ host: string().min(1).nullable(),
12607
+ hostReason: string().nullable(),
12608
+ port: PortSchema,
12609
+ domain: string().min(1),
12610
+ requireAuth: boolean(),
12611
+ username: string(),
12612
+ password: string(),
12613
+ starttls: boolean()
12614
+ });
12615
+ object({
12616
+ recipients: array(SmtpRecipientSchema).min(1),
12617
+ /**
12618
+ * Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
12619
+ * recipients (the way a consumer that restarted, or lost a device, declares its set again);
12620
+ * a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
12621
+ * Absent, the subscriber is anonymous and unique.
12622
+ */
12623
+ subscriberId: string().min(1).max(64).optional()
12624
+ });
12625
+ var SmtpInboundAttachmentSchema = object({
12626
+ filename: string(),
12627
+ contentType: string(),
12628
+ bytes: number().int().nonnegative()
12629
+ });
12630
+ /** The payload of one `broker.message` (the key is the recipient local-part). */
12631
+ var SmtpInboundMessageSchema = object({
12632
+ /** Monotonic per mailbox; a gap tells a consumer it missed an event. */
12633
+ seq: number().int().positive(),
12634
+ messageId: string(),
12635
+ receivedAt: number().int().nonnegative(),
12636
+ from: string(),
12637
+ to: string(),
12638
+ subject: string(),
12639
+ text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
12640
+ attachments: array(SmtpInboundAttachmentSchema)
12641
+ });
12642
+ object({
12643
+ /** The newest seq issued so far (0 before any mail). */
12644
+ lastSeq: number().int().nonnegative(),
12645
+ /** The oldest seq still retained; messages below it are gone. */
12646
+ oldestSeq: number().int().nonnegative(),
12647
+ messages: array(object({
12648
+ key: string(),
12649
+ message: SmtpInboundMessageSchema
12650
+ }))
12651
+ });
12487
12652
  new Set([
12488
12653
  "track",
12489
12654
  "face",
@@ -13747,6 +13912,16 @@ var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
13747
13912
  precondition: PreconditionSchema
13748
13913
  })
13749
13914
  ])) });
13915
+ /** `JSON.stringify` with object keys sorted, so equal values spell the same. */
13916
+ function canonicalJson(value) {
13917
+ if (Array.isArray(value)) return `[${value.map((item) => canonicalJson(item)).join(",")}]`;
13918
+ 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(",")}}`;
13919
+ return JSON.stringify(value) ?? "null";
13920
+ }
13921
+ /** The precondition string for a value a plan read (`null` when it read nothing). */
13922
+ function preconditionOf(value) {
13923
+ return canonicalJson(value ?? null);
13924
+ }
13750
13925
  /**
13751
13926
  * What a `procedure` body reports. `already-done` means the rerun observed the
13752
13927
  * work finished (a crash between the work and the ledger row, or a manual fix)
@@ -15695,8 +15870,18 @@ var LogChannelDescriptorSchema = object({
15695
15870
  * the operator narrows to one camera, sees nothing, and concludes the code
15696
15871
  * path was never taken.
15697
15872
  */
15698
- perDevice: boolean()
15699
- });
15873
+ perDevice: boolean(),
15874
+ /**
15875
+ * What the channel is FOR, so the UI can list the channels an addon offers.
15876
+ *
15877
+ * - `diagnostic` (the default): a per-component diagnostic armed from the
15878
+ * Levels page, emitted at its declared level.
15879
+ * - `debug`: a `debug.<channel>` dump watched live for a short window
15880
+ * (`ctx.debug`). Always per-device, and its lines are denied by the log
15881
+ * ring unless somebody is watching that device.
15882
+ */
15883
+ kind: _enum(["diagnostic", "debug"]).default("diagnostic")
15884
+ }).refine((d) => d.kind !== "debug" || d.name.startsWith("debug.") && d.perDevice, { message: "a debug channel is named debug.<channel> and is per-device" });
15700
15885
  /**
15701
15886
  * An armed window over one channel, as the document hands it to a mirror.
15702
15887
  *
@@ -19033,24 +19218,52 @@ var APPLIANCE_CAP_VOCABULARY = {
19033
19218
  args: { on: false }
19034
19219
  },
19035
19220
  {
19036
- id: "petFountain.intervalOn",
19037
- method: "setPumpInterval",
19221
+ id: "petFountain.resetDailyConsumption",
19222
+ method: "resetDailyConsumption",
19223
+ label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
19224
+ phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
19225
+ icon: "rotate-ccw"
19226
+ }
19227
+ ],
19228
+ state: [{
19229
+ kind: "boolean",
19230
+ field: "empty",
19231
+ label: t("Tank empty", "Serbatoio vuoto"),
19232
+ whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
19233
+ whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
19234
+ icon: "droplet"
19235
+ }, {
19236
+ kind: "numeric",
19237
+ field: "waterLevel",
19238
+ quantity: t("the water level", "il livello dell’acqua"),
19239
+ label: t("Water level", "Livello dell’acqua"),
19240
+ unit: "%",
19241
+ icon: "droplets"
19242
+ }]
19243
+ },
19244
+ "pump-cycle": {
19245
+ scope: "device",
19246
+ noun: t("Pump cycle", "Ciclo della pompa"),
19247
+ actions: [
19248
+ {
19249
+ id: "pumpCycle.on",
19250
+ method: "setEnabled",
19038
19251
  label: t("Pump cycle on", "Ciclo pompa attivo"),
19039
19252
  phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
19040
19253
  icon: "timer",
19041
19254
  args: { on: true }
19042
19255
  },
19043
19256
  {
19044
- id: "petFountain.intervalOff",
19045
- method: "setPumpInterval",
19257
+ id: "pumpCycle.off",
19258
+ method: "setEnabled",
19046
19259
  label: t("Pump cycle off", "Ciclo pompa spento"),
19047
19260
  phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
19048
19261
  icon: "timer-off",
19049
19262
  args: { on: false }
19050
19263
  },
19051
19264
  {
19052
- id: "petFountain.pumpOnMinutes",
19053
- method: "setPumpOnMinutes",
19265
+ id: "pumpCycle.onMinutes",
19266
+ method: "setOnMinutes",
19054
19267
  label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
19055
19268
  phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
19056
19269
  icon: "timer",
@@ -19066,8 +19279,8 @@ var APPLIANCE_CAP_VOCABULARY = {
19066
19279
  }]
19067
19280
  },
19068
19281
  {
19069
- id: "petFountain.pumpOffMinutes",
19070
- method: "setPumpOffMinutes",
19282
+ id: "pumpCycle.offMinutes",
19283
+ method: "setOffMinutes",
19071
19284
  label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
19072
19285
  phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
19073
19286
  icon: "timer-off",
@@ -19081,29 +19294,15 @@ var APPLIANCE_CAP_VOCABULARY = {
19081
19294
  unit: "min"
19082
19295
  }
19083
19296
  }]
19084
- },
19085
- {
19086
- id: "petFountain.resetDailyConsumption",
19087
- method: "resetDailyConsumption",
19088
- label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
19089
- phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
19090
- icon: "rotate-ccw"
19091
19297
  }
19092
19298
  ],
19093
19299
  state: [{
19094
19300
  kind: "boolean",
19095
- field: "empty",
19096
- label: t("Tank empty", "Serbatoio vuoto"),
19097
- whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
19098
- whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
19099
- icon: "droplet"
19100
- }, {
19101
- kind: "numeric",
19102
- field: "waterLevel",
19103
- quantity: t("the water level", "il livello dell’acqua"),
19104
- label: t("Water level", "Livello dell’acqua"),
19105
- unit: "%",
19106
- icon: "droplets"
19301
+ field: "enabled",
19302
+ label: t("Pump cycle", "Ciclo pompa"),
19303
+ whenTrue: t("When {device} starts running its pump on a cycle", "Quando {device} inizia a far lavorare la pompa a ciclo"),
19304
+ whenFalse: t("When {device} runs its pump continuously", "Quando {device} fa lavorare la pompa in continuo"),
19305
+ icon: "timer"
19107
19306
  }]
19108
19307
  },
19109
19308
  "media-player": {
@@ -19789,6 +19988,33 @@ var APPLIANCE_CAP_VOCABULARY = {
19789
19988
  }
19790
19989
  ]
19791
19990
  },
19991
+ "do-not-disturb": {
19992
+ scope: "device",
19993
+ noun: t("Do not disturb", "Non disturbare"),
19994
+ actions: [{
19995
+ id: "dnd.on",
19996
+ method: "setEnabled",
19997
+ label: t("Do not disturb on", "Attiva Non disturbare"),
19998
+ phrase: t("Turn on Do not disturb on {device}", "Attiva Non disturbare su {device}"),
19999
+ icon: "bell-off",
20000
+ args: { enabled: true }
20001
+ }, {
20002
+ id: "dnd.off",
20003
+ method: "setEnabled",
20004
+ label: t("Do not disturb off", "Disattiva Non disturbare"),
20005
+ phrase: t("Turn off Do not disturb on {device}", "Disattiva Non disturbare su {device}"),
20006
+ icon: "bell",
20007
+ args: { enabled: false }
20008
+ }],
20009
+ state: [{
20010
+ kind: "boolean",
20011
+ field: "enabled",
20012
+ label: t("Do not disturb", "Non disturbare"),
20013
+ whenTrue: t("When Do not disturb turns on on {device}", "Quando {device} attiva Non disturbare"),
20014
+ whenFalse: t("When Do not disturb turns off on {device}", "Quando {device} disattiva Non disturbare"),
20015
+ icon: "bell-off"
20016
+ }]
20017
+ },
19792
20018
  update: {
19793
20019
  scope: "device",
19794
20020
  noun: t("Firmware update", "Aggiornamento firmware"),
@@ -20969,6 +21195,7 @@ var SYSTEM_CAP_VOCABULARY = {
20969
21195
  "audio-analyzer": system(PIPELINE),
20970
21196
  "audio-codec": system(INTERNAL),
20971
21197
  "auth-provider": system(IDENTITY),
21198
+ "board-key-source": system(INTERNAL),
20972
21199
  backup: system("system backups — run and restored from the Backups page"),
20973
21200
  broker: system("message-broker connections — configured, not actuated"),
20974
21201
  "calendar-source": system(INTERNAL),
@@ -21003,6 +21230,7 @@ var SYSTEM_CAP_VOCABULARY = {
21003
21230
  "load-contribution": system(INTERNAL),
21004
21231
  "local-network": system(NETWORK),
21005
21232
  "log-channels": system(INTERNAL),
21233
+ "integration-instances": system(INTERNAL),
21006
21234
  "log-destination": system(INTERNAL),
21007
21235
  "login-method": system(IDENTITY),
21008
21236
  "mesh-network": system(NETWORK),
@@ -41845,14 +42073,16 @@ var DeviceIsLeafSchema = object({
41845
42073
  });
41846
42074
  /**
41847
42075
  * True when the camera currently has a PARKED object matching `subjects` in at
41848
- * least one of `zones`. Reads the zone-analytics snapshot through the same
42076
+ * least one of `zones` (`minCount` of them, default one). Reads the zone-analytics snapshot through the same
41849
42077
  * mirror as every other state leaf, so a dropped event never decides it (D49).
41850
42078
  */
41851
42079
  var StationaryPresentLeafSchema = object({
41852
42080
  kind: literal("stationary-present"),
41853
42081
  deviceId: number().int().nonnegative(),
41854
42082
  subjects: array(StationarySubjectSchema).min(1).optional(),
41855
- zones: array(string().min(1)).min(1).optional()
42083
+ zones: array(string().min(1)).min(1).optional(),
42084
+ /** How many matching parked objects must be there; absent means one. */
42085
+ minCount: number().int().positive().optional()
41856
42086
  });
41857
42087
  /**
41858
42088
  * The escape hatch: the bounded expression engine over named device bindings.
@@ -42364,6 +42594,28 @@ function convertLegacyRecipe(legacy) {
42364
42594
  * it. The output type is always the new one.
42365
42595
  */
42366
42596
  var AutomationRecipeSchema = union([CurrentAutomationRecipeSchema, LegacyAutomationRecipeSchema.transform(convertLegacyRecipe)]);
42597
+ var DETECTION_DESCRIPTIONS = {
42598
+ deviceId: "the camera that saw it",
42599
+ className: "what it saw",
42600
+ trackId: "the track",
42601
+ score: "how sure the detector was",
42602
+ label: "the label it matched (a name, a plate), empty when none"
42603
+ };
42604
+ var STATIONARY_DESCRIPTIONS = {
42605
+ deviceId: "the camera that saw it",
42606
+ className: "what it saw",
42607
+ zones: "the zones it is in",
42608
+ phase: "appeared or departed",
42609
+ entryId: "the stopped object"
42610
+ };
42611
+ function describe$1(descriptions) {
42612
+ return Object.entries(descriptions).map(([name, description]) => ({
42613
+ name,
42614
+ description
42615
+ }));
42616
+ }
42617
+ describe$1(DETECTION_DESCRIPTIONS);
42618
+ describe$1(STATIONARY_DESCRIPTIONS);
42367
42619
  new Set(Object.values(COCO_TO_MACRO.mapping));
42368
42620
  /**
42369
42621
  * Schedulers (D983) — an entity that performs actions over the day.
@@ -43125,7 +43377,7 @@ var TargetKindCapsSchema = object({
43125
43377
  * the union is large and not meant for runtime validation here; the exported
43126
43378
  * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
43127
43379
  */
43128
- var ConfigSchemaPassthrough$3 = unknown();
43380
+ var ConfigSchemaPassthrough$4 = unknown();
43129
43381
  var TargetKindSchema = object({
43130
43382
  kind: string(),
43131
43383
  label: string(),
@@ -43162,7 +43414,7 @@ var TargetKindSchema = object({
43162
43414
  * its raster path, which is the safe default for an unknown image.
43163
43415
  */
43164
43416
  iconMediaType: string().optional(),
43165
- configSchema: ConfigSchemaPassthrough$3,
43417
+ configSchema: ConfigSchemaPassthrough$4,
43166
43418
  /**
43167
43419
  * The config keys that decide WHERE this kind's secrets are sent (server,
43168
43420
  * base URL, instance, chat, recipient). A save that changes any of them
@@ -45490,6 +45742,49 @@ object({
45490
45742
  });
45491
45743
  DeviceType.Sensor;
45492
45744
  /**
45745
+ * Why a board key could not be read. Typed so a caller reports the cause and
45746
+ * never treats "could not read" as "has no key" (D49).
45747
+ */
45748
+ var BoardKeyFailureReasonSchema = _enum([
45749
+ "unknown-source",
45750
+ "not-admin",
45751
+ "no-builder",
45752
+ "no-ingress-url",
45753
+ "unreachable",
45754
+ "unknown-board",
45755
+ "no-encryption-key",
45756
+ "unreadable-config"
45757
+ ]);
45758
+ var BoardKeySourceSchema = object({
45759
+ sourceId: string(),
45760
+ name: string()
45761
+ });
45762
+ var BoardKeyBoardSchema = object({
45763
+ /** The builder's file name, e.g. `kitchen.yaml`: the handle `getBoardKey` takes. */
45764
+ configuration: string(),
45765
+ /** The node name the builder gives the board. */
45766
+ name: string(),
45767
+ /** The address the builder knows the board by, when it has one. */
45768
+ address: string().nullable()
45769
+ });
45770
+ var BoardKeyFailureSchema = object({
45771
+ ok: literal(false),
45772
+ reason: BoardKeyFailureReasonSchema,
45773
+ detail: string().optional()
45774
+ });
45775
+ var ListBoardsResultSchema = discriminatedUnion("ok", [object({
45776
+ ok: literal(true),
45777
+ boards: array(BoardKeyBoardSchema).readonly()
45778
+ }), BoardKeyFailureSchema]);
45779
+ var GetBoardKeyResultSchema = discriminatedUnion("ok", [object({
45780
+ ok: literal(true),
45781
+ key: string()
45782
+ }), BoardKeyFailureSchema]);
45783
+ method(_void(), array(BoardKeySourceSchema).readonly(), { auth: "admin" }), method(object({ sourceId: string().min(1) }), ListBoardsResultSchema, { auth: "admin" }), method(object({
45784
+ sourceId: string().min(1),
45785
+ configuration: string().min(1)
45786
+ }), GetBoardKeyResultSchema, { auth: "admin" });
45787
+ /**
45493
45788
  * Dimmable-light brightness control. Co-exists with `switch` on the
45494
45789
  * same device — the switch toggles on/off, this cap sets the level
45495
45790
  * applied when the light is on. Drivers map their per-vendor dim
@@ -49597,6 +49892,45 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
49597
49892
  auth: "admin"
49598
49893
  });
49599
49894
  /**
49895
+ * What the passive listener of `local-network` saw on the wire, before any
49896
+ * provider classified it. Device-manager turns an observation into the hits
49897
+ * of the providers whose declared discovery modes it matches.
49898
+ */
49899
+ var DiscoveryObservationSchema = discriminatedUnion("kind", [object({
49900
+ kind: literal("mdns"),
49901
+ /** Normalised DNS-SD service type, e.g. `_esphomelib._tcp`. */
49902
+ serviceType: string(),
49903
+ instance: string(),
49904
+ host: string(),
49905
+ /** The A record address when the announcement carried one. */
49906
+ address: string().nullable(),
49907
+ port: number().int(),
49908
+ txt: record(string(), string())
49909
+ }), object({
49910
+ kind: literal("ssdp"),
49911
+ /** Sender address of the datagram. */
49912
+ host: string(),
49913
+ port: number().int(),
49914
+ /** `NT` of a NOTIFY, `ST` of a search response. */
49915
+ target: string(),
49916
+ headers: record(string(), string())
49917
+ })]);
49918
+ object({
49919
+ addonId: string(),
49920
+ candidate: DiscoveryCandidateSchema,
49921
+ firstSeenAt: number(),
49922
+ lastSeenAt: number(),
49923
+ dismissed: boolean()
49924
+ });
49925
+ var DiscoveryProposalSchema = object({
49926
+ id: string(),
49927
+ addonId: string(),
49928
+ candidate: DiscoveryCandidateSchema,
49929
+ firstSeenAt: number(),
49930
+ lastSeenAt: number(),
49931
+ dismissed: boolean()
49932
+ });
49933
+ /**
49600
49934
  * Device Manager capability — hub-side singleton that unifies device persistence,
49601
49935
  * live registry access, and all management operations into a single tRPC surface.
49602
49936
  *
@@ -50325,6 +50659,19 @@ method(object({
50325
50659
  }), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
50326
50660
  kind: "mutation",
50327
50661
  auth: "admin"
50662
+ }), method(object({}), object({ proposals: array(DiscoveryProposalSchema).readonly() }), { auth: "admin" }), method(object({ id: string() }), object({ dismissed: boolean() }), {
50663
+ kind: "mutation",
50664
+ auth: "admin"
50665
+ }), method(object({ observations: array(DiscoveryObservationSchema).max(512) }), object({ proposed: number().int() }), {
50666
+ kind: "mutation",
50667
+ auth: "admin"
50668
+ }), method(object({}), object({
50669
+ providers: number().int(),
50670
+ proposed: number().int()
50671
+ }), {
50672
+ kind: "mutation",
50673
+ auth: "admin",
50674
+ timeoutMs: 12e4
50328
50675
  }), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
50329
50676
  deviceId: number(),
50330
50677
  key: string(),
@@ -51152,7 +51499,7 @@ object({
51152
51499
  /** Ms epoch of the last value received from the appliance; 0 = never. */
51153
51500
  lastFetchedAt: number()
51154
51501
  });
51155
- var DeviceIdSchema$1 = number().int().nonnegative();
51502
+ var DeviceIdSchema$2 = number().int().nonnegative();
51156
51503
  /** A value a program option or setting can take. */
51157
51504
  var DishwasherValueSchema = union([
51158
51505
  boolean(),
@@ -51216,77 +51563,77 @@ var DishwasherOptionsSchema = object({
51216
51563
  options: array(DishwasherOptionDescriptorSchema)
51217
51564
  });
51218
51565
  DeviceType.Dishwasher, method(object({
51219
- deviceId: DeviceIdSchema$1,
51566
+ deviceId: DeviceIdSchema$2,
51220
51567
  program: string().min(1).optional(),
51221
51568
  options: record(string(), DishwasherValueSchema).optional()
51222
51569
  }), _void(), {
51223
51570
  kind: "mutation",
51224
51571
  auth: "protected"
51225
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51572
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51226
51573
  kind: "mutation",
51227
51574
  auth: "protected"
51228
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51575
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51229
51576
  kind: "mutation",
51230
51577
  auth: "protected"
51231
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51578
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51232
51579
  kind: "mutation",
51233
51580
  auth: "protected"
51234
51581
  }), method(object({
51235
- deviceId: DeviceIdSchema$1,
51582
+ deviceId: DeviceIdSchema$2,
51236
51583
  program: string().min(1)
51237
51584
  }), _void(), {
51238
51585
  kind: "mutation",
51239
51586
  auth: "protected"
51240
51587
  }), method(object({
51241
- deviceId: DeviceIdSchema$1,
51588
+ deviceId: DeviceIdSchema$2,
51242
51589
  on: boolean()
51243
51590
  }), _void(), {
51244
51591
  kind: "mutation",
51245
51592
  auth: "protected"
51246
51593
  }), method(object({
51247
- deviceId: DeviceIdSchema$1,
51594
+ deviceId: DeviceIdSchema$2,
51248
51595
  on: boolean()
51249
51596
  }), _void(), {
51250
51597
  kind: "mutation",
51251
51598
  auth: "protected"
51252
51599
  }), method(object({
51253
- deviceId: DeviceIdSchema$1,
51600
+ deviceId: DeviceIdSchema$2,
51254
51601
  on: boolean()
51255
51602
  }), _void(), {
51256
51603
  kind: "mutation",
51257
51604
  auth: "protected"
51258
51605
  }), method(object({
51259
- deviceId: DeviceIdSchema$1,
51606
+ deviceId: DeviceIdSchema$2,
51260
51607
  on: boolean()
51261
51608
  }), _void(), {
51262
51609
  kind: "mutation",
51263
51610
  auth: "protected"
51264
51611
  }), method(object({
51265
- deviceId: DeviceIdSchema$1,
51612
+ deviceId: DeviceIdSchema$2,
51266
51613
  on: boolean()
51267
51614
  }), _void(), {
51268
51615
  kind: "mutation",
51269
51616
  auth: "protected"
51270
51617
  }), method(object({
51271
- deviceId: DeviceIdSchema$1,
51618
+ deviceId: DeviceIdSchema$2,
51272
51619
  on: boolean()
51273
51620
  }), _void(), {
51274
51621
  kind: "mutation",
51275
51622
  auth: "protected"
51276
51623
  }), method(object({
51277
- deviceId: DeviceIdSchema$1,
51624
+ deviceId: DeviceIdSchema$2,
51278
51625
  on: boolean()
51279
51626
  }), _void(), {
51280
51627
  kind: "mutation",
51281
51628
  auth: "protected"
51282
51629
  }), method(object({
51283
- deviceId: DeviceIdSchema$1,
51630
+ deviceId: DeviceIdSchema$2,
51284
51631
  key: string().min(1),
51285
51632
  value: DishwasherValueSchema
51286
51633
  }), _void(), {
51287
51634
  kind: "mutation",
51288
51635
  auth: "protected"
51289
- }), method(object({ deviceId: DeviceIdSchema$1 }), DishwasherOptionsSchema, { auth: "protected" });
51636
+ }), method(object({ deviceId: DeviceIdSchema$2 }), DishwasherOptionsSchema, { auth: "protected" });
51290
51637
  /**
51291
51638
  * Palette entry ids (D939). Audio is the one gradient; `audio-*` leaves are
51292
51639
  * not entries. `heatmapScrub` is a mark, not an event kind.
@@ -51690,6 +52037,19 @@ method(_void(), paletteResultSchema, {
51690
52037
  kind: "mutation",
51691
52038
  auth: "admin"
51692
52039
  });
52040
+ object({
52041
+ /** True while Do Not Disturb is on; null when unknown. */
52042
+ enabled: boolean().nullable().meta({ label: "Do not disturb" }),
52043
+ /** Ms epoch of the last read or write that set `enabled`. */
52044
+ lastChangedAt: number()
52045
+ });
52046
+ DeviceType.MediaPlayer, method(object({
52047
+ deviceId: number().int(),
52048
+ enabled: boolean()
52049
+ }), _void(), {
52050
+ kind: "mutation",
52051
+ auth: "protected"
52052
+ });
51693
52053
  DeviceType.Camera;
51694
52054
  object({
51695
52055
  /** Ms epoch of the last press. null = never observed since this provider started. */
@@ -52980,6 +53340,89 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
52980
53340
  auth: "admin"
52981
53341
  });
52982
53342
  /**
53343
+ * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
53344
+ * (an account, a relay, a destination) as typed records (D985, D986). The addon's
53345
+ * own function page reads and writes them (Logging for Loki); the Integrations
53346
+ * page lists only the integrations that bring devices (D996).
53347
+ *
53348
+ * A collection of providers: each addon that holds connections registers one and a
53349
+ * caller reaches a provider with the pinned `addonId`.
53350
+ *
53351
+ * Identity: the instance id is immutable and opaque to the caller. A record the
53352
+ * Loki migration made keeps the `integrations` registry id it was created under
53353
+ * (`int_NNNN`); a single instance made by its function page takes the addon id.
53354
+ * `name` is the editable label.
53355
+ *
53356
+ * Secrets: every field the instance kind marks `.meta({ secret: true })` reaches
53357
+ * the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
53358
+ * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
53359
+ * clears it.
53360
+ */
53361
+ var ConfigSchemaPassthrough$3 = custom();
53362
+ var IntegrationInstanceIdSchema = string().min(1);
53363
+ var IntegrationInstanceDescriptionSchema = object({
53364
+ /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
53365
+ instanceMode: _enum(["single", "multiple"]),
53366
+ /** What the instance is, for the UI (`destination`, `relay`, `account`). */
53367
+ kind: string(),
53368
+ /** True when `testInstance` really probes the remote. */
53369
+ canTest: boolean()
53370
+ });
53371
+ var IntegrationInstanceStatusSchema = object({
53372
+ state: _enum([
53373
+ "ok",
53374
+ "off",
53375
+ "error",
53376
+ "unknown"
53377
+ ]),
53378
+ detail: string().optional()
53379
+ });
53380
+ var IntegrationInstanceSchema = object({
53381
+ id: IntegrationInstanceIdSchema,
53382
+ name: string(),
53383
+ /** The addon's own rule (an URL is present, a client id is present...). */
53384
+ configured: boolean(),
53385
+ /**
53386
+ * The instance's own on/off switch (D996): always present, derived from the record body
53387
+ * (`enabled !== false`, so a row written before the field existed is on).
53388
+ */
53389
+ enabled: boolean(),
53390
+ /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
53391
+ formValues: record(string(), unknown()),
53392
+ status: IntegrationInstanceStatusSchema.optional()
53393
+ });
53394
+ var IntegrationInstancePatchSchema = object({
53395
+ id: IntegrationInstanceIdSchema,
53396
+ name: string().min(1).optional(),
53397
+ /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
53398
+ values: record(string(), unknown())
53399
+ });
53400
+ 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({
53401
+ id: IntegrationInstanceIdSchema,
53402
+ name: string().min(1)
53403
+ }), object({ id: string() }), {
53404
+ kind: "mutation",
53405
+ auth: "admin"
53406
+ }), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), {
53407
+ kind: "mutation",
53408
+ auth: "admin"
53409
+ }), method(object({
53410
+ id: IntegrationInstanceIdSchema,
53411
+ enabled: boolean()
53412
+ }), object({ ok: literal(true) }), {
53413
+ kind: "mutation",
53414
+ auth: "admin"
53415
+ }), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
53416
+ kind: "mutation",
53417
+ auth: "admin"
53418
+ }), optionalMethod(object({
53419
+ id: IntegrationInstanceIdSchema.nullable(),
53420
+ values: record(string(), unknown())
53421
+ }), TestConnectionResultSchema$1, {
53422
+ kind: "mutation",
53423
+ auth: "admin"
53424
+ });
53425
+ /**
52983
53426
  * Two-way audio / talk-back cap. Clients open a WebRTC audio-only
52984
53427
  * session (server-initiated offer pattern, identical to the main
52985
53428
  * video WebRTC flow) and the browser captures the mic; the server
@@ -53568,6 +54011,14 @@ var LlmGenerateBaseInputSchema = object({
53568
54011
  topP: number().min(0).max(1).optional(),
53569
54012
  /** Per-call override of the profile default (top-k sampling). */
53570
54013
  topK: number().int().positive().optional(),
54014
+ /** Per-call override of `profile.reasoningEffort`. Sent only to a kind whose
54015
+ * descriptor offers the field; a kind that does not never sends it. */
54016
+ reasoningEffort: _enum([
54017
+ "off",
54018
+ "low",
54019
+ "medium",
54020
+ "high"
54021
+ ]).optional(),
53571
54022
  /** Per-call override of `profile.timeoutMs` — the total generation bound. */
53572
54023
  timeoutMs: number().int().positive().optional(),
53573
54024
  /** Per-call override; beats both the consumer table and the profile. */
@@ -53859,7 +54310,10 @@ var LlmProfileKindSchema = string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/, "a kind i
53859
54310
  var LlmModelFeaturesSchema = object({
53860
54311
  vision: boolean(),
53861
54312
  tools: boolean(),
53862
- streaming: boolean()
54313
+ streaming: boolean(),
54314
+ /** Whether the model thinks before it answers. `null` = the endpoint does not
54315
+ * say; an editor then still offers the switch (unknown is not "no"). */
54316
+ reasoning: boolean().nullable().optional()
53863
54317
  });
53864
54318
  /** One model a provider offers. `features` overrides the kind's defaults, per field. */
53865
54319
  var LlmModelInfoSchema = object({
@@ -63001,7 +63455,14 @@ var NcMediaPolicySchema = object({
63001
63455
  */
63002
63456
  profile: CamProfileSchema.optional(),
63003
63457
  /** See {@link NcLinkedCameraModeSchema}. */
63004
- linkedCameras: NcLinkedCameraModeSchema.optional()
63458
+ linkedCameras: NcLinkedCameraModeSchema.optional(),
63459
+ /**
63460
+ * Sensor rules only: may this rule wake a SLEEPING battery camera to take
63461
+ * the linked still it attaches (D998)? Absent means yes, an explicit `false`
63462
+ * opts out. Deliberately not a Zod default: a rule that never chose keeps
63463
+ * following the hub's. One bounded wake per event; nothing is attached later.
63464
+ */
63465
+ wakeSleepingCamera: boolean().optional()
63005
63466
  });
63006
63467
  /**
63007
63468
  * Cooldown GRANULARITY over the subject's class — how much a fired
@@ -65012,52 +65473,27 @@ object({
65012
65473
  empty: boolean().nullable(),
65013
65474
  /** True while the pump is running. Null while unknown. */
65014
65475
  pumpRunning: boolean().nullable(),
65015
- /** True when the pump works on an on/off duty cycle rather than continuously. */
65016
- pumpIntervalEnabled: boolean().nullable(),
65017
- /** How long the pump runs per cycle, in seconds. */
65018
- pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
65019
- /** How long the pump rests per cycle, in seconds. */
65020
- pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
65021
65476
  /** Water drunk in the last drink, in litres. */
65022
65477
  lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
65023
65478
  /** Water drunk in the current hour, in litres. */
65024
65479
  currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
65025
65480
  /** Water drunk over the last 24 hours (rolling), in litres. */
65026
65481
  last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
65027
- /** Water drunk since local midnight, in litres. */
65482
+ /** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
65028
65483
  todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
65029
65484
  /** Decoded fault message. Null means healthy; a non-null string is an active fault. */
65030
65485
  error: string().nullable(),
65031
65486
  /** Ms epoch when the slice was last refreshed. */
65032
65487
  lastFetchedAt: number()
65033
65488
  });
65034
- var DeviceIdSchema = number().int().nonnegative();
65035
- var MinutesSchema = number().int().min(0);
65489
+ var DeviceIdSchema$1 = number().int().nonnegative();
65036
65490
  DeviceType.PetFountain, method(object({
65037
- deviceId: DeviceIdSchema,
65038
- on: boolean()
65039
- }), _void(), {
65040
- kind: "mutation",
65041
- auth: "protected"
65042
- }), method(object({
65043
- deviceId: DeviceIdSchema,
65491
+ deviceId: DeviceIdSchema$1,
65044
65492
  on: boolean()
65045
65493
  }), _void(), {
65046
65494
  kind: "mutation",
65047
65495
  auth: "protected"
65048
- }), method(object({
65049
- deviceId: DeviceIdSchema,
65050
- minutes: MinutesSchema
65051
- }), _void(), {
65052
- kind: "mutation",
65053
- auth: "protected"
65054
- }), method(object({
65055
- deviceId: DeviceIdSchema,
65056
- minutes: MinutesSchema
65057
- }), _void(), {
65058
- kind: "mutation",
65059
- auth: "protected"
65060
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
65496
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
65061
65497
  kind: "mutation",
65062
65498
  auth: "protected"
65063
65499
  });
@@ -67017,6 +67453,37 @@ DeviceType.Camera, method(object({ deviceId: number() }), PtzAutotrackStatusSche
67017
67453
  deviceId: number(),
67018
67454
  status: PtzAutotrackStatusSchema
67019
67455
  });
67456
+ object({
67457
+ /** True when the pump works on the on/off cycle, false when it runs continuously. Null while unknown. */
67458
+ enabled: boolean().nullable(),
67459
+ /** How long the pump runs per cycle, in seconds. Null while unknown. */
67460
+ onTime: number().min(0).nullable().meta(readingMeta("duration")),
67461
+ /** How long the pump rests per cycle, in seconds. Null while unknown. */
67462
+ offTime: number().min(0).nullable().meta(readingMeta("duration")),
67463
+ /** Ms epoch when the slice was last refreshed. */
67464
+ lastFetchedAt: number()
67465
+ });
67466
+ var DeviceIdSchema = number().int().nonnegative();
67467
+ var MinutesSchema = number().int().min(0);
67468
+ DeviceType.PetFountain, method(object({
67469
+ deviceId: DeviceIdSchema,
67470
+ on: boolean()
67471
+ }), _void(), {
67472
+ kind: "mutation",
67473
+ auth: "protected"
67474
+ }), method(object({
67475
+ deviceId: DeviceIdSchema,
67476
+ minutes: MinutesSchema
67477
+ }), _void(), {
67478
+ kind: "mutation",
67479
+ auth: "protected"
67480
+ }), method(object({
67481
+ deviceId: DeviceIdSchema,
67482
+ minutes: MinutesSchema
67483
+ }), _void(), {
67484
+ kind: "mutation",
67485
+ auth: "protected"
67486
+ });
67020
67487
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
67021
67488
  kind: "mutation",
67022
67489
  auth: "admin"
@@ -70623,9 +71090,17 @@ var ServerUpdateActionResultSchema = object({
70623
71090
  */
70624
71091
  requiredAddonUpdates: array(RequiredAddonUpdateSchema).optional()
70625
71092
  });
70626
- var LaunchOverridesSchema = object({
70627
- /** The persisted heap ceiling in MB, or `null` when none is set. */
70628
- heapMb: number().int().nullable() });
71093
+ var LaunchOverridesSchema = object({
71094
+ /** The persisted heap ceiling in MB, or `null` when none is set. */
71095
+ heapMb: number().int().nullable(),
71096
+ /** The persisted hub-main RSS budget in MB, or `null` when none is set. */
71097
+ rssBudgetMb: number().int().nullable()
71098
+ });
71099
+ var SetLaunchOverridesInputSchema = object({
71100
+ heapMb: number().int().min(512).max(65536).nullable(),
71101
+ /** Omitted keeps the stored budget; `null` clears it. */
71102
+ rssBudgetMb: number().int().min(512).max(65536).nullable().optional()
71103
+ });
70629
71104
  var SetLaunchOverridesResultSchema = LaunchOverridesSchema.extend({
70630
71105
  /** Always true: the override is read at launch, not by the running process. */
70631
71106
  restartRequired: boolean() });
@@ -70654,7 +71129,7 @@ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), S
70654
71129
  }), method(_void(), ServerUpdateActionResultSchema, {
70655
71130
  kind: "mutation",
70656
71131
  auth: "admin"
70657
- }), method(_void(), LaunchOverridesSchema, { auth: "admin" }), method(object({ heapMb: number().int().min(512).max(65536).nullable() }), SetLaunchOverridesResultSchema, {
71132
+ }), method(_void(), LaunchOverridesSchema, { auth: "admin" }), method(SetLaunchOverridesInputSchema, SetLaunchOverridesResultSchema, {
70658
71133
  kind: "mutation",
70659
71134
  auth: "admin"
70660
71135
  });
@@ -70677,7 +71152,16 @@ DeviceType.Sensor;
70677
71152
  * future fields without breaking the existing call sites.
70678
71153
  */
70679
71154
  var EmailAddressSchema = email();
71155
+ /**
71156
+ * Which relay of a multi-relay provider answers (D996). Absent = the provider's first / default
71157
+ * relay, so a caller written before relays existed keeps working unchanged. A provider with one
71158
+ * fixed relay ignores it. This is the integration instance id (`int_NNNN`), NOT the addon id: the
71159
+ * collection pin `addonId` still picks the provider, `instanceId` picks the relay inside it.
71160
+ */
71161
+ var InstanceIdSchema = string().min(1).optional();
71162
+ var RelayPinSchema = object({ instanceId: InstanceIdSchema });
70680
71163
  var SendEmailInputSchema = object({
71164
+ instanceId: InstanceIdSchema,
70681
71165
  to: union([EmailAddressSchema, array(EmailAddressSchema).min(1)]),
70682
71166
  cc: array(EmailAddressSchema).optional(),
70683
71167
  bcc: array(EmailAddressSchema).optional(),
@@ -70713,11 +71197,11 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
70713
71197
  kind: "mutation",
70714
71198
  auth: "admin",
70715
71199
  access: "create"
70716
- }), method(_void(), SmtpStatusSchema, {
71200
+ }), method(RelayPinSchema, SmtpStatusSchema, {
70717
71201
  kind: "mutation",
70718
71202
  auth: "admin",
70719
71203
  access: "view"
70720
- }), method(_void(), SmtpStatusSchema, { auth: "admin" });
71204
+ }), method(RelayPinSchema, SmtpStatusSchema, { auth: "admin" });
70721
71205
  /**
70722
71206
  * A single device snapshot returned as base64 JPEG/PNG.
70723
71207
  *
@@ -70749,10 +71233,12 @@ DeviceType.Camera, method(object({
70749
71233
  * even when the cache is well within the device's
70750
71234
  * `snapshotMaxAgeS` window.
70751
71235
  *
70752
- * **`force` is an OPERATOR signal, not a freshness preference.** On a
71236
+ * **`force` is a demand with a named principal, not a freshness
71237
+ * preference** — an operator button, the scheduled refresh (D847), or a
71238
+ * notification rule that left the camera's wake allowed (D998). On a
70753
71239
  * battery camera it is the one thing that walks past the wrapper's
70754
- * sleep gate and wakes the camera, so a background caller — a poller,
70755
- * an event handler, a thumbnail — must NEVER set it. Every such caller
71240
+ * sleep gate and wakes the camera, so a poller, a thumbnail or a
71241
+ * prestream must NEVER set it. Every such caller
70756
71242
  * gets the cached frame, which on a sleeping battery camera is the
70757
71243
  * correct answer: stale but honest beats woken.
70758
71244
  */
@@ -72110,6 +72596,40 @@ var LoggingSettingsStateSchema = object({
72110
72596
  opsLogRetentionDays: number().int().min(0),
72111
72597
  persisted: boolean()
72112
72598
  });
72599
+ /**
72600
+ * Debug WATCH — a short, per-device window over `debug.<channel>` lines.
72601
+ *
72602
+ * `start` opens (or re-arms) a 10 minute window; `rearm` extends a LIVE one
72603
+ * and never revives a lapsed one; `stop` closes it; `list` only reads. No
72604
+ * chain of re-arms outlives 60 minutes from the first start. The hub holds the
72605
+ * watches in memory and pushes the interest to every node, so a watch lapses
72606
+ * by itself and survives nothing — a restart is a stop.
72607
+ */
72608
+ var DebugWatchInputSchema = object({
72609
+ action: _enum([
72610
+ "list",
72611
+ "start",
72612
+ "rearm",
72613
+ "stop"
72614
+ ]),
72615
+ /** Full channel names, `debug.<channel>`, each declared with `kind: 'debug'`. */
72616
+ channels: array(string().min(1)).readonly().default([]),
72617
+ /** Numeric device ids. Required (non-empty) for `start`. */
72618
+ deviceIds: array(number().int()).readonly().default([])
72619
+ });
72620
+ var DebugWatchStateSchema = object({
72621
+ channel: string(),
72622
+ deviceIds: array(number().int()).readonly(),
72623
+ startedAtMs: number(),
72624
+ untilMs: number(),
72625
+ capAtMs: number()
72626
+ });
72627
+ var DebugWatchResultSchema = object({
72628
+ nowMs: number(),
72629
+ watches: array(DebugWatchStateSchema).readonly(),
72630
+ /** Channels a `rearm` found already lapsed: nothing was revived. */
72631
+ lapsed: array(string()).readonly()
72632
+ });
72113
72633
  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(), {
72114
72634
  kind: "mutation",
72115
72635
  auth: "admin"
@@ -72125,6 +72645,9 @@ method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_
72125
72645
  }), 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, {
72126
72646
  kind: "mutation",
72127
72647
  auth: "admin"
72648
+ }), method(DebugWatchInputSchema, DebugWatchResultSchema, {
72649
+ kind: "mutation",
72650
+ auth: "admin"
72128
72651
  });
72129
72652
  object({
72130
72653
  /** True when the device's tamper switch / case-open contact is
@@ -74692,7 +75215,7 @@ discriminatedUnion("kind", [object({
74692
75215
  kind: literal("pronto"),
74693
75216
  code: string()
74694
75217
  })]);
74695
- DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
75218
+ DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
74696
75219
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
74697
75220
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
74698
75221
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
@@ -75673,6 +76196,27 @@ Object.freeze({
75673
76196
  access: "view",
75674
76197
  role: "viewer"
75675
76198
  },
76199
+ "boardKeySource.getBoardKey": {
76200
+ capName: "board-key-source",
76201
+ capScope: "system",
76202
+ addonId: null,
76203
+ access: "view",
76204
+ role: "admin"
76205
+ },
76206
+ "boardKeySource.listBoards": {
76207
+ capName: "board-key-source",
76208
+ capScope: "system",
76209
+ addonId: null,
76210
+ access: "view",
76211
+ role: "admin"
76212
+ },
76213
+ "boardKeySource.listSources": {
76214
+ capName: "board-key-source",
76215
+ capScope: "system",
76216
+ addonId: null,
76217
+ access: "view",
76218
+ role: "admin"
76219
+ },
75676
76220
  "brightness.getStatus": {
75677
76221
  capName: "brightness",
75678
76222
  capScope: "device",
@@ -77010,6 +77554,13 @@ Object.freeze({
77010
77554
  access: "view",
77011
77555
  role: "admin"
77012
77556
  },
77557
+ "deviceManager.dismissDiscoveryProposal": {
77558
+ capName: "device-manager",
77559
+ capScope: "system",
77560
+ addonId: null,
77561
+ access: "create",
77562
+ role: "admin"
77563
+ },
77013
77564
  "deviceManager.enable": {
77014
77565
  capName: "device-manager",
77015
77566
  capScope: "system",
@@ -77192,6 +77743,13 @@ Object.freeze({
77192
77743
  access: "view",
77193
77744
  role: "viewer"
77194
77745
  },
77746
+ "deviceManager.listDiscoveryProposals": {
77747
+ capName: "device-manager",
77748
+ capScope: "system",
77749
+ addonId: null,
77750
+ access: "view",
77751
+ role: "admin"
77752
+ },
77195
77753
  "deviceManager.listLocationDescriptions": {
77196
77754
  capName: "device-manager",
77197
77755
  capScope: "system",
@@ -77346,6 +77904,13 @@ Object.freeze({
77346
77904
  access: "create",
77347
77905
  role: "admin"
77348
77906
  },
77907
+ "deviceManager.reportDiscoveryObservations": {
77908
+ capName: "device-manager",
77909
+ capScope: "system",
77910
+ addonId: null,
77911
+ access: "create",
77912
+ role: "admin"
77913
+ },
77349
77914
  "deviceManager.runDeviceAction": {
77350
77915
  capName: "device-manager",
77351
77916
  capScope: "system",
@@ -77353,6 +77918,13 @@ Object.freeze({
77353
77918
  access: "create",
77354
77919
  role: "admin"
77355
77920
  },
77921
+ "deviceManager.runDiscoverySweep": {
77922
+ capName: "device-manager",
77923
+ capScope: "system",
77924
+ addonId: null,
77925
+ access: "create",
77926
+ role: "admin"
77927
+ },
77356
77928
  "deviceManager.setChildLayout": {
77357
77929
  capName: "device-manager",
77358
77930
  capScope: "system",
@@ -77906,6 +78478,20 @@ Object.freeze({
77906
78478
  access: "create",
77907
78479
  role: "admin"
77908
78480
  },
78481
+ "doNotDisturb.getStatus": {
78482
+ capName: "do-not-disturb",
78483
+ capScope: "device",
78484
+ addonId: null,
78485
+ access: "view",
78486
+ role: "viewer"
78487
+ },
78488
+ "doNotDisturb.setEnabled": {
78489
+ capName: "do-not-disturb",
78490
+ capScope: "device",
78491
+ addonId: null,
78492
+ access: "create",
78493
+ role: "viewer"
78494
+ },
77909
78495
  "doorbell.getStatus": {
77910
78496
  capName: "doorbell",
77911
78497
  capScope: "device",
@@ -78270,6 +78856,69 @@ Object.freeze({
78270
78856
  access: "create",
78271
78857
  role: "admin"
78272
78858
  },
78859
+ "integrationInstances.createInstance": {
78860
+ capName: "integration-instances",
78861
+ capScope: "system",
78862
+ addonId: null,
78863
+ access: "create",
78864
+ role: "admin"
78865
+ },
78866
+ "integrationInstances.deleteInstance": {
78867
+ capName: "integration-instances",
78868
+ capScope: "system",
78869
+ addonId: null,
78870
+ access: "delete",
78871
+ role: "admin"
78872
+ },
78873
+ "integrationInstances.describe": {
78874
+ capName: "integration-instances",
78875
+ capScope: "system",
78876
+ addonId: null,
78877
+ access: "view",
78878
+ role: "admin"
78879
+ },
78880
+ "integrationInstances.getInstance": {
78881
+ capName: "integration-instances",
78882
+ capScope: "system",
78883
+ addonId: null,
78884
+ access: "view",
78885
+ role: "admin"
78886
+ },
78887
+ "integrationInstances.instanceFormSchema": {
78888
+ capName: "integration-instances",
78889
+ capScope: "system",
78890
+ addonId: null,
78891
+ access: "view",
78892
+ role: "admin"
78893
+ },
78894
+ "integrationInstances.listInstances": {
78895
+ capName: "integration-instances",
78896
+ capScope: "system",
78897
+ addonId: null,
78898
+ access: "view",
78899
+ role: "admin"
78900
+ },
78901
+ "integrationInstances.setInstanceEnabled": {
78902
+ capName: "integration-instances",
78903
+ capScope: "system",
78904
+ addonId: null,
78905
+ access: "create",
78906
+ role: "admin"
78907
+ },
78908
+ "integrationInstances.testInstance": {
78909
+ capName: "integration-instances",
78910
+ capScope: "system",
78911
+ addonId: null,
78912
+ access: "create",
78913
+ role: "admin"
78914
+ },
78915
+ "integrationInstances.updateInstance": {
78916
+ capName: "integration-instances",
78917
+ capScope: "system",
78918
+ addonId: null,
78919
+ access: "create",
78920
+ role: "admin"
78921
+ },
78273
78922
  "integrations.create": {
78274
78923
  capName: "integrations",
78275
78924
  capScope: "system",
@@ -80391,27 +81040,6 @@ Object.freeze({
80391
81040
  access: "create",
80392
81041
  role: "viewer"
80393
81042
  },
80394
- "petFountain.setPumpInterval": {
80395
- capName: "pet-fountain",
80396
- capScope: "device",
80397
- addonId: null,
80398
- access: "create",
80399
- role: "viewer"
80400
- },
80401
- "petFountain.setPumpOffMinutes": {
80402
- capName: "pet-fountain",
80403
- capScope: "device",
80404
- addonId: null,
80405
- access: "create",
80406
- role: "viewer"
80407
- },
80408
- "petFountain.setPumpOnMinutes": {
80409
- capName: "pet-fountain",
80410
- capScope: "device",
80411
- addonId: null,
80412
- access: "create",
80413
- role: "viewer"
80414
- },
80415
81043
  "pipelineAnalytics.addRetrainFrameFromRecording": {
80416
81044
  capName: "pipeline-analytics",
80417
81045
  capScope: "device",
@@ -82190,6 +82818,34 @@ Object.freeze({
82190
82818
  access: "create",
82191
82819
  role: "admin"
82192
82820
  },
82821
+ "pumpCycle.getStatus": {
82822
+ capName: "pump-cycle",
82823
+ capScope: "device",
82824
+ addonId: null,
82825
+ access: "view",
82826
+ role: "viewer"
82827
+ },
82828
+ "pumpCycle.setEnabled": {
82829
+ capName: "pump-cycle",
82830
+ capScope: "device",
82831
+ addonId: null,
82832
+ access: "create",
82833
+ role: "viewer"
82834
+ },
82835
+ "pumpCycle.setOffMinutes": {
82836
+ capName: "pump-cycle",
82837
+ capScope: "device",
82838
+ addonId: null,
82839
+ access: "create",
82840
+ role: "viewer"
82841
+ },
82842
+ "pumpCycle.setOnMinutes": {
82843
+ capName: "pump-cycle",
82844
+ capScope: "device",
82845
+ addonId: null,
82846
+ access: "create",
82847
+ role: "viewer"
82848
+ },
82193
82849
  "reboot.reboot": {
82194
82850
  capName: "reboot",
82195
82851
  capScope: "device",
@@ -83926,6 +84582,13 @@ Object.freeze({
83926
84582
  access: "create",
83927
84583
  role: "viewer"
83928
84584
  },
84585
+ "system.debugWatch": {
84586
+ capName: "system",
84587
+ capScope: "system",
84588
+ addonId: null,
84589
+ access: "create",
84590
+ role: "admin"
84591
+ },
83929
84592
  "system.detectSiteLocation": {
83930
84593
  capName: "system",
83931
84594
  capScope: "system",
@@ -86119,6 +86782,16 @@ Object.freeze({
86119
86782
  form: "single",
86120
86783
  optional: false
86121
86784
  }],
86785
+ "doNotDisturb.getStatus": [{
86786
+ name: "deviceId",
86787
+ form: "single",
86788
+ optional: false
86789
+ }],
86790
+ "doNotDisturb.setEnabled": [{
86791
+ name: "deviceId",
86792
+ form: "single",
86793
+ optional: false
86794
+ }],
86122
86795
  "doorbell.getStatus": [{
86123
86796
  name: "deviceId",
86124
86797
  form: "single",
@@ -86742,21 +87415,6 @@ Object.freeze({
86742
87415
  form: "single",
86743
87416
  optional: false
86744
87417
  }],
86745
- "petFountain.setPumpInterval": [{
86746
- name: "deviceId",
86747
- form: "single",
86748
- optional: false
86749
- }],
86750
- "petFountain.setPumpOffMinutes": [{
86751
- name: "deviceId",
86752
- form: "single",
86753
- optional: false
86754
- }],
86755
- "petFountain.setPumpOnMinutes": [{
86756
- name: "deviceId",
86757
- form: "single",
86758
- optional: false
86759
- }],
86760
87418
  "pipelineAnalytics.addRetrainFrameFromRecording": [{
86761
87419
  name: "deviceId",
86762
87420
  form: "single",
@@ -87392,6 +88050,26 @@ Object.freeze({
87392
88050
  form: "single",
87393
88051
  optional: false
87394
88052
  }],
88053
+ "pumpCycle.getStatus": [{
88054
+ name: "deviceId",
88055
+ form: "single",
88056
+ optional: false
88057
+ }],
88058
+ "pumpCycle.setEnabled": [{
88059
+ name: "deviceId",
88060
+ form: "single",
88061
+ optional: false
88062
+ }],
88063
+ "pumpCycle.setOffMinutes": [{
88064
+ name: "deviceId",
88065
+ form: "single",
88066
+ optional: false
88067
+ }],
88068
+ "pumpCycle.setOnMinutes": [{
88069
+ name: "deviceId",
88070
+ form: "single",
88071
+ optional: false
88072
+ }],
87395
88073
  "reboot.reboot": [{
87396
88074
  name: "deviceId",
87397
88075
  form: "single",
@@ -87859,6 +88537,11 @@ Object.freeze({
87859
88537
  form: "single",
87860
88538
  optional: false
87861
88539
  }],
88540
+ "system.debugWatch": [{
88541
+ name: "deviceIds",
88542
+ form: "array",
88543
+ optional: true
88544
+ }],
87862
88545
  "tamper.getStatus": [{
87863
88546
  name: "deviceId",
87864
88547
  form: "single",
@@ -89666,8 +90349,7 @@ object({
89666
90349
  * The settings page drives these through
89667
90350
  * `api.addons.custom.{query,mutate}({ addonId, action, input })`: every action
89668
90351
  * button there is an `addon-action-button`, which shows the result (or the
89669
- * error) under the button, and the external-address picker is an
89670
- * `addon-action-select` over `listExternalAddresses`.
90352
+ * error) under the button.
89671
90353
  *
89672
90354
  * Every action is `auth: 'admin'` (S2). The framework default is `protected` —
89673
90355
  * any authenticated user — and at that level a viewer could rotate the token
@@ -89678,15 +90360,6 @@ object({
89678
90360
  * and `undefined` so the form-builder doesn't have to know. */
89679
90361
  var NoInput = object({}).optional();
89680
90362
  var exportAlexaActions = defineCustomActions({
89681
- /**
89682
- * The external addresses the connected `network-access` providers report
89683
- * now, read live for the "External address" picker, plus the saved choice
89684
- * when it is not among them (so it is never silently dropped from view).
89685
- */
89686
- listExternalAddresses: customAction(NoInput, object({ addresses: array(object({
89687
- value: string(),
89688
- label: string()
89689
- })).readonly() }), { auth: "admin" }),
89690
90363
  regenerateIngressToken: customAction(NoInput, object({ ingressToken: string() }), {
89691
90364
  kind: "mutation",
89692
90365
  auth: "admin"
@@ -95546,12 +96219,12 @@ function entryOf(ctx, p, track) {
95546
96219
  at: track.firstSeen
95547
96220
  };
95548
96221
  }
95549
- function dataItem(ctx, p, entry, userId) {
96222
+ async function dataItem(ctx, p, entry, userId) {
95550
96223
  return {
95551
96224
  eventIdentifier: entry.e,
95552
96225
  imageNetClass: entry.c,
95553
96226
  objectIdentifier: objectIdentifierFor(ctx.namespace(), p.deviceId, entry.t),
95554
- ...ctx.imagesFor(userId, p.deviceId, entry.t, entry.at)
96227
+ ...await ctx.imagesFor(userId, p.deviceId, entry.t, entry.at)
95555
96228
  };
95556
96229
  }
95557
96230
  function rangeOf(payload) {
@@ -95657,7 +96330,7 @@ async function handleReportData(header, endpoint, payloadRaw, ctx, caller) {
95657
96330
  type: "JSON",
95658
96331
  schema: "SmartVisionData"
95659
96332
  },
95660
- data: entries.map((e) => dataItem(ctx, p, e, caller.userId))
96333
+ data: await Promise.all(entries.map((e) => dataItem(ctx, p, e, caller.userId)))
95661
96334
  });
95662
96335
  }
95663
96336
  async function handleDeleteData(header, endpoint, payloadRaw, ctx, caller) {
@@ -96055,11 +96728,13 @@ async function handleGetSnapshot(header, endpoint, deps, caller) {
96055
96728
  const parsed = parseCameraEndpointId(endpoint.endpointId);
96056
96729
  if (parsed.kind !== "camera") return errorEnvelope(header, "INVALID_DIRECTIVE", "snapshots are served for camera endpoints");
96057
96730
  const deviceId = parsed.deviceId;
96058
- const base = deps.publicHubUrl().replace(/\/+$/, "");
96059
- if (!base.startsWith("https://")) {
96060
- deps.logger.warn("alexa snapshot: no public HTTPS address — Alexa cannot fetch an image", { tags: { deviceId } });
96061
- return errorEnvelope(header, "INTERNAL_ERROR", "the hub has no public HTTPS address");
96731
+ const publicOrigin = await deps.publicEndpoint();
96732
+ if (!publicOrigin.ok || !publicOrigin.origin.startsWith("https://")) {
96733
+ const reason = publicOrigin.ok ? "public-publicOrigin-not-https" : publicOrigin.reason.code;
96734
+ deps.logger.warn(`alexa snapshot: no public HTTPS address (${reason}) — Alexa cannot fetch an image`, { tags: { deviceId } });
96735
+ return errorEnvelope(header, "INTERNAL_ERROR", `the hub has no public HTTPS address (${reason}); set the Public publicOrigin on the Network page`);
96062
96736
  }
96737
+ const base = publicOrigin.origin;
96063
96738
  const started = deps.now?.() ?? Date.now();
96064
96739
  const frame = await readFrame(deps.ctx, deviceId).catch((err) => {
96065
96740
  deps.logger.warn("alexa snapshot: snapshot read failed", {
@@ -97179,6 +97854,82 @@ function maskSecretTail(secret) {
97179
97854
  return `••••••••${secret.slice(-4)}`;
97180
97855
  }
97181
97856
  //#endregion
97857
+ //#region src/public-endpoint.ts
97858
+ /** The role resolves to no address. */
97859
+ var NO_PUBLIC_ENDPOINT_REASON = {
97860
+ code: "no-public-endpoint",
97861
+ 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."
97862
+ };
97863
+ /** The palette could not be read at all. */
97864
+ var PUBLIC_ENDPOINT_UNREADABLE_REASON = {
97865
+ code: "public-endpoint-unreadable",
97866
+ message: "The hub could not read its \"Public endpoint\" address from the Network page; try again once the network service is up."
97867
+ };
97868
+ /** Trailing slashes off, surrounding space off. Nothing else is rewritten. */
97869
+ var normaliseOrigin = (raw) => raw.trim().replace(/\/+$/, "");
97870
+ var resolvePublicEndpoint = (book) => {
97871
+ const resolved = book.roles.publicEndpoint.resolved;
97872
+ const origin = resolved === null ? "" : normaliseOrigin(resolved);
97873
+ if (origin.length === 0) return {
97874
+ ok: false,
97875
+ reason: NO_PUBLIC_ENDPOINT_REASON
97876
+ };
97877
+ return {
97878
+ ok: true,
97879
+ origin
97880
+ };
97881
+ };
97882
+ /** A failed read is the unreadable refusal, never a thrown error and never an empty origin. */
97883
+ var createPublicEndpointReader = (read) => async () => {
97884
+ try {
97885
+ return resolvePublicEndpoint(await read());
97886
+ } catch {
97887
+ return {
97888
+ ok: false,
97889
+ reason: PUBLIC_ENDPOINT_UNREADABLE_REASON
97890
+ };
97891
+ }
97892
+ };
97893
+ //#endregion
97894
+ //#region src/routing-claim.ts
97895
+ /**
97896
+ * The `hubUrl` routing claim of an Alexa-bound token. The skill Lambda routes a directive back
97897
+ * to this hub on it, so it must still name the hub's current `publicEndpoint` role.
97898
+ *
97899
+ * Operator decision (planning#378, option B): there is no transition. A token issued with a
97900
+ * claim that differs from the role is refused with a named reason and the operator re-links
97901
+ * the skill once. The claim is read from a token `oauthVerifyAccessToken` has ALREADY
97902
+ * verified, so decoding the payload here trusts nothing new; the token itself is never logged.
97903
+ */
97904
+ var ClaimsSchema = object({ hubUrl: string().optional() });
97905
+ /** The claim, or null when the token carries none (or is not a JWT). */
97906
+ function readRoutingClaim(token) {
97907
+ const payload = token.split(".")[1];
97908
+ if (payload === void 0) return null;
97909
+ try {
97910
+ const parsed = ClaimsSchema.safeParse(JSON.parse(Buffer.from(payload, "base64url").toString()));
97911
+ const claim = parsed.success ? normaliseOrigin(parsed.data.hubUrl ?? "") : "";
97912
+ return claim.length > 0 ? claim : null;
97913
+ } catch {
97914
+ return null;
97915
+ }
97916
+ }
97917
+ function judgeRoutingClaim(claim, endpoint) {
97918
+ if (claim === null) return { kind: "unclaimed" };
97919
+ const normalised = normaliseOrigin(claim);
97920
+ if (!endpoint.ok) return {
97921
+ kind: "no-endpoint",
97922
+ claim: normalised,
97923
+ reason: endpoint.reason
97924
+ };
97925
+ if (normalised === endpoint.origin) return { kind: "current" };
97926
+ return {
97927
+ kind: "stale",
97928
+ claim: normalised,
97929
+ current: endpoint.origin
97930
+ };
97931
+ }
97932
+ //#endregion
97182
97933
  //#region src/snapshots/snapshot-route.ts
97183
97934
  var IMAGE_FILE = /^([0-9a-f-]{36})\.jpg$/;
97184
97935
  function bearerOf(headers) {
@@ -97353,16 +98104,6 @@ function buildRoutes(deps) {
97353
98104
  access: "public",
97354
98105
  description: "Alexa SnapshotProvider image (signed, 10 min, account-link token required)",
97355
98106
  handler: (req, reply) => handleSnapshotFetch(req, reply, deps.snapshotRoute)
97356
- },
97357
- {
97358
- method: "POST",
97359
- path: "/admin/redetect-hub-url",
97360
- access: "admin",
97361
- description: "Wizard hook — re-runs publicHubUrl auto-detection",
97362
- handler: async (_req, reply) => {
97363
- const result = await deps.redetectPublicHubUrl();
97364
- reply.code(200).send(result);
97365
- }
97366
98107
  }
97367
98108
  ];
97368
98109
  }
@@ -97447,6 +98188,16 @@ async function handleDirective(request, reply, deps) {
97447
98188
  return;
97448
98189
  }
97449
98190
  const verified = verifiedParse.data;
98191
+ const verdict = judgeRoutingClaim(readRoutingClaim(bearer), await deps.publicEndpoint());
98192
+ if (verdict.kind === "stale" || verdict.kind === "no-endpoint") {
98193
+ 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: {
98194
+ userId: verified.userId,
98195
+ claim: verdict.claim,
98196
+ ...verdict.kind === "stale" ? { current: verdict.current } : {}
98197
+ } });
98198
+ 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`));
98199
+ return;
98200
+ }
97450
98201
  try {
97451
98202
  assertDeviceScope(verified.scopes);
97452
98203
  } catch {
@@ -98061,7 +98812,7 @@ var LwaEventGateway = class {
98061
98812
  const d = opts.detection;
98062
98813
  for (const account of linked) {
98063
98814
  if (!this.mayPush(account.userId, opts.deviceId, "object detection")) continue;
98064
- const images = opts.imagesFor?.(account.userId) ?? {};
98815
+ const images = await opts.imagesFor?.(account.userId) ?? {};
98065
98816
  if (!this.smartVisionSampled.has(endpointId)) {
98066
98817
  this.smartVisionSampled.add(endpointId);
98067
98818
  this.deps.logger.info("alexa lwa-gateway: ObjectDetection body sample (redacted)", {
@@ -98399,9 +99150,10 @@ var LwaEventGateway = class {
98399
99150
  const retryAt = this.migrationRetryAt.get(userId) ?? 0;
98400
99151
  if (Date.now() < retryAt) return null;
98401
99152
  try {
99153
+ const endpoint = this.deps.getPublicEndpoint ? await this.deps.getPublicEndpoint() : null;
98402
99154
  const migrated = await migrateLegacyGrant(this.fetchImpl, brokerUrl, {
98403
99155
  refreshToken: entry.refreshToken,
98404
- ...this.deps.getPublicHubUrl ? { hubUrl: this.deps.getPublicHubUrl() } : {}
99156
+ ...endpoint?.ok ? { hubUrl: endpoint.origin } : {}
98405
99157
  });
98406
99158
  await this.deps.upsertToken({
98407
99159
  userId,
@@ -98748,7 +99500,7 @@ var CONNECTION_DESCRIPTION = [
98748
99500
  "Public skill (default): enable the \"CamStack\" skill in the Alexa app and link your account. No Amazon developer setup is needed.",
98749
99501
  "Custom skill: enter your skill id and deploy the skill Lambda from this addon's lambda-template in your own AWS account.",
98750
99502
  "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.",
98751
- "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."
99503
+ "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."
98752
99504
  ].join("\n");
98753
99505
  function connectionSection(input) {
98754
99506
  const { defaults } = input;
@@ -98800,20 +99552,6 @@ function connectionSection(input) {
98800
99552
  description: "Your skill's id, format amzn1.ask.skill.xxxx, from the Alexa developer console. Directives for any other skill are refused.",
98801
99553
  default: defaults.expectedAudience,
98802
99554
  showWhen: CUSTOM_SKILL_ONLY
98803
- },
98804
- {
98805
- type: "addon-action-select",
98806
- key: "publicHubUrl",
98807
- label: "External address",
98808
- 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.",
98809
- addonId: ADDON_ID,
98810
- action: "listExternalAddresses",
98811
- mapOption: {
98812
- value: "value",
98813
- label: "label"
98814
- },
98815
- emptyResultsMessage: "No external HTTPS address detected. Set up remote access (Cloudflare Tunnel, Tailscale Funnel, …), then reopen this page.",
98816
- default: defaults.publicHubUrl
98817
99555
  }
98818
99556
  ]
98819
99557
  };
@@ -99627,10 +100365,14 @@ var AlexaVisionRuntime = class {
99627
100365
  return reportableVisionClasses(declared, await this.state.get(deviceId));
99628
100366
  }
99629
100367
  /** Fresh, per-user, ten-minute image URIs for one event — or none. */
99630
- imagesFor(userId, deviceId, trackId, at) {
100368
+ async imagesFor(userId, deviceId, trackId, at) {
99631
100369
  if (!this.deps.snapshotsOn()) return {};
99632
- const base = this.deps.publicHubUrl().replace(/\/+$/, "");
99633
- if (!base.startsWith("https://")) return {};
100370
+ const endpoint = await this.deps.publicEndpoint();
100371
+ if (!endpoint.ok || !endpoint.origin.startsWith("https://")) {
100372
+ this.deps.logger.debug(`alexa vision: no image URIs — ${endpoint.ok ? "public-endpoint-not-https" : endpoint.reason.code}`, { tags: { deviceId } });
100373
+ return {};
100374
+ }
100375
+ const base = endpoint.origin;
99634
100376
  const frame = this.deps.store.mintLazy({
99635
100377
  deviceId,
99636
100378
  userId,
@@ -99704,6 +100446,59 @@ var AlexaVisionRuntime = class {
99704
100446
  }
99705
100447
  };
99706
100448
  //#endregion
100449
+ //#region src/migrations/drop-public-hub-url.ts
100450
+ /**
100451
+ * The hub's public URL is no longer a setting of this addon (planning#378): Alexa reads the
100452
+ * `publicEndpoint` role of the local-network palette on every use. The key older
100453
+ * versions persisted is deleted. Every other key is left exactly as stored.
100454
+ *
100455
+ * Idempotent: a store without the key yields an empty plan, which writes nothing.
100456
+ */
100457
+ /** The addon id, the prefix of its rows in the canonical settings table. */
100458
+ var ALEXA_ADDON_ID = "export-alexa";
100459
+ /**
100460
+ * Where the addon's global settings live: the canonical `addon-settings` table, one row per
100461
+ * key, id `<addonId>.<key>`, data `{ addonId, key, value }` (never a per-addon scoped table,
100462
+ * which exists only when something lazily declared it).
100463
+ */
100464
+ var ADDON_SETTINGS_TABLE = "addon-settings";
100465
+ var RETIRED_PUBLIC_URL_KEYS = ["publicHubUrl"];
100466
+ async function planDropPublicHubUrl(ports) {
100467
+ const stored = await ports.readStored();
100468
+ const present = RETIRED_PUBLIC_URL_KEYS.filter((key) => key in stored);
100469
+ if (present.length === 0) return { edits: [] };
100470
+ const rowId = (key) => `${ALEXA_ADDON_ID}.${key}`;
100471
+ return { edits: [{
100472
+ op: "deleteKeys",
100473
+ scope: ADDON_SETTINGS_TABLE,
100474
+ keys: present.map(rowId),
100475
+ precondition: preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
100476
+ addonId: ALEXA_ADDON_ID,
100477
+ key,
100478
+ value: stored[key]
100479
+ }])))
100480
+ }] };
100481
+ }
100482
+ //#endregion
100483
+ //#region src/migrations/index.ts
100484
+ /** The `export-alexa` catalogue (D987): offered to the engine when the addon initialises. */
100485
+ var ADDON_MIGRATIONS = [{
100486
+ meta: {
100487
+ id: "export-alexa/2026-11-02-drop-public-hub-url",
100488
+ owner: "export-alexa",
100489
+ level: "addon-state",
100490
+ seq: 1,
100491
+ dependsOn: [],
100492
+ store: "settings",
100493
+ scope: "cluster",
100494
+ onFailure: "tolerate",
100495
+ bodyKind: "plan",
100496
+ description: "Delete the retired publicHubUrl setting; the public URL is the publicEndpoint role",
100497
+ fixtureMark: "the exposed device list the migration does not know"
100498
+ },
100499
+ plan: planDropPublicHubUrl
100500
+ }];
100501
+ //#endregion
99707
100502
  //#region src/oauth-integration.ts
99708
100503
  /**
99709
100504
  * The `export-alexa` OAuth client — the descriptor behind
@@ -99760,7 +100555,7 @@ var ALEXA_REDIRECT_PREFIXES = [
99760
100555
  * no `requiresPkce` here. That is a property of the two clients, expressed
99761
100556
  * through the same descriptor field.
99762
100557
  */
99763
- function buildAlexaOauthIntegration(publicHubUrl) {
100558
+ function buildAlexaOauthIntegration(publicOrigin) {
99764
100559
  return {
99765
100560
  integrationId: "export-alexa",
99766
100561
  displayName: "Alexa Smart Home",
@@ -99797,13 +100592,13 @@ function buildAlexaOauthIntegration(publicHubUrl) {
99797
100592
  * "Unlink Amazon account" button does; see `unlinkAlexaAccounts`.
99798
100593
  */
99799
100594
  refreshTokenTtlSec: "never",
99800
- ...publicHubUrl ? { hubUrl: publicHubUrl } : {}
100595
+ ...publicOrigin ? { hubUrl: publicOrigin } : {}
99801
100596
  };
99802
100597
  }
99803
100598
  //#endregion
99804
100599
  //#region src/setup-block.ts
99805
100600
  function buildAlexaSetupBlock(input) {
99806
- const base = input.publicHubUrl.replace(/\/+$/, "");
100601
+ const base = input.publicEndpoint.ok ? input.publicEndpoint.origin : "";
99807
100602
  return {
99808
100603
  fields: [
99809
100604
  ...base ? [{
@@ -99819,9 +100614,13 @@ function buildAlexaSetupBlock(input) {
99819
100614
  value: maskSecretTail(input.ingressToken)
99820
100615
  }] : []
99821
100616
  ],
99822
- 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."
100617
+ 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)
99823
100618
  };
99824
100619
  }
100620
+ function refusalNote(endpoint) {
100621
+ if (endpoint.ok) return "";
100622
+ return `Refused (${endpoint.reason.code}): ${endpoint.reason.message}`;
100623
+ }
99825
100624
  process.platform, process.env["SystemRoot"];
99826
100625
  /**
99827
100626
  * The ONE derivation of "a signed, expiring URL".
@@ -100995,7 +101794,6 @@ var DEFAULT_CONFIG = {
100995
101794
  tokens: [],
100996
101795
  exportedEndpoints: {},
100997
101796
  exportedSignatures: {},
100998
- publicHubUrl: "",
100999
101797
  ingressToken: "",
101000
101798
  enforceIngressToken: false,
101001
101799
  accountVisibility: {},
@@ -101077,7 +101875,13 @@ var ExportAlexaAddon = class extends BaseAddon {
101077
101875
  constructor() {
101078
101876
  super({ ...DEFAULT_CONFIG });
101079
101877
  }
101878
+ /**
101879
+ * The hub's public origin: the `publicEndpoint` role of `local-network`, read on every use
101880
+ * through `ctx.api` (planning#378). No setting holds it and nothing ranks the palette here.
101881
+ */
101882
+ publicEndpoint = createPublicEndpointReader(() => this.ctx.api.localNetwork.getAddresses.query());
101080
101883
  async onInitialize() {
101884
+ await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, { readStored: async () => this.resolveGlobalStore() }));
101081
101885
  if (!this.config.ingressToken) await this.updateGlobalSettings({ ingressToken: generateIngressToken() });
101082
101886
  if (!this.config.snapshotSigningKey) await this.updateGlobalSettings({ snapshotSigningKey: generateIngressToken() });
101083
101887
  if (!this.config.visionNamespace) await this.updateGlobalSettings({ visionNamespace: (0, node_crypto.randomUUID)() });
@@ -101086,9 +101890,6 @@ var ExportAlexaAddon = class extends BaseAddon {
101086
101890
  this.ctx.logger.warn("export-alexa: removed a stored LWA client secret — the hub no longer uses one; your skill Lambda holds it (D753)");
101087
101891
  }
101088
101892
  await this.backfillLinkedAccounts();
101089
- this.autoDetectPublicHubUrl().catch((err) => {
101090
- this.ctx.logger.warn("export-alexa: public hub URL auto-detect failed", { meta: { error: errMsg$1(err) } });
101091
- });
101092
101893
  this.accessGateRef = createHubAccessGate(this.ctx);
101093
101894
  this.detectionClassSource = new DetectionClassSource({
101094
101895
  readEventKinds: (deviceId) => this.ctx.api.pipelineAnalytics.listEventKinds.query({ deviceId }),
@@ -101112,7 +101913,7 @@ var ExportAlexaAddon = class extends BaseAddon {
101112
101913
  isExposed: (deviceId) => this.config.exposed.some((e) => e.deviceId === deviceId),
101113
101914
  knownClasses: (deviceId) => this.config.detectionClasses[deviceId]?.classes ?? [],
101114
101915
  namespace: () => this.config.visionNamespace,
101115
- publicHubUrl: () => this.config.publicHubUrl,
101916
+ publicEndpoint: this.publicEndpoint,
101116
101917
  store: this.snapshotStore,
101117
101918
  post: (opts) => this.requireGateway().postObjectDetection(opts)
101118
101919
  });
@@ -101137,7 +101938,7 @@ var ExportAlexaAddon = class extends BaseAddon {
101137
101938
  getStatus: async () => ({
101138
101939
  linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
101139
101940
  exposedDeviceCount: this.config.exposed.length,
101140
- setup: this.buildSetupBlock()
101941
+ setup: await this.buildSetupBlock()
101141
101942
  }),
101142
101943
  listSupportedDeviceKinds: async () => [...SUPPORTED_KINDS],
101143
101944
  listExposedDevices: async () => this.config.exposed.map((e) => ({ deviceId: String(e.deviceId) })),
@@ -101233,7 +102034,7 @@ var ExportAlexaAddon = class extends BaseAddon {
101233
102034
  logger: this.ctx.logger,
101234
102035
  store: this.snapshotStore,
101235
102036
  enabled: () => this.config.snapshots,
101236
- publicHubUrl: () => this.config.publicHubUrl
102037
+ publicEndpoint: this.publicEndpoint
101237
102038
  },
101238
102039
  vision: this.vision.context(),
101239
102040
  access: this.endpointAccess,
@@ -101250,7 +102051,7 @@ var ExportAlexaAddon = class extends BaseAddon {
101250
102051
  upsertToken: (input) => this.upsertToken(input),
101251
102052
  recordLinkedAccount: (input) => this.recordLinkedAccount(input)
101252
102053
  },
101253
- redetectPublicHubUrl: () => this.redetectPublicHubUrl(),
102054
+ publicEndpoint: this.publicEndpoint,
101254
102055
  onBrokerAdvertised: (raw) => this.rememberAdvertisedBroker(raw),
101255
102056
  snapshotRoute: {
101256
102057
  store: this.snapshotStore,
@@ -101264,7 +102065,11 @@ var ExportAlexaAddon = class extends BaseAddon {
101264
102065
  logger: this.ctx.logger
101265
102066
  }
101266
102067
  }));
101267
- const oauthIntegrationProvider = { getDescriptor: async () => buildAlexaOauthIntegration(this.config.publicHubUrl) };
102068
+ const oauthIntegrationProvider = { getDescriptor: async () => {
102069
+ const endpoint = await this.publicEndpoint();
102070
+ if (!endpoint.ok) this.ctx.logger.warn(`export-alexa: linking without a routing claim — ${endpoint.reason.code}: ${endpoint.reason.message}`);
102071
+ return buildAlexaOauthIntegration(endpoint.ok ? endpoint.origin : void 0);
102072
+ } };
101268
102073
  this.egressPrewarm = new AlexaEgressPrewarm({
101269
102074
  api: this.ctx.api,
101270
102075
  logger: this.ctx.logger,
@@ -101283,7 +102088,7 @@ var ExportAlexaAddon = class extends BaseAddon {
101283
102088
  upsertToken: (input) => this.upsertToken(input),
101284
102089
  removeLinkedAccount: (userId) => this.removeLinkedAccount(userId),
101285
102090
  getAdvertisedBrokerUrl: () => this.config.advertisedBrokerUrl || null,
101286
- getPublicHubUrl: () => this.config.publicHubUrl,
102091
+ getPublicEndpoint: this.publicEndpoint,
101287
102092
  getRegion: () => this.config.region,
101288
102093
  getExportedSignature: (deviceId) => this.config.exportedSignatures[deviceId] ?? null,
101289
102094
  accountMaySee: (userId, deviceId) => this.visibility.allows(userId, deviceId)
@@ -101362,14 +102167,6 @@ var ExportAlexaAddon = class extends BaseAddon {
101362
102167
  this.unexposeDevice(String(id));
101363
102168
  });
101364
102169
  this.ctx.addDisposer(async () => offRemoved());
101365
- const offTunnelStarted = this.ctx.eventBus.subscribe({ category: EventCategory.NetworkTunnelStarted }, () => {
101366
- this.redetectPublicHubUrl().then(({ publicHubUrl }) => {
101367
- this.ctx.logger.info("export-alexa: re-detected public hub URL after tunnel connect", { meta: { publicHubUrl } });
101368
- }).catch((err) => {
101369
- this.ctx.logger.warn("export-alexa: public hub URL re-detect after tunnel connect failed", { meta: { error: errMsg$1(err) } });
101370
- });
101371
- });
101372
- this.ctx.addDisposer(async () => offTunnelStarted());
101373
102170
  const reaper = setInterval(() => {
101374
102171
  this.reapDeadEgressHandles();
101375
102172
  }, EGRESS_REAP_INTERVAL_MS);
@@ -101399,7 +102196,6 @@ var ExportAlexaAddon = class extends BaseAddon {
101399
102196
  ],
101400
102197
  customActions: exportAlexaActions,
101401
102198
  actionHandlers: {
101402
- listExternalAddresses: async () => this.listExternalAddresses(),
101403
102199
  regenerateIngressToken: async () => this.regenerateIngressToken(),
101404
102200
  revealIngressToken: async () => {
101405
102201
  this.ctx.logger.info("export-alexa: an administrator revealed the ingress token");
@@ -101864,83 +102660,6 @@ var ExportAlexaAddon = class extends BaseAddon {
101864
102660
  };
101865
102661
  }
101866
102662
  /**
101867
- * Resolve the hub's public HTTPS URL by querying the `network-access`
101868
- * collection cap's `listEndpoints` aggregate.
101869
- *
101870
- * `network-access` is a proper codegen'd collection capability
101871
- * (`scope: 'system'`) so it IS reachable cross-process via `ctx.api` —
101872
- * unlike the `addons` core cap, which is a hub-side core tRPC router
101873
- * NOT advertised as a Moleculer service: a forked addon (export-alexa
101874
- * runs forked) calling `ctx.api.addons.*` would hang forever.
101875
- *
101876
- * `listEndpoints` with no `addonId` aggregates active ingress endpoints
101877
- * across every connected `network-access` provider. We take the first
101878
- * HTTPS entry. `listEndpoints` is optional on a provider (the cap doc
101879
- * says single-endpoint providers may omit it), so we fall back to the
101880
- * aggregate `getStatus` when `listEndpoints` yields nothing. Returns an
101881
- * empty string when none is available — the caller persists it as-is;
101882
- * the addon degrades gracefully (no public URL → directive endpoints
101883
- * unset) but never hangs.
101884
- */
101885
- async resolveEndpoints() {
101886
- const fromList = await this.detectAllFromListEndpoints();
101887
- if (fromList.length > 0) return fromList;
101888
- const single = await this.detectFromGetStatus();
101889
- if (single.length > 0) return [single];
101890
- 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.");
101891
- return [];
101892
- }
101893
- /** Aggregate `listEndpoints` → every HTTPS entry's url, de-duplicated. */
101894
- async detectAllFromListEndpoints() {
101895
- try {
101896
- const urls = (await this.ctx.api.networkAccess.listEndpoints.query({})).filter((e) => e.protocol === "https" && e.url.length > 0).map((e) => this.normaliseHubUrl(e.url));
101897
- return [...new Set(urls)];
101898
- } catch (err) {
101899
- this.ctx.logger.debug("export-alexa: networkAccess.listEndpoints failed", { meta: { error: errMsg$1(err) } });
101900
- return [];
101901
- }
101902
- }
101903
- /** Aggregate `getStatus` → connected HTTPS endpoint's url. '' on failure. */
101904
- async detectFromGetStatus() {
101905
- try {
101906
- const raw = await this.ctx.api.networkAccess.getStatus.query({});
101907
- const parsed = NetworkAccessStatusSchema.safeParse(raw);
101908
- const status = parsed.success ? parsed.data : null;
101909
- const endpoint = status?.endpoint;
101910
- if (!status?.connected || !endpoint || endpoint.protocol !== "https" || endpoint.url.length === 0) return "";
101911
- return this.normaliseHubUrl(endpoint.url);
101912
- } catch (err) {
101913
- this.ctx.logger.debug("export-alexa: networkAccess.getStatus failed", { meta: { error: errMsg$1(err) } });
101914
- return "";
101915
- }
101916
- }
101917
- /**
101918
- * Boot-time best-effort: default the external address to the first
101919
- * detected endpoint when the operator hasn't chosen one. The picker reads
101920
- * its options live, so nothing is cached here.
101921
- */
101922
- async autoDetectPublicHubUrl() {
101923
- if (this.config.publicHubUrl) return;
101924
- const defaulted = (await this.resolveEndpoints())[0];
101925
- if (defaulted) {
101926
- await this.updateGlobalSettings({ publicHubUrl: defaulted });
101927
- this.ctx.logger.info("export-alexa: defaulted public hub URL to first external address", { meta: { url: defaulted } });
101928
- }
101929
- }
101930
- /**
101931
- * Re-scan the connected `network-access` providers and keep the
101932
- * operator's current selection when it's still present (otherwise default
101933
- * to the first). Runs when a tunnel connects and behind the
101934
- * `/admin/redetect-hub-url` route. Returns the URL we landed on (empty
101935
- * string when nothing is connected).
101936
- */
101937
- async redetectPublicHubUrl() {
101938
- const endpoints = await this.resolveEndpoints();
101939
- const publicHubUrl = this.config.publicHubUrl.length > 0 && endpoints.includes(this.config.publicHubUrl) ? this.config.publicHubUrl : endpoints[0] ?? "";
101940
- if (publicHubUrl !== this.config.publicHubUrl) await this.updateGlobalSettings({ publicHubUrl });
101941
- return { publicHubUrl };
101942
- }
101943
- /**
101944
102663
  * Rotate the ingress token, invalidating the old value. The operator must
101945
102664
  * paste the new token into their Lambda's HUB_INGRESS_TOKEN env afterwards.
101946
102665
  * Backs the "Regenerate token" settings button.
@@ -101951,9 +102670,6 @@ var ExportAlexaAddon = class extends BaseAddon {
101951
102670
  this.ctx.logger.info("export-alexa: regenerated ingress token");
101952
102671
  return { ingressToken };
101953
102672
  }
101954
- normaliseHubUrl(raw) {
101955
- return raw.replace(/\/+$/, "");
101956
- }
101957
102673
  /**
101958
102674
  * Build the generic `device-export` `setup` block surfaced via
101959
102675
  * `getStatus` and rendered by the shared `DeviceExportPanel`: the
@@ -101961,30 +102677,13 @@ var ExportAlexaAddon = class extends BaseAddon {
101961
102677
  * from the public hub URL, and the linked-account count. Each row
101962
102678
  * gets a copy button in the panel; the secret rows are masked.
101963
102679
  */
101964
- buildSetupBlock() {
102680
+ async buildSetupBlock() {
101965
102681
  return buildAlexaSetupBlock({
101966
- publicHubUrl: this.config.publicHubUrl,
102682
+ publicEndpoint: await this.publicEndpoint(),
101967
102683
  ingressToken: this.config.ingressToken,
101968
102684
  skillMode: this.config.skillMode
101969
102685
  });
101970
102686
  }
101971
- /**
101972
- * The "External address" picker's options, read live: every HTTPS endpoint
101973
- * the connected remote-access providers report now, plus the saved choice
101974
- * when it is not among them, so a manual pick is never dropped from view.
101975
- */
101976
- async listExternalAddresses() {
101977
- const detected = await this.resolveEndpoints();
101978
- const current = this.config.publicHubUrl;
101979
- const addresses = detected.map((url) => ({
101980
- value: url,
101981
- label: url
101982
- }));
101983
- return { addresses: current.length > 0 && !detected.includes(current) ? [...addresses, {
101984
- value: current,
101985
- label: `${current} (not detected now)`
101986
- }] : addresses };
101987
- }
101988
102687
  /** The settings page: see `settings-schema.ts` for its layout. The account-
101989
102688
  * linking rows live in the `device-export` setup block instead. */
101990
102689
  globalSettingsSchema() {