@camstack/addon-pipeline-orchestrator 1.2.662 → 1.2.664

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/assets/viewer/.viewer-current-files.json +2 -2
  3. package/assets/viewer/.viewer-version +1 -1
  4. package/assets/viewer/_expo/static/js/web/{__common-b582199d5704981fa512087e41f144bb.js → __common-944a1711775677f5c7cba328efbb7eb2.js} +9 -9
  5. package/assets/viewer/_expo/static/js/web/{index-49b436680a10d5eb314daaefff7128b9.js → index-c2e4074d6805fc38a186dd83bd4fd0a2.js} +2 -2
  6. package/assets/viewer/index.html +1 -1
  7. package/dist/_stub.js +246 -246
  8. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-SE2z6ZPT.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-eCr2uk4a.mjs} +3 -3
  9. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CSVAOMjE.mjs +26 -0
  10. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Dguynk7E.mjs +26 -0
  11. package/dist/{hostInit-j4Xg1GJl.mjs → hostInit-BMliBDra.mjs} +3 -3
  12. package/dist/index.js +1594 -1499
  13. package/dist/index.mjs +1594 -1499
  14. package/dist/remoteEntry.js +1 -1
  15. package/package.json +2 -2
  16. package/assets/viewer/_expo/static/js/web/_layout-0fda926e25f08a11cce3143894cd6667.js +0 -29
  17. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CmlOAYRv.mjs +0 -26
  18. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DGQuOA5w.mjs +0 -26
package/dist/index.mjs CHANGED
@@ -5984,7 +5984,7 @@ var ZodIssueCode = {
5984
5984
  var ZodFirstPartyTypeKind;
5985
5985
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5986
5986
  //#endregion
5987
- //#region ../types/dist/sleep-DEZaLbiu.mjs
5987
+ //#region ../types/dist/sleep-D7ZKm4nb.mjs
5988
5988
  /**
5989
5989
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5990
5990
  * window to float samples (D455).
@@ -6677,6 +6677,344 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
6677
6677
  blockOwner
6678
6678
  };
6679
6679
  }
6680
+ /** The record calls the one-switch migration makes, over the migration API. */
6681
+ function switchRecordsOverMigrationApi(api) {
6682
+ return { kind: (definition) => {
6683
+ const handle = api.records.kind(definition);
6684
+ return {
6685
+ get: (id) => handle.get({ id }),
6686
+ put: (input, opts) => handle.put({
6687
+ ...input,
6688
+ ...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
6689
+ }),
6690
+ patch: (id, partial) => handle.patch({
6691
+ id,
6692
+ partial
6693
+ })
6694
+ };
6695
+ } };
6696
+ }
6697
+ function integrationRowsApiOver(api) {
6698
+ return {
6699
+ list: async () => (await api.integrations.list({})).integrations,
6700
+ readLegacyIntegrationRows: (input) => api.legacyRows.read(input),
6701
+ clearLegacyIntegrationRows: (input) => api.legacyRows.clear(input)
6702
+ };
6703
+ }
6704
+ var PREFIX = "records/";
6705
+ /**
6706
+ * Cross-realm brand. An addon bundles its own copy of this module (D15) while
6707
+ * `ctx.records` is the HOST's door, so an error thrown by the host is an
6708
+ * instance of the host's classes, not of the addon's. The brand plus the code
6709
+ * make `instanceof` answer by identity of the failure, not of the copy.
6710
+ */
6711
+ var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
6712
+ function carriesBrand(value) {
6713
+ return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
6714
+ }
6715
+ /** The base of every records failure. `detail` is the human part of the message. */
6716
+ var RecordsError = class extends Error {
6717
+ /** The code a subclass stands for; the base stands for every code. */
6718
+ static code = void 0;
6719
+ /**
6720
+ * `instanceof` across copies of this module: any branded error is a
6721
+ * `RecordsError`, and is an instance of a subclass only when its code is the
6722
+ * subclass's code. Same-copy answers are unchanged.
6723
+ */
6724
+ static [Symbol.hasInstance](value) {
6725
+ if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
6726
+ if (!carriesBrand(value)) return false;
6727
+ return this.code === void 0 || value.code === this.code;
6728
+ }
6729
+ code;
6730
+ detail;
6731
+ [RECORDS_ERROR_BRAND] = true;
6732
+ constructor(code, detail) {
6733
+ super(`${PREFIX}${code}: ${detail}`);
6734
+ this.name = "RecordsError";
6735
+ this.code = code;
6736
+ this.detail = detail;
6737
+ }
6738
+ };
6739
+ var InvalidRecordError = class InvalidRecordError extends RecordsError {
6740
+ static code = "invalid-record";
6741
+ constructor(detail) {
6742
+ super(InvalidRecordError.code, detail);
6743
+ this.name = "InvalidRecordError";
6744
+ }
6745
+ };
6746
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
6747
+ var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
6748
+ static code = "declaration-refused";
6749
+ constructor(detail) {
6750
+ super(DeclarationRefusedError.code, detail);
6751
+ this.name = "DeclarationRefusedError";
6752
+ }
6753
+ };
6754
+ object({
6755
+ cap: string().min(1),
6756
+ kind: string().min(1).optional()
6757
+ });
6758
+ var GLOBAL_SCOPE = { kind: "global" };
6759
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6760
+ function globalSecretScope() {
6761
+ return GLOBAL_SCOPE;
6762
+ }
6763
+ function encodeSegment(value) {
6764
+ return encodeURIComponent(value);
6765
+ }
6766
+ function decodeSegment(value) {
6767
+ try {
6768
+ return decodeURIComponent(value);
6769
+ } catch {
6770
+ return null;
6771
+ }
6772
+ }
6773
+ /**
6774
+ * The field path of a value inside an array item, addressed by the item's id:
6775
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6776
+ * `providers[authentik].clientSecret`.
6777
+ */
6778
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6779
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6780
+ }
6781
+ function parseScope(segments) {
6782
+ switch (segments[0]) {
6783
+ case "global": return {
6784
+ scope: GLOBAL_SCOPE,
6785
+ used: 1
6786
+ };
6787
+ case "node": {
6788
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6789
+ return nodeId === null || nodeId.length === 0 ? null : {
6790
+ scope: {
6791
+ kind: "node",
6792
+ nodeId
6793
+ },
6794
+ used: 2
6795
+ };
6796
+ }
6797
+ case "device": {
6798
+ const raw = segments[1];
6799
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6800
+ return {
6801
+ scope: {
6802
+ kind: "device",
6803
+ deviceId: Number(raw)
6804
+ },
6805
+ used: 2
6806
+ };
6807
+ }
6808
+ case "integration": {
6809
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6810
+ return id === null || id.length === 0 ? null : {
6811
+ scope: {
6812
+ kind: "integration",
6813
+ integrationId: id
6814
+ },
6815
+ used: 2
6816
+ };
6817
+ }
6818
+ case "row": {
6819
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6820
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6821
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6822
+ return {
6823
+ scope: {
6824
+ kind: "row",
6825
+ collection,
6826
+ rowId
6827
+ },
6828
+ used: 3
6829
+ };
6830
+ }
6831
+ default: return null;
6832
+ }
6833
+ }
6834
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6835
+ function parseSecretRef(ref) {
6836
+ if (!ref.startsWith("secret://")) return null;
6837
+ const segments = ref.slice(9).split("/");
6838
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6839
+ if (owner === null || owner.length === 0) return null;
6840
+ const parsed = parseScope(segments.slice(1));
6841
+ if (parsed === null) return null;
6842
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6843
+ if (fieldPath.length === 0) return null;
6844
+ return {
6845
+ owner,
6846
+ scope: parsed.scope,
6847
+ fieldPath
6848
+ };
6849
+ }
6850
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
6851
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
6852
+ var RECORD_DATABASES = ["settings", "events"];
6853
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
6854
+ var RECORD_CLASSES = [
6855
+ "config",
6856
+ "ledger",
6857
+ "audit",
6858
+ "mirror",
6859
+ "ephemeral"
6860
+ ];
6861
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
6862
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
6863
+ var RECORD_BATCH_MAX = 1e3;
6864
+ var RECORD_QUERY_MAX = 1e3;
6865
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
6866
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
6867
+ /**
6868
+ * Secret fields of a record, addressed the way a Zod schema declares them
6869
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
6870
+ * (`auth.accessToken`, `headers[].value`).
6871
+ *
6872
+ * `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
6873
+ * names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
6874
+ * key releases exactly that key's secret.
6875
+ *
6876
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
6877
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
6878
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
6879
+ * leaf names its element: `headers[X-Api].value`.
6880
+ *
6881
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
6882
+ */
6883
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
6884
+ function parseSecretPath(path) {
6885
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
6886
+ return path.split(".").map((raw) => {
6887
+ const each = raw.endsWith("[]");
6888
+ const map = raw.endsWith("{}");
6889
+ const key = each || map ? raw.slice(0, -2) : raw;
6890
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
6891
+ return {
6892
+ key,
6893
+ each,
6894
+ map
6895
+ };
6896
+ });
6897
+ }
6898
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
6899
+ function secretArrayPrefixes(path) {
6900
+ const segments = parseSecretPath(path);
6901
+ const prefixes = [];
6902
+ const walked = [];
6903
+ for (const segment of segments) {
6904
+ walked.push(segment.key);
6905
+ if (segment.each) prefixes.push(walked.join("."));
6906
+ }
6907
+ return prefixes;
6908
+ }
6909
+ /** The body key of the switch; only {@link RecordIntegrationInstances.setInstanceEnabled} writes it. */
6910
+ var SWITCH_KEY = "enabled";
6911
+ /**
6912
+ * The one-switch migration (epic #440, step 3). An integration's on/off state used to live in the
6913
+ * registry's `enabled` column for a device addon; it now lives only in the instance record's
6914
+ * body (`enabled`, D1007 superseded). This moves a registry `enabled = false` into the body, once.
6915
+ *
6916
+ * For every registry row of the addon that is OFF:
6917
+ * - no record under its id: the record is created from `initialBody(name)` with `enabled: false`
6918
+ * (a default integration that never had settings, Reolink's among them);
6919
+ * - a record whose body states no `enabled`: `enabled: false` is written into it;
6920
+ * - a record that already states `enabled` (either way) is the newer truth and is left alone.
6921
+ * A row that is ON writes nothing: an absent field reads as on. A rerun finds every off row with
6922
+ * a stated switch and does nothing, so nothing switched off comes back on and nothing switched on
6923
+ * goes off. The registry column itself is neither read afterwards nor written; its drop is step 5.
6924
+ *
6925
+ * It runs in the addon process, BEFORE the addon registers its `integration-instances` provider,
6926
+ * which is also why `integrations.list` still answers the stored column at that point.
6927
+ */
6928
+ function registrySwitchToBodyId(addonId, date) {
6929
+ return `${addonId}/${date}-registry-switch-to-body`;
6930
+ }
6931
+ async function moveRegistrySwitchToBody(ports, spec) {
6932
+ const rows = await ports.listIntegrations(spec.addonId);
6933
+ let created = 0;
6934
+ let switched = 0;
6935
+ let kept = 0;
6936
+ for (const row of rows) {
6937
+ if (row.enabled) continue;
6938
+ const body = await ports.readBody(row.id);
6939
+ if (body === null) {
6940
+ if (await ports.createRecord(row.id, {
6941
+ ...spec.initialBody(row.name),
6942
+ ["enabled"]: false
6943
+ }) === "created") created += 1;
6944
+ else kept += 1;
6945
+ continue;
6946
+ }
6947
+ if ("enabled" in body) {
6948
+ kept += 1;
6949
+ continue;
6950
+ }
6951
+ await ports.switchOff(row.id);
6952
+ switched += 1;
6953
+ }
6954
+ const summary = {
6955
+ integrations: rows.length,
6956
+ off: rows.filter((r) => !r.enabled).length,
6957
+ created,
6958
+ switched,
6959
+ kept
6960
+ };
6961
+ return created === 0 && switched === 0 ? {
6962
+ outcome: "already-done",
6963
+ summary
6964
+ } : {
6965
+ outcome: "done",
6966
+ summary
6967
+ };
6968
+ }
6969
+ /** A migration entry: an addon states its kind and how a new body starts, nothing else. */
6970
+ function registrySwitchToBodyMigration(spec) {
6971
+ return {
6972
+ meta: {
6973
+ id: registrySwitchToBodyId(spec.addonId, spec.date),
6974
+ owner: spec.addonId,
6975
+ level: "addon-state",
6976
+ seq: spec.seq,
6977
+ dependsOn: [],
6978
+ store: "settings",
6979
+ scope: "cluster",
6980
+ onFailure: "block-owner",
6981
+ bodyKind: "procedure",
6982
+ description: "Move the registry enabled flag of every switched-off integration into its instance record body, creating the record when there is none",
6983
+ fixtureMark: "enabled"
6984
+ },
6985
+ procedure: (ports) => moveRegistrySwitchToBody(ports, {
6986
+ addonId: spec.addonId,
6987
+ initialBody: spec.initialBody
6988
+ })
6989
+ };
6990
+ }
6991
+ /** The hub and records sides of {@link registrySwitchToBodyMigration}. */
6992
+ function registrySwitchPortsOver(deps) {
6993
+ const handle = deps.records.kind({
6994
+ name: deps.kind.name,
6995
+ declaration: deps.kind.declaration,
6996
+ schema: record(string(), unknown())
6997
+ });
6998
+ return {
6999
+ listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
7000
+ id: i.id,
7001
+ name: i.name,
7002
+ enabled: i.enabled !== false
7003
+ })),
7004
+ readBody: async (id) => (await handle.get(id))?.data ?? null,
7005
+ createRecord: async (id, body) => {
7006
+ if (await handle.get(id) !== null) return "exists";
7007
+ await handle.put({
7008
+ id,
7009
+ data: body
7010
+ }, { ifRev: 0 });
7011
+ return "created";
7012
+ },
7013
+ switchOff: async (id) => {
7014
+ await handle.patch(id, { [SWITCH_KEY]: false });
7015
+ }
7016
+ };
7017
+ }
6680
7018
  /**
6681
7019
  * Build a {@link DurableState} over a single store key. Transport-agnostic:
6682
7020
  * `read`/`write` are the addon-store or device-store accessors. The whole
@@ -6808,98 +7146,6 @@ var SCOPED_SETTINGS_SCOPES = [
6808
7146
  "device-defaults",
6809
7147
  "node"
6810
7148
  ];
6811
- var GLOBAL_SCOPE = { kind: "global" };
6812
- /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6813
- function globalSecretScope() {
6814
- return GLOBAL_SCOPE;
6815
- }
6816
- function encodeSegment(value) {
6817
- return encodeURIComponent(value);
6818
- }
6819
- function decodeSegment(value) {
6820
- try {
6821
- return decodeURIComponent(value);
6822
- } catch {
6823
- return null;
6824
- }
6825
- }
6826
- /**
6827
- * The field path of a value inside an array item, addressed by the item's id:
6828
- * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6829
- * `providers[authentik].clientSecret`.
6830
- */
6831
- function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6832
- return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6833
- }
6834
- function parseScope(segments) {
6835
- switch (segments[0]) {
6836
- case "global": return {
6837
- scope: GLOBAL_SCOPE,
6838
- used: 1
6839
- };
6840
- case "node": {
6841
- const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6842
- return nodeId === null || nodeId.length === 0 ? null : {
6843
- scope: {
6844
- kind: "node",
6845
- nodeId
6846
- },
6847
- used: 2
6848
- };
6849
- }
6850
- case "device": {
6851
- const raw = segments[1];
6852
- if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6853
- return {
6854
- scope: {
6855
- kind: "device",
6856
- deviceId: Number(raw)
6857
- },
6858
- used: 2
6859
- };
6860
- }
6861
- case "integration": {
6862
- const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6863
- return id === null || id.length === 0 ? null : {
6864
- scope: {
6865
- kind: "integration",
6866
- integrationId: id
6867
- },
6868
- used: 2
6869
- };
6870
- }
6871
- case "row": {
6872
- const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6873
- const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6874
- if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6875
- return {
6876
- scope: {
6877
- kind: "row",
6878
- collection,
6879
- rowId
6880
- },
6881
- used: 3
6882
- };
6883
- }
6884
- default: return null;
6885
- }
6886
- }
6887
- /** Take a ref apart; `null` when it is not a well-formed ref. */
6888
- function parseSecretRef(ref) {
6889
- if (!ref.startsWith("secret://")) return null;
6890
- const segments = ref.slice(9).split("/");
6891
- const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6892
- if (owner === null || owner.length === 0) return null;
6893
- const parsed = parseScope(segments.slice(1));
6894
- if (parsed === null) return null;
6895
- const fieldPath = segments.slice(1 + parsed.used).join("/");
6896
- if (fieldPath.length === 0) return null;
6897
- return {
6898
- owner,
6899
- scope: parsed.scope,
6900
- fieldPath
6901
- };
6902
- }
6903
7149
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6904
7150
  var KeychainWriteRefusedError = class extends Error {
6905
7151
  fieldPath;
@@ -6910,7 +7156,7 @@ var KeychainWriteRefusedError = class extends Error {
6910
7156
  }
6911
7157
  };
6912
7158
  var KEEP = { kind: "keep" };
6913
- function isRecord$6(value) {
7159
+ function isRecord$4(value) {
6914
7160
  return typeof value === "object" && value !== null && !Array.isArray(value);
6915
7161
  }
6916
7162
  function defaultMintId() {
@@ -6923,7 +7169,7 @@ function collectSecretMarkerRefs(value, out = []) {
6923
7169
  return out;
6924
7170
  }
6925
7171
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6926
- else if (isRecord$6(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
7172
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6927
7173
  return out;
6928
7174
  }
6929
7175
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6978,7 +7224,7 @@ function rowId(row, idKey) {
6978
7224
  return null;
6979
7225
  }
6980
7226
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6981
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$6) : [];
7227
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6982
7228
  if (!Array.isArray(incoming)) {
6983
7229
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6984
7230
  return {
@@ -6994,7 +7240,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6994
7240
  const kept = /* @__PURE__ */ new Set();
6995
7241
  const rows = [];
6996
7242
  for (const row of incoming) {
6997
- if (!isRecord$6(row)) {
7243
+ if (!isRecord$4(row)) {
6998
7244
  rows.push(row);
6999
7245
  continue;
7000
7246
  }
@@ -7019,7 +7265,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7019
7265
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
7020
7266
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
7021
7267
  case "object": {
7022
- if (!isRecord$6(incoming)) {
7268
+ if (!isRecord$4(incoming)) {
7023
7269
  if (incoming === void 0) return KEEP;
7024
7270
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
7025
7271
  return {
@@ -7027,7 +7273,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7027
7273
  value: incoming
7028
7274
  };
7029
7275
  }
7030
- const storedObj = isRecord$6(stored) ? stored : {};
7276
+ const storedObj = isRecord$4(stored) ? stored : {};
7031
7277
  return {
7032
7278
  kind: "value",
7033
7279
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -7150,7 +7396,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
7150
7396
  value: items
7151
7397
  };
7152
7398
  }
7153
- if (isRecord$6(v)) {
7399
+ if (isRecord$4(v)) {
7154
7400
  const out = {};
7155
7401
  for (const [k, child] of Object.entries(v)) {
7156
7402
  const s = substitute(child);
@@ -7182,7 +7428,7 @@ var SecretOverwriteRefusedError = class extends Error {
7182
7428
  this.name = "SecretOverwriteRefusedError";
7183
7429
  }
7184
7430
  };
7185
- function isRecord$5(value) {
7431
+ function isRecord$3(value) {
7186
7432
  return typeof value === "object" && value !== null && !Array.isArray(value);
7187
7433
  }
7188
7434
  function resolvedValue(pass, marker) {
@@ -7211,7 +7457,7 @@ function inArray(pass, incoming, stored) {
7211
7457
  return incoming.map((item, index) => {
7212
7458
  const twin = stored[index];
7213
7459
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
7214
- if (isRecord$5(item) && isRecord$5(twin)) return inArrayRow(pass, item, twin);
7460
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
7215
7461
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
7216
7462
  return item;
7217
7463
  });
@@ -7222,7 +7468,7 @@ function inArrayRow(pass, incoming, stored) {
7222
7468
  const twin = stored[key];
7223
7469
  if (isSecretMarker(twin)) {
7224
7470
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
7225
- } else if (isRecord$5(value) && isRecord$5(twin)) out[key] = inArrayRow(pass, value, twin);
7471
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
7226
7472
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
7227
7473
  }
7228
7474
  return out;
@@ -7230,7 +7476,7 @@ function inArrayRow(pass, incoming, stored) {
7230
7476
  async function walk(pass, incoming, stored) {
7231
7477
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
7232
7478
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
7233
- if (!isRecord$5(incoming) || !isRecord$5(stored)) return incoming;
7479
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
7234
7480
  const out = { ...incoming };
7235
7481
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
7236
7482
  return out;
@@ -7261,7 +7507,7 @@ async function restoreUnchangedSecrets(input) {
7261
7507
  function isJsonEqual(a, b) {
7262
7508
  if (Object.is(a, b)) return true;
7263
7509
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
7264
- if (isRecord$5(a) && isRecord$5(b)) {
7510
+ if (isRecord$3(a) && isRecord$3(b)) {
7265
7511
  const keys = Object.keys(a);
7266
7512
  if (keys.length !== Object.keys(b).length) return false;
7267
7513
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -7285,7 +7531,7 @@ function markerKeysOf(blob, owner) {
7285
7531
  }
7286
7532
  function nodeFromStored(value, owner) {
7287
7533
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
7288
- if (!isRecord$5(value)) return null;
7534
+ if (!isRecord$3(value)) return null;
7289
7535
  const children = /* @__PURE__ */ new Map();
7290
7536
  for (const [key, child] of Object.entries(value)) {
7291
7537
  const node = nodeFromStored(child, owner);
@@ -7580,6 +7826,28 @@ var SECRET_RETRY_MAX_MS = 5 * 6e4;
7580
7826
  /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
7581
7827
  var SECRET_CHANGE_DEBOUNCE_MS = 250;
7582
7828
  /**
7829
+ * Pair a catalogue with the function that builds its ports FROM THE MIGRATION API. The one
7830
+ * place a catalogue is bound: a migration reaches nothing a ports binder cannot reach
7831
+ * through `api` (guard `check-migration-ports-surface`).
7832
+ */
7833
+ function migrationSet(catalogue, bindPorts) {
7834
+ return { bind: (api) => defineAddonMigrations(catalogue, bindPorts(api)) };
7835
+ }
7836
+ /** A mixed array is a mistake: the other kind would be dropped without a word. */
7837
+ function refuseMixed(form, kept, dropped) {
7838
+ if (dropped > 0) throw new Error(`runMigrations(${form}): ${dropped} of ${kept + dropped} entries are of the other kind and would be dropped; pass one kind per call`);
7839
+ }
7840
+ function catalogueOf(list) {
7841
+ const kept = list.filter((entry) => !("execute" in entry));
7842
+ refuseMixed("catalogue, (api) => ports", kept.length, list.length - kept.length);
7843
+ return kept;
7844
+ }
7845
+ function boundOf(list) {
7846
+ const kept = list.filter((entry) => "execute" in entry);
7847
+ refuseMixed("bound migrations", kept.length, list.length - kept.length);
7848
+ return kept;
7849
+ }
7850
+ /**
7583
7851
  * Base class for CamStack addons. Eliminates settings boilerplate:
7584
7852
  *
7585
7853
  * - Typed `config` property with automatic resolution from store + defaults
@@ -7746,29 +8014,62 @@ var BaseAddon = class {
7746
8014
  await this.loadScopedSchemas();
7747
8015
  return normalized;
7748
8016
  }
8017
+ async runMigrations(first, second, third) {
8018
+ if (typeof second === "function") return this.runMigrationSets([migrationSet(catalogueOf(first), second)], third);
8019
+ return this.runBound(boundOf(first), second);
8020
+ }
7749
8021
  /**
7750
- * Run this addon's migration catalogue (D987 M3) through the hub's `migrations`
7751
- * engine. Call it at the point of the boot where the data must already have the new
7752
- * shape — `onInitialize`, or `onRestoreDevices` for a migration that needs the
7753
- * restored devices — with the catalogue bound to the addon's ports
7754
- * (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
7755
- *
7756
- * An engine that cannot be reached or refuses the catalogue is logged and runs
7757
- * nothing; the boot continues. A migration that FAILED (or was blocked by one)
7758
- * and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
7759
- * serve data whose shape it cannot trust; `tolerate` migrations never do.
7760
- *
7761
- * ALWAYS pass the whole catalogue; a phase that must run only some of it passes
7762
- * `{ only: [ids] }` — never a filtered catalogue (the engine would judge the
7763
- * omitted applied ids "newer").
8022
+ * Several catalogues of ONE owner in one declaration (the engine replaces an owner's
8023
+ * catalogue on every declare, so two calls would each judge the other's ids "newer").
8024
+ * Build each entry with `migrationSet(catalogue, (api) => ports)`.
7764
8025
  */
7765
- async runMigrations(migrations, options) {
8026
+ async runMigrationSets(sets, options) {
8027
+ const api = this.ctx.migrationApi;
8028
+ if (api === void 0) throw new Error(`${this.ctx.id}: the migration API is not available on this context`);
8029
+ return this.runBound(sets.flatMap((set) => set.bind(api)), options);
8030
+ }
8031
+ /**
8032
+ * A device addon states its instance kind once, before its migrations run, and the one-switch
8033
+ * migration (registry `enabled` to the instance body, epic #440 step 3) joins whatever
8034
+ * catalogue the addon runs, in the SAME declaration (the engine replaces an owner's catalogue
8035
+ * on every declare).
8036
+ */
8037
+ declareRegistrySwitch(spec) {
8038
+ this.registrySwitchSpec = spec;
8039
+ }
8040
+ registrySwitchSpec = null;
8041
+ registrySwitchBound() {
8042
+ const spec = this.registrySwitchSpec;
8043
+ if (spec === null) return [];
8044
+ const api = this.ctx.migrationApi;
8045
+ if (api === void 0) {
8046
+ this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
8047
+ return [];
8048
+ }
8049
+ return migrationSet([registrySwitchToBodyMigration({
8050
+ addonId: this.ctx.id,
8051
+ date: "2026-11-06",
8052
+ seq: 1e3,
8053
+ initialBody: spec.initialBody
8054
+ })], (a) => registrySwitchPortsOver({
8055
+ api: integrationRowsApiOver(a),
8056
+ records: switchRecordsOverMigrationApi(a),
8057
+ kind: spec.kind
8058
+ })).bind(api);
8059
+ }
8060
+ async runBound(declared, options) {
8061
+ const added = this.registrySwitchBound();
8062
+ const migrations = [...declared, ...added];
8063
+ const phased = options?.only === void 0 || added.length === 0 ? options : {
8064
+ ...options,
8065
+ only: [...options.only, ...added.map((m) => m.meta.id)]
8066
+ };
7766
8067
  const api = this.ctx.api.migrations;
7767
8068
  const report = await runAddonMigrations({
7768
8069
  declareOwner: (input) => api.declareOwner.mutate(input),
7769
8070
  startMigration: (input) => api.startMigration.mutate(input),
7770
8071
  finishMigration: (input) => api.finishMigration.mutate(input)
7771
- }, migrations, this.ctx.logger, options);
8072
+ }, migrations, this.ctx.logger, phased);
7772
8073
  if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
7773
8074
  return report;
7774
8075
  }
@@ -8841,114 +9142,94 @@ function normalizeAddonInitResult(result) {
8841
9142
  if (Array.isArray(result)) return { providers: result };
8842
9143
  return result;
8843
9144
  }
8844
- var PREFIX = "records/";
8845
- /** The base of every records failure. `detail` is the human part of the message. */
8846
- var RecordsError = class extends Error {
8847
- code;
8848
- detail;
8849
- constructor(code, detail) {
8850
- super(`${PREFIX}${code}: ${detail}`);
8851
- this.name = "RecordsError";
8852
- this.code = code;
8853
- this.detail = detail;
8854
- }
8855
- };
8856
- var InvalidRecordError = class extends RecordsError {
8857
- constructor(detail) {
8858
- super("invalid-record", detail);
8859
- this.name = "InvalidRecordError";
8860
- }
8861
- };
8862
- /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
8863
- var DeclarationRefusedError = class extends RecordsError {
8864
- constructor(detail) {
8865
- super("declaration-refused", detail);
8866
- this.name = "DeclarationRefusedError";
8867
- }
8868
- };
8869
- /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8870
- /** The files a kind may live in. `history` is device-history's (D850), never records. */
8871
- var RECORD_DATABASES = ["settings", "events"];
8872
- /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8873
- var RECORD_CLASSES = [
8874
- "config",
8875
- "ledger",
8876
- "audit",
8877
- "mirror",
8878
- "ephemeral"
8879
- ];
8880
- var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8881
- var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8882
- var RECORD_BATCH_MAX = 1e3;
8883
- var RECORD_QUERY_MAX = 1e3;
8884
- /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
8885
- var RECORD_SETTINGS_MAX_ROWS = 5e4;
9145
+ object({
9146
+ field: string().min(1),
9147
+ on: literal("advance")
9148
+ });
8886
9149
  /**
8887
- * Secret fields of a record, addressed the way a Zod schema declares them
8888
- * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8889
- * (`auth.accessToken`, `headers[].value`).
8890
- *
8891
- * `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
8892
- * names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
8893
- * key releases exactly that key's secret.
9150
+ * Output schema shared by the contribution + live methods.
8894
9151
  *
8895
- * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8896
- * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8897
- * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8898
- * leaf names its element: `headers[X-Api].value`.
9152
+ * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
9153
+ * tabs[]) without importing from `../interfaces/config-ui.js` — a
9154
+ * concrete-but-lenient Zod object keeps tRPC output inference happy
9155
+ * (using `z.unknown()` here collapses unrelated router branches to
9156
+ * `unknown` when the generator re-inlines the huge AppRouter type).
8899
9157
  *
8900
- * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
9158
+ * `.passthrough()` on sections/fields accepts whatever FormBuilder
9159
+ * extensions the caller adds (showWhen, displayScale, …) without
9160
+ * rebuilding every time a new field kind is introduced.
8901
9161
  */
8902
- /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8903
- function parseSecretPath(path) {
8904
- if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8905
- return path.split(".").map((raw) => {
8906
- const each = raw.endsWith("[]");
8907
- const map = raw.endsWith("{}");
8908
- const key = each || map ? raw.slice(0, -2) : raw;
8909
- if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8910
- return {
8911
- key,
8912
- each,
8913
- map
8914
- };
8915
- });
9162
+ var ContributionSectionSchema = object({
9163
+ id: string(),
9164
+ title: string(),
9165
+ description: string().optional(),
9166
+ style: _enum(["card", "accordion"]).optional(),
9167
+ defaultCollapsed: boolean().optional(),
9168
+ columns: union([
9169
+ literal(1),
9170
+ literal(2),
9171
+ literal(3),
9172
+ literal(4)
9173
+ ]).optional(),
9174
+ tab: string().optional(),
9175
+ location: _enum([
9176
+ "settings",
9177
+ "top-tab",
9178
+ "hero"
9179
+ ]).optional(),
9180
+ order: number().optional(),
9181
+ fields: array(any())
9182
+ });
9183
+ object({
9184
+ tabs: array(object({
9185
+ id: string(),
9186
+ label: string(),
9187
+ icon: string(),
9188
+ order: number().optional()
9189
+ })).optional(),
9190
+ sections: array(ContributionSectionSchema)
9191
+ }).nullable();
9192
+ object({ deviceId: number() }), object({ deviceId: number() }), object({
9193
+ deviceId: number(),
9194
+ patch: record(string(), unknown())
9195
+ }), object({ success: literal(true) });
9196
+ object({ deviceId: number() }), unknown().nullable();
9197
+ function method(input, output, options) {
9198
+ return {
9199
+ input,
9200
+ output,
9201
+ kind: options?.kind ?? "query",
9202
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
9203
+ ...options?.access !== void 0 ? { access: options.access } : {},
9204
+ ...options?.role !== void 0 ? { role: options.role } : {},
9205
+ ...options?.caller !== void 0 ? { caller: options.caller } : {},
9206
+ timeoutMs: options?.timeoutMs
9207
+ };
8916
9208
  }
8917
- /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8918
- function secretArrayPrefixes(path) {
8919
- const segments = parseSecretPath(path);
8920
- const prefixes = [];
8921
- const walked = [];
8922
- for (const segment of segments) {
8923
- walked.push(segment.key);
8924
- if (segment.each) prefixes.push(walked.join("."));
8925
- }
8926
- return prefixes;
9209
+ /**
9210
+ * A wrapper/system-only method: served exclusively by the cap's system-level
9211
+ * provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
9212
+ * driver natives don't stub out a wrapper concern (e.g. a cross-device cache
9213
+ * overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
9214
+ */
9215
+ function systemMethod(input, output, options) {
9216
+ return {
9217
+ ...method(input, output, options),
9218
+ systemOnly: true
9219
+ };
8927
9220
  }
8928
9221
  /**
8929
- * The share-view scope kinds a share-link token can carry. The hub mints
8930
- * and validates them (`ShareViewGrantSchema` builds its
8931
- * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9222
+ * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
9223
+ * on `InferProvider`. The `providerOptional: true` literal is what
9224
+ * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
9225
+ * for when this is the honest answer and when it is a soft stub.
8932
9226
  */
8933
- var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
8934
- /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
8935
- var PeerBytesTicketSchema = object({
8936
- /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
8937
- url: string().min(1),
8938
- /**
8939
- * The HOST node this URL means something on — the hub or a named agent,
8940
- * never a runner. {@link AddonPeerBytes.open} compares it to its own and
8941
- * refuses `cross-node` by name when they differ, without dialling.
8942
- */
8943
- hostNodeId: string().min(1),
8944
- expiresAtMs: number().int().nonnegative(),
8945
- /**
8946
- * What the producer DECLARED the body to be, when it knows — `null` when it
8947
- * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
8948
- * must be able to tell "the producer did not say" from "the body is empty".
8949
- */
8950
- declaredBytes: number().int().nonnegative().nullable()
8951
- });
9227
+ function optionalMethod(input, output, options) {
9228
+ return {
9229
+ ...method(input, output, options),
9230
+ providerOptional: true
9231
+ };
9232
+ }
8952
9233
  function defOf(schema) {
8953
9234
  const zodBag = Reflect.get(schema, "_zod");
8954
9235
  if (typeof zodBag !== "object" || zodBag === null) return {};
@@ -9167,94 +9448,30 @@ function defineRecordKinds(specs) {
9167
9448
  }
9168
9449
  return out;
9169
9450
  }
9170
- object({
9171
- field: string().min(1),
9172
- on: literal("advance")
9173
- });
9174
9451
  /**
9175
- * Output schema shared by the contribution + live methods.
9176
- *
9177
- * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
9178
- * tabs[]) without importing from `../interfaces/config-ui.js` — a
9179
- * concrete-but-lenient Zod object keeps tRPC output inference happy
9180
- * (using `z.unknown()` here collapses unrelated router branches to
9181
- * `unknown` when the generator re-inlines the huge AppRouter type).
9182
- *
9183
- * `.passthrough()` on sections/fields accepts whatever FormBuilder
9184
- * extensions the caller adds (showWhen, displayScale, …) without
9185
- * rebuilding every time a new field kind is introduced.
9452
+ * The share-view scope kinds a share-link token can carry. The hub mints
9453
+ * and validates them (`ShareViewGrantSchema` builds its
9454
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9186
9455
  */
9187
- var ContributionSectionSchema = object({
9188
- id: string(),
9189
- title: string(),
9190
- description: string().optional(),
9191
- style: _enum(["card", "accordion"]).optional(),
9192
- defaultCollapsed: boolean().optional(),
9193
- columns: union([
9194
- literal(1),
9195
- literal(2),
9196
- literal(3),
9197
- literal(4)
9198
- ]).optional(),
9199
- tab: string().optional(),
9200
- location: _enum([
9201
- "settings",
9202
- "top-tab",
9203
- "hero"
9204
- ]).optional(),
9205
- order: number().optional(),
9206
- fields: array(any())
9456
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9457
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9458
+ var PeerBytesTicketSchema = object({
9459
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9460
+ url: string().min(1),
9461
+ /**
9462
+ * The HOST node this URL means something on — the hub or a named agent,
9463
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9464
+ * refuses `cross-node` by name when they differ, without dialling.
9465
+ */
9466
+ hostNodeId: string().min(1),
9467
+ expiresAtMs: number().int().nonnegative(),
9468
+ /**
9469
+ * What the producer DECLARED the body to be, when it knows — `null` when it
9470
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9471
+ * must be able to tell "the producer did not say" from "the body is empty".
9472
+ */
9473
+ declaredBytes: number().int().nonnegative().nullable()
9207
9474
  });
9208
- object({
9209
- tabs: array(object({
9210
- id: string(),
9211
- label: string(),
9212
- icon: string(),
9213
- order: number().optional()
9214
- })).optional(),
9215
- sections: array(ContributionSectionSchema)
9216
- }).nullable();
9217
- object({ deviceId: number() }), object({ deviceId: number() }), object({
9218
- deviceId: number(),
9219
- patch: record(string(), unknown())
9220
- }), object({ success: literal(true) });
9221
- object({ deviceId: number() }), unknown().nullable();
9222
- function method(input, output, options) {
9223
- return {
9224
- input,
9225
- output,
9226
- kind: options?.kind ?? "query",
9227
- ...options?.auth !== void 0 ? { auth: options.auth } : {},
9228
- ...options?.access !== void 0 ? { access: options.access } : {},
9229
- ...options?.role !== void 0 ? { role: options.role } : {},
9230
- ...options?.caller !== void 0 ? { caller: options.caller } : {},
9231
- timeoutMs: options?.timeoutMs
9232
- };
9233
- }
9234
- /**
9235
- * A wrapper/system-only method: served exclusively by the cap's system-level
9236
- * provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
9237
- * driver natives don't stub out a wrapper concern (e.g. a cross-device cache
9238
- * overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
9239
- */
9240
- function systemMethod(input, output, options) {
9241
- return {
9242
- ...method(input, output, options),
9243
- systemOnly: true
9244
- };
9245
- }
9246
- /**
9247
- * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
9248
- * on `InferProvider`. The `providerOptional: true` literal is what
9249
- * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
9250
- * for when this is the honest answer and when it is a soft stub.
9251
- */
9252
- function optionalMethod(input, output, options) {
9253
- return {
9254
- ...method(input, output, options),
9255
- providerOptional: true
9256
- };
9257
- }
9258
9475
  var READING_QUANTITIES = [
9259
9476
  "temperature",
9260
9477
  "pressure",
@@ -10389,7 +10606,6 @@ var CAP_NAMES = Object.freeze([
10389
10606
  "climate-control",
10390
10607
  "color",
10391
10608
  "composer",
10392
- "connection-test",
10393
10609
  "connectivity",
10394
10610
  "consumables",
10395
10611
  "contact",
@@ -11536,6 +11752,10 @@ Object.freeze({
11536
11752
  "all",
11537
11753
  "one"
11538
11754
  ]
11755
+ },
11756
+ {
11757
+ "path": "positionUpdatedAt",
11758
+ "valueType": "number"
11539
11759
  }
11540
11760
  ],
11541
11761
  "meter": [{
@@ -11790,22 +12010,6 @@ Object.freeze({
11790
12010
  "path": "pumpRunning",
11791
12011
  "valueType": "boolean"
11792
12012
  },
11793
- {
11794
- "path": "lastDrink",
11795
- "valueType": "number"
11796
- },
11797
- {
11798
- "path": "currentHourDrink",
11799
- "valueType": "number"
11800
- },
11801
- {
11802
- "path": "last24hDrink",
11803
- "valueType": "number"
11804
- },
11805
- {
11806
- "path": "todayDrink",
11807
- "valueType": "number"
11808
- },
11809
12013
  {
11810
12014
  "path": "error",
11811
12015
  "valueType": "string"
@@ -12371,6 +12575,59 @@ Object.freeze({
12371
12575
  }
12372
12576
  ]
12373
12577
  });
12578
+ Object.freeze({
12579
+ "actions": { "run": 363e4 },
12580
+ "audio-analyzer": { "classify": 3e4 },
12581
+ "custom-model-registry": { "importModelBundle": 18e5 },
12582
+ "database-snapshot": { "writeSnapshot": 18e5 },
12583
+ "device-manager": {
12584
+ "migrateDevice": 72e4,
12585
+ "runDiscoverySweep": 12e4
12586
+ },
12587
+ "device-provider": { "reloadDevice": 18e4 },
12588
+ "llm": {
12589
+ "generate": 6e5,
12590
+ "generateVision": 6e5,
12591
+ "testProfile": 6e5
12592
+ },
12593
+ "llm-runtime": {
12594
+ "complete": 6e5,
12595
+ "completeApple": 6e5,
12596
+ "ensureStarted": 6e5,
12597
+ "installModel": 36e5
12598
+ },
12599
+ "local-network": { "scanNetwork": 9e4 },
12600
+ "model-convert": { "convert": 6e5 },
12601
+ "pipeline-analytics": {
12602
+ "addRetrainFrameFromRecording": 6e4,
12603
+ "offerRetrainArchive": 12e4,
12604
+ "proposeRetrainAnnotationsWithLlm": 18e4,
12605
+ "resolveRetrainTrainingCorpus": 6e4,
12606
+ "writeRetrainArchive": 36e5
12607
+ },
12608
+ "server-management": { "applyServerUpdate": 96e4 },
12609
+ "terminal-session": { "pullOutput": 15e3 },
12610
+ "training": {
12611
+ "canaryResult": 12e4,
12612
+ "cancelJob": 12e4,
12613
+ "planJob": 6e4,
12614
+ "registerResult": 18e5,
12615
+ "rollbackCanary": 12e4,
12616
+ "startJob": 12e4,
12617
+ "startJobBatch": 12e4
12618
+ },
12619
+ "training-provider": {
12620
+ "cancelJob": 6e4,
12621
+ "cleanupJob": 3e5,
12622
+ "getJob": 6e4,
12623
+ "listJobEvents": 6e4,
12624
+ "listJobs": 12e4,
12625
+ "offerArtifact": 3e5,
12626
+ "readResult": 3e5,
12627
+ "submitJob": 18e5,
12628
+ "uploadDataset": 72e5
12629
+ }
12630
+ });
12374
12631
  object({
12375
12632
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
12376
12633
  params: record(string(), union([string(), number()])).optional()
@@ -12400,7 +12657,7 @@ function sleep(ms) {
12400
12657
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
12401
12658
  }
12402
12659
  //#endregion
12403
- //#region ../types/dist/composition-pOHbTzRB.mjs
12660
+ //#region ../types/dist/composition-BmBHuDTQ.mjs
12404
12661
  /**
12405
12662
  * The ffmpeg build every CamStack node downloads, per platform and arch.
12406
12663
  *
@@ -12833,7 +13090,7 @@ var table = {
12833
13090
  },
12834
13091
  dwell: {
12835
13092
  minArgs: 3,
12836
- maxArgs: 3,
13093
+ maxArgs: 4,
12837
13094
  apply: () => {
12838
13095
  throw new ExpressionEvalError("dwell: stateful evaluation context is required");
12839
13096
  }
@@ -13915,6 +14172,432 @@ var IntegrationInstanceRefSchema = object({
13915
14172
  ]),
13916
14173
  candidateStableId: string().optional()
13917
14174
  });
14175
+ /**
14176
+ * notification-output — canonical, capability-gated notification delivery.
14177
+ *
14178
+ * Apprise-derived model (see
14179
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14180
+ * callers emit ONE canonical `Notification`; each provider declares a
14181
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14182
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14183
+ * message to what the kind supports — callers never special-case a service.
14184
+ *
14185
+ * DESIGN DECISIONS (locked):
14186
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14187
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14188
+ * cap. Rationale: the admin UI needs one uniform surface across the
14189
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14190
+ * alternative would fork the UI per addon and cannot host the
14191
+ * discovery→adopt flow.
14192
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14193
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14194
+ * registered provider (notifiers addon + HA addon) so one catalog is
14195
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14196
+ * `addonId` the generated collection router extracts from the call input.
14197
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14198
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14199
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14200
+ * base64 fallback needed.
14201
+ *
14202
+ * TODO (deferred, closed-set change — separate decision): add
14203
+ * `providerKind: 'notify'` so notification providers surface on the unified
14204
+ * admin "Integrations" page.
14205
+ */
14206
+ /**
14207
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14208
+ * adapter picks what it supports and the degrade engine filters the rest.
14209
+ */
14210
+ var AttachmentMediaTypeSchema = _enum([
14211
+ "image",
14212
+ "video",
14213
+ "gif",
14214
+ "audio",
14215
+ "icon"
14216
+ ]);
14217
+ /**
14218
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14219
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14220
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14221
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14222
+ */
14223
+ var AttachmentSchema = object({
14224
+ mediaType: AttachmentMediaTypeSchema,
14225
+ url: string().optional(),
14226
+ bytes: _instanceof(Uint8Array).optional(),
14227
+ mime: string().optional(),
14228
+ name: string().optional()
14229
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14230
+ var NotificationFormatSchema = _enum([
14231
+ "text",
14232
+ "markdown",
14233
+ "html"
14234
+ ]);
14235
+ /**
14236
+ * The CLOSED icon vocabulary an action button may use.
14237
+ *
14238
+ * A closed set, not a free string, and that is the whole point: an arbitrary
14239
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
14240
+ * notices — the same class of gap as a zone vocabulary nothing produced
14241
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14242
+ * declares `actionIcons: false` and the degrade engine strips the field.
14243
+ *
14244
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14245
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
14246
+ * differently.
14247
+ *
14248
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14249
+ *
14250
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
14251
+ * the whole set onto its own renderer's vocabulary through a
14252
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14253
+ * fallback, so adding a member here fails every adapter's build until someone
14254
+ * decides its glyph, which is the only place that decision can be made
14255
+ * honestly.
14256
+ *
14257
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14258
+ * `disarm` straight through; iOS feeds that string to
14259
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14260
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
14261
+ * mapping, and "the field is documented" is not "the value renders".
14262
+ *
14263
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
14264
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14265
+ * so an addon that emits a token the running hub does not know does not lose an
14266
+ * icon — its whole `send` fails Zod validation and the notification never
14267
+ * arrives. Never emit a new token from an addon before the train carrying it.
14268
+ */
14269
+ var NotificationActionIconSchema = _enum([
14270
+ "acknowledge",
14271
+ "dismiss",
14272
+ "silence",
14273
+ "snooze",
14274
+ "view",
14275
+ "play",
14276
+ "open",
14277
+ "close",
14278
+ "lock",
14279
+ "unlock",
14280
+ "arm",
14281
+ "arm-home",
14282
+ "arm-away",
14283
+ "arm-night",
14284
+ "disarm",
14285
+ "light",
14286
+ "alert",
14287
+ "camera"
14288
+ ]);
14289
+ /** A single tap-through action button. */
14290
+ var NotificationActionSchema = object({
14291
+ id: string(),
14292
+ label: string(),
14293
+ url: string().optional(),
14294
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14295
+ icon: NotificationActionIconSchema.optional(),
14296
+ /**
14297
+ * Renders in a warning style where the notifier supports it.
14298
+ *
14299
+ * A HINT, never a gate. The callback's authority is its token and nothing
14300
+ * else — see `notification-center/action-token.ts` for what that does and
14301
+ * does not buy.
14302
+ */
14303
+ destructive: boolean().optional(),
14304
+ /**
14305
+ * How the tap should REACH the url.
14306
+ *
14307
+ * `navigate` (absent, and every button authored before this field) opens it:
14308
+ * the phone leaves the notification and shows whatever the callback returns.
14309
+ * That is right for a button whose answer the operator wants to read.
14310
+ *
14311
+ * `background` fires it as a POST and stays put. It exists for the buttons
14312
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
14313
+ * an answer to the notification, and being thrown into a browser tab to
14314
+ * confirm it costs more attention than the notification did. A backend that
14315
+ * cannot do a background call renders it as an ordinary link (the adapters
14316
+ * fall back rather than dropping the button), so this is a preference, never
14317
+ * a requirement.
14318
+ */
14319
+ mode: _enum(["navigate", "background"]).optional()
14320
+ });
14321
+ /** A delivery parameter value: what a notifier declared it takes. */
14322
+ var DeliveryParamValueSchema = union([
14323
+ string(),
14324
+ number(),
14325
+ boolean()
14326
+ ]);
14327
+ /**
14328
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
14329
+ * addresses a target of that kind may set it; a kind that declares nothing is
14330
+ * never handed one. The admin UI derives its control from this descriptor —
14331
+ * no editor knows a service by name.
14332
+ *
14333
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14334
+ * run on the addon cap path).
14335
+ */
14336
+ var DeliveryParamSchema = object({
14337
+ key: string().min(1),
14338
+ label: string(),
14339
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
14340
+ labelKey: string().optional(),
14341
+ type: _enum([
14342
+ "enum",
14343
+ "number",
14344
+ "boolean",
14345
+ "string"
14346
+ ]),
14347
+ /** `enum` only: the closed set of accepted values. */
14348
+ options: array(object({
14349
+ value: string(),
14350
+ label: string()
14351
+ })).optional(),
14352
+ /** `number` only. */
14353
+ min: number().optional(),
14354
+ max: number().optional(),
14355
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14356
+ default: DeliveryParamValueSchema.optional()
14357
+ });
14358
+ /**
14359
+ * The canonical notification. `body` is the only hard field (Apprise model).
14360
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14361
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14362
+ * the adapter maps this ordinal onto its native level. `level?` is an
14363
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14364
+ * `priority` for that one target.
14365
+ */
14366
+ var NotificationSchema = object({
14367
+ body: string(),
14368
+ title: string().optional(),
14369
+ format: NotificationFormatSchema.default("text"),
14370
+ priority: number().int().min(1).max(5).default(3),
14371
+ level: string().optional(),
14372
+ attachments: array(AttachmentSchema).optional(),
14373
+ clickUrl: string().optional(),
14374
+ actions: array(NotificationActionSchema).optional(),
14375
+ sound: string().optional(),
14376
+ ttl: number().optional(),
14377
+ tag: string().optional(),
14378
+ deviceId: number().optional(),
14379
+ eventId: string().optional(),
14380
+ metadata: record(string(), unknown()).optional(),
14381
+ /**
14382
+ * Values for the parameters the target's kind DECLARES in
14383
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14384
+ * declaration by the sender; a notifier reads only the keys it declared.
14385
+ */
14386
+ delivery: record(string(), DeliveryParamValueSchema).optional()
14387
+ });
14388
+ /** One declared native severity/priority level for a kind. */
14389
+ var TargetKindLevelSchema = object({
14390
+ id: string(),
14391
+ label: string(),
14392
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14393
+ ordinal: number().int().min(1).max(5).nullable(),
14394
+ flags: object({
14395
+ critical: boolean().optional(),
14396
+ silent: boolean().optional(),
14397
+ noPush: boolean().optional()
14398
+ }).optional(),
14399
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14400
+ requires: array(string()).optional(),
14401
+ description: string().optional()
14402
+ });
14403
+ /** The full capability block consulted before dispatch. */
14404
+ var TargetKindCapsSchema = object({
14405
+ attachments: object({
14406
+ mediaTypes: array(AttachmentMediaTypeSchema),
14407
+ mode: _enum([
14408
+ "url",
14409
+ "bytes",
14410
+ "both"
14411
+ ]),
14412
+ max: number().int().nonnegative(),
14413
+ maxBytes: number().int().positive().optional()
14414
+ }),
14415
+ /** Max action buttons (0 = none). */
14416
+ actions: number().int().nonnegative(),
14417
+ /**
14418
+ * Whether this kind renders a per-action ICON.
14419
+ *
14420
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14421
+ * run on the addon cap path — three production failures in one day taught
14422
+ * this repo that once. Absent is read as false by the degrade engine, which
14423
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
14424
+ * assumed and dropped costs the operator's trust in the field.
14425
+ */
14426
+ actionIcons: boolean().optional(),
14427
+ levels: array(TargetKindLevelSchema),
14428
+ format: array(NotificationFormatSchema),
14429
+ clickUrl: boolean(),
14430
+ sound: boolean(),
14431
+ ttl: boolean(),
14432
+ bodyMaxLen: number().int().positive()
14433
+ });
14434
+ /**
14435
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14436
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14437
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14438
+ * the union is large and not meant for runtime validation here; the exported
14439
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14440
+ */
14441
+ var ConfigSchemaPassthrough$4 = unknown();
14442
+ var TargetKindSchema = object({
14443
+ kind: string(),
14444
+ label: string(),
14445
+ icon: string(),
14446
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14447
+ addonId: string(),
14448
+ /**
14449
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
14450
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
14451
+ * when the addon bundles no icon for that kind — the client then falls back
14452
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
14453
+ *
14454
+ * Root-relative on purpose: it resolves against whatever origin serves a web
14455
+ * client, and a native client joins it onto its own hub base.
14456
+ *
14457
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
14458
+ * field that survived only because the runtime cap-router forwards provider
14459
+ * output verbatim — so every consumer had to re-declare it by hand to stop
14460
+ * its own Zod parse from stripping it, and the whole arrangement would have
14461
+ * broken silently the moment output validation was tightened anywhere.
14462
+ */
14463
+ iconUrl: string().optional(),
14464
+ /**
14465
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
14466
+ *
14467
+ * The server knows this and therefore says it, because the client cannot
14468
+ * safely guess: a React-Native client renders SVG and raster through two
14469
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
14470
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
14471
+ * placeholder glyph for every vector icon while the web build looked fine.
14472
+ *
14473
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
14474
+ * not been updated — a client that cannot determine the type should prefer
14475
+ * its raster path, which is the safe default for an unknown image.
14476
+ */
14477
+ iconMediaType: string().optional(),
14478
+ configSchema: ConfigSchemaPassthrough$4,
14479
+ /**
14480
+ * The config keys that decide WHERE this kind's secrets are sent (server,
14481
+ * base URL, instance, chat, recipient). A save that changes any of them
14482
+ * while leaving a secret redacted is refused by the provider (D634), so an
14483
+ * editor uses this to ask for the secret on exactly those edits instead of
14484
+ * on every edit.
14485
+ *
14486
+ * Optional: absent from a provider that holds no secret (the Home Assistant
14487
+ * kinds) and from a provider older than this field — an editor that finds
14488
+ * it absent must assume ANY edit may need the secret.
14489
+ */
14490
+ destinationKeys: array(string()).optional(),
14491
+ supportsDiscovery: boolean(),
14492
+ /**
14493
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
14494
+ * Absent = none; the rule editor then offers nothing.
14495
+ */
14496
+ deliveryParams: array(DeliveryParamSchema).optional(),
14497
+ caps: TargetKindCapsSchema
14498
+ });
14499
+ /**
14500
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14501
+ * (return a presence marker only) when serving `listTargets` — never
14502
+ * round-trip a stored secret to the UI.
14503
+ */
14504
+ var TargetSchema = object({
14505
+ id: string(),
14506
+ name: string(),
14507
+ kind: string(),
14508
+ addonId: string(),
14509
+ enabled: boolean(),
14510
+ config: record(string(), unknown())
14511
+ });
14512
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14513
+ var DiscoveredTargetSchema = object({
14514
+ kind: string(),
14515
+ suggestedName: string(),
14516
+ config: record(string(), unknown())
14517
+ });
14518
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14519
+ var RenderedAsSchema = object({
14520
+ level: string(),
14521
+ format: NotificationFormatSchema,
14522
+ attachmentsSent: number().int().nonnegative(),
14523
+ actionsSent: number().int().nonnegative(),
14524
+ truncated: boolean(),
14525
+ dropped: array(string())
14526
+ });
14527
+ var SendResultSchema = object({
14528
+ success: boolean(),
14529
+ error: string().optional(),
14530
+ renderedAs: RenderedAsSchema.optional()
14531
+ });
14532
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14533
+ var TestResultSchema = SendResultSchema;
14534
+ /**
14535
+ * Pre-save credential probe against a partial (unsaved) target config.
14536
+ * `resolvedUrl` never includes secrets (token stripped from path).
14537
+ */
14538
+ var ProbeTargetConfigResultSchema = object({
14539
+ ok: boolean(),
14540
+ resolvedUrl: string(),
14541
+ httpStatus: number().int().optional(),
14542
+ stateInstance: string().optional(),
14543
+ error: string().optional()
14544
+ });
14545
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14546
+ kind: string(),
14547
+ config: record(string(), unknown()).optional(),
14548
+ /**
14549
+ * When editing / duplicating, the blank password field never round-trips
14550
+ * the stored token. Pass the source target id so the provider can restore
14551
+ * secrets server-side before dialling (same merge as upsert).
14552
+ */
14553
+ targetId: string().optional()
14554
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
14555
+ kind: string(),
14556
+ config: record(string(), unknown()),
14557
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
14558
+ targetId: string().optional()
14559
+ }), ProbeTargetConfigResultSchema, {
14560
+ kind: "mutation",
14561
+ auth: "admin"
14562
+ }), method(object({
14563
+ targetId: string(),
14564
+ notification: NotificationSchema
14565
+ }), SendResultSchema, {
14566
+ kind: "mutation",
14567
+ auth: "admin"
14568
+ }), method(object({
14569
+ targetId: string(),
14570
+ sample: NotificationSchema.optional()
14571
+ }), TestResultSchema, {
14572
+ kind: "mutation",
14573
+ auth: "admin"
14574
+ }), method(object({
14575
+ target: TargetSchema,
14576
+ /**
14577
+ * Duplicate flow: create a NEW target id while copying secrets from an
14578
+ * existing row. The UI never holds the stored token; blank / redacted
14579
+ * password fields are restored from this source (D634 still applies if
14580
+ * destinations diverge without a re-typed secret).
14581
+ */
14582
+ cloneSecretsFrom: string().optional()
14583
+ }), TargetSchema, {
14584
+ kind: "mutation",
14585
+ auth: "admin"
14586
+ }), method(object({ targetId: string() }), _void(), {
14587
+ kind: "mutation",
14588
+ auth: "admin"
14589
+ }), method(object({
14590
+ targetId: string(),
14591
+ enabled: boolean()
14592
+ }), _void(), {
14593
+ kind: "mutation",
14594
+ auth: "admin"
14595
+ });
14596
+ looseObject({
14597
+ name: string().min(1),
14598
+ enabled: boolean().optional()
14599
+ });
14600
+ TargetSchema.omit({ id: true });
13918
14601
  var EncodeProfileSchema = object({
13919
14602
  video: object({
13920
14603
  codec: _enum([
@@ -16380,6 +17063,39 @@ var UnstampedEventMediaCountSchema = object({
16380
17063
  /** Sum across both, or `null` when either lane could not be counted. */
16381
17064
  total: number().int().nonnegative().nullable()
16382
17065
  }).nullable();
17066
+ /**
17067
+ * Where the stored event media sits, per storage location: how many media rows
17068
+ * and how many bytes carry each location id, how many carry none (legacy,
17069
+ * resolved to the default `eventMedia` location), and how many name a location
17070
+ * that was not asked about (a deleted or never-listed one).
17071
+ *
17072
+ * One covering-index aggregate per asked location plus the NULL one, and one
17073
+ * unfiltered total that scans the covering index: O(rows), not a walk of the
17074
+ * rows themselves. `unlisted` is total minus the ASKED locations minus NULL, so
17075
+ * it is a deleted location only when every location id was asked.
17076
+ * `null` is "could not be measured", never zero.
17077
+ */
17078
+ var MediaLocationCensusInputSchema = object({ locationIds: array(string().min(1)).max(50).readonly() });
17079
+ var MediaLocationCensusSchema = object({
17080
+ locations: array(object({
17081
+ locationId: string(),
17082
+ rows: number().int().nonnegative(),
17083
+ bytes: number().nonnegative()
17084
+ })).readonly(),
17085
+ unstamped: object({
17086
+ rows: number().int().nonnegative(),
17087
+ bytes: number().nonnegative()
17088
+ }),
17089
+ /** Rows stamped with a location id that was not in the asked list. */
17090
+ unlisted: object({
17091
+ rows: number().int().nonnegative(),
17092
+ bytes: number().nonnegative()
17093
+ }),
17094
+ total: object({
17095
+ rows: number().int().nonnegative(),
17096
+ bytes: number().nonnegative()
17097
+ })
17098
+ });
16383
17099
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
16384
17100
  /** The independently selectable logical storage classes — every class
16385
17101
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -20378,31 +21094,21 @@ var APPLIANCE_CAP_VOCABULARY = {
20378
21094
  "pet-fountain": {
20379
21095
  scope: "device",
20380
21096
  noun: t("Pet fountain", "Fontana per animali"),
20381
- actions: [
20382
- {
20383
- id: "petFountain.pumpOn",
20384
- method: "setPump",
20385
- label: t("Pump on", "Pompa accesa"),
20386
- phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
20387
- icon: "play",
20388
- args: { on: true }
20389
- },
20390
- {
20391
- id: "petFountain.pumpOff",
20392
- method: "setPump",
20393
- label: t("Pump off", "Pompa spenta"),
20394
- phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
20395
- icon: "square",
20396
- args: { on: false }
20397
- },
20398
- {
20399
- id: "petFountain.resetDailyConsumption",
20400
- method: "resetDailyConsumption",
20401
- label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
20402
- phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
20403
- icon: "rotate-ccw"
20404
- }
20405
- ],
21097
+ actions: [{
21098
+ id: "petFountain.pumpOn",
21099
+ method: "setPump",
21100
+ label: t("Pump on", "Pompa accesa"),
21101
+ phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
21102
+ icon: "play",
21103
+ args: { on: true }
21104
+ }, {
21105
+ id: "petFountain.pumpOff",
21106
+ method: "setPump",
21107
+ label: t("Pump off", "Pompa spenta"),
21108
+ phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
21109
+ icon: "square",
21110
+ args: { on: false }
21111
+ }],
20406
21112
  state: [{
20407
21113
  kind: "boolean",
20408
21114
  field: "empty",
@@ -22421,7 +23127,6 @@ var SYSTEM_CAP_VOCABULARY = {
22421
23127
  "calendar-source": system(INTERNAL),
22422
23128
  calendars: system("calendars feed schedules and conditions, not device actions"),
22423
23129
  composer: system("device composition — an authoring tool, not an action"),
22424
- "connection-test": system(INTERNAL),
22425
23130
  "core-blocks": system(INTERNAL),
22426
23131
  "custom-model-registry": system(ML),
22427
23132
  "data-store-provider": system(INTERNAL),
@@ -44296,8 +45001,15 @@ var ActionInputSchema = object({
44296
45001
  var ActionRunOriginSchema = object({
44297
45002
  /** The automation block whose step started it. */
44298
45003
  blockId: string().min(1).optional() });
44299
- /** `started` = the caller did not ask to wait. */
44300
- var ActionRunOutcomeSchema = union([AutomationRunOutcomeSchema, literal("started")]);
45004
+ /**
45005
+ * `started` = the caller did not ask to wait. `timed-out` = the run reached the
45006
+ * ceiling (`ACTION_RUN_MAX_MS`) and was stopped; it is never a `ran`.
45007
+ */
45008
+ var ActionRunOutcomeSchema = union([
45009
+ AutomationRunOutcomeSchema,
45010
+ literal("started"),
45011
+ literal("timed-out")
45012
+ ]);
44301
45013
  var ActionRunResultSchema = object({
44302
45014
  runId: string().min(1),
44303
45015
  outcome: ActionRunOutcomeSchema,
@@ -44331,427 +45043,6 @@ var UnitWarningSchema = object({
44331
45043
  assumedUnit: string(),
44332
45044
  message: string()
44333
45045
  });
44334
- /**
44335
- * notification-output — canonical, capability-gated notification delivery.
44336
- *
44337
- * Apprise-derived model (see
44338
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44339
- * callers emit ONE canonical `Notification`; each provider declares a
44340
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44341
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44342
- * message to what the kind supports — callers never special-case a service.
44343
- *
44344
- * DESIGN DECISIONS (locked):
44345
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44346
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44347
- * cap. Rationale: the admin UI needs one uniform surface across the
44348
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44349
- * alternative would fork the UI per addon and cannot host the
44350
- * discovery→adopt flow.
44351
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44352
- * the generated cap-mount auto-`concatCollection`-fans them across every
44353
- * registered provider (notifiers addon + HA addon) so one catalog is
44354
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44355
- * `addonId` the generated collection router extracts from the call input.
44356
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44357
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44358
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44359
- * base64 fallback needed.
44360
- *
44361
- * TODO (deferred, closed-set change — separate decision): add
44362
- * `providerKind: 'notify'` so notification providers surface on the unified
44363
- * admin "Integrations" page.
44364
- */
44365
- /**
44366
- * Zentik-derived typed-media enum — the superset across every kind. Each
44367
- * adapter picks what it supports and the degrade engine filters the rest.
44368
- */
44369
- var AttachmentMediaTypeSchema = _enum([
44370
- "image",
44371
- "video",
44372
- "gif",
44373
- "audio",
44374
- "icon"
44375
- ]);
44376
- /**
44377
- * A single attachment. Exactly one of `url` (remote source, most adapters
44378
- * prefer this) or `bytes` (inline source; required for Pushover-style
44379
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44380
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44381
- */
44382
- var AttachmentSchema = object({
44383
- mediaType: AttachmentMediaTypeSchema,
44384
- url: string().optional(),
44385
- bytes: _instanceof(Uint8Array).optional(),
44386
- mime: string().optional(),
44387
- name: string().optional()
44388
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44389
- var NotificationFormatSchema = _enum([
44390
- "text",
44391
- "markdown",
44392
- "html"
44393
- ]);
44394
- /**
44395
- * The CLOSED icon vocabulary an action button may use.
44396
- *
44397
- * A closed set, not a free string, and that is the whole point: an arbitrary
44398
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44399
- * notices — the same class of gap as a zone vocabulary nothing produced
44400
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44401
- * declares `actionIcons: false` and the degrade engine strips the field.
44402
- *
44403
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44404
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44405
- * differently.
44406
- *
44407
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44408
- *
44409
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44410
- * the whole set onto its own renderer's vocabulary through a
44411
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44412
- * fallback, so adding a member here fails every adapter's build until someone
44413
- * decides its glyph, which is the only place that decision can be made
44414
- * honestly.
44415
- *
44416
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44417
- * `disarm` straight through; iOS feeds that string to
44418
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44419
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44420
- * mapping, and "the field is documented" is not "the value renders".
44421
- *
44422
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44423
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44424
- * so an addon that emits a token the running hub does not know does not lose an
44425
- * icon — its whole `send` fails Zod validation and the notification never
44426
- * arrives. Never emit a new token from an addon before the train carrying it.
44427
- */
44428
- var NotificationActionIconSchema = _enum([
44429
- "acknowledge",
44430
- "dismiss",
44431
- "silence",
44432
- "snooze",
44433
- "view",
44434
- "play",
44435
- "open",
44436
- "close",
44437
- "lock",
44438
- "unlock",
44439
- "arm",
44440
- "arm-home",
44441
- "arm-away",
44442
- "arm-night",
44443
- "disarm",
44444
- "light",
44445
- "alert",
44446
- "camera"
44447
- ]);
44448
- /** A single tap-through action button. */
44449
- var NotificationActionSchema = object({
44450
- id: string(),
44451
- label: string(),
44452
- url: string().optional(),
44453
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44454
- icon: NotificationActionIconSchema.optional(),
44455
- /**
44456
- * Renders in a warning style where the notifier supports it.
44457
- *
44458
- * A HINT, never a gate. The callback's authority is its token and nothing
44459
- * else — see `notification-center/action-token.ts` for what that does and
44460
- * does not buy.
44461
- */
44462
- destructive: boolean().optional(),
44463
- /**
44464
- * How the tap should REACH the url.
44465
- *
44466
- * `navigate` (absent, and every button authored before this field) opens it:
44467
- * the phone leaves the notification and shows whatever the callback returns.
44468
- * That is right for a button whose answer the operator wants to read.
44469
- *
44470
- * `background` fires it as a POST and stays put. It exists for the buttons
44471
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44472
- * an answer to the notification, and being thrown into a browser tab to
44473
- * confirm it costs more attention than the notification did. A backend that
44474
- * cannot do a background call renders it as an ordinary link (the adapters
44475
- * fall back rather than dropping the button), so this is a preference, never
44476
- * a requirement.
44477
- */
44478
- mode: _enum(["navigate", "background"]).optional()
44479
- });
44480
- /** A delivery parameter value: what a notifier declared it takes. */
44481
- var DeliveryParamValueSchema = union([
44482
- string(),
44483
- number(),
44484
- boolean()
44485
- ]);
44486
- /**
44487
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
44488
- * addresses a target of that kind may set it; a kind that declares nothing is
44489
- * never handed one. The admin UI derives its control from this descriptor —
44490
- * no editor knows a service by name.
44491
- *
44492
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
44493
- * run on the addon cap path).
44494
- */
44495
- var DeliveryParamSchema = object({
44496
- key: string().min(1),
44497
- label: string(),
44498
- /** i18n key of the label, resolved by the declaring addon's namespace. */
44499
- labelKey: string().optional(),
44500
- type: _enum([
44501
- "enum",
44502
- "number",
44503
- "boolean",
44504
- "string"
44505
- ]),
44506
- /** `enum` only: the closed set of accepted values. */
44507
- options: array(object({
44508
- value: string(),
44509
- label: string()
44510
- })).optional(),
44511
- /** `number` only. */
44512
- min: number().optional(),
44513
- max: number().optional(),
44514
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
44515
- default: DeliveryParamValueSchema.optional()
44516
- });
44517
- /**
44518
- * The canonical notification. `body` is the only hard field (Apprise model).
44519
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44520
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44521
- * the adapter maps this ordinal onto its native level. `level?` is an
44522
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44523
- * `priority` for that one target.
44524
- */
44525
- var NotificationSchema = object({
44526
- body: string(),
44527
- title: string().optional(),
44528
- format: NotificationFormatSchema.default("text"),
44529
- priority: number().int().min(1).max(5).default(3),
44530
- level: string().optional(),
44531
- attachments: array(AttachmentSchema).optional(),
44532
- clickUrl: string().optional(),
44533
- actions: array(NotificationActionSchema).optional(),
44534
- sound: string().optional(),
44535
- ttl: number().optional(),
44536
- tag: string().optional(),
44537
- deviceId: number().optional(),
44538
- eventId: string().optional(),
44539
- metadata: record(string(), unknown()).optional(),
44540
- /**
44541
- * Values for the parameters the target's kind DECLARES in
44542
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
44543
- * declaration by the sender; a notifier reads only the keys it declared.
44544
- */
44545
- delivery: record(string(), DeliveryParamValueSchema).optional()
44546
- });
44547
- /** One declared native severity/priority level for a kind. */
44548
- var TargetKindLevelSchema = object({
44549
- id: string(),
44550
- label: string(),
44551
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44552
- ordinal: number().int().min(1).max(5).nullable(),
44553
- flags: object({
44554
- critical: boolean().optional(),
44555
- silent: boolean().optional(),
44556
- noPush: boolean().optional()
44557
- }).optional(),
44558
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44559
- requires: array(string()).optional(),
44560
- description: string().optional()
44561
- });
44562
- /** The full capability block consulted before dispatch. */
44563
- var TargetKindCapsSchema = object({
44564
- attachments: object({
44565
- mediaTypes: array(AttachmentMediaTypeSchema),
44566
- mode: _enum([
44567
- "url",
44568
- "bytes",
44569
- "both"
44570
- ]),
44571
- max: number().int().nonnegative(),
44572
- maxBytes: number().int().positive().optional()
44573
- }),
44574
- /** Max action buttons (0 = none). */
44575
- actions: number().int().nonnegative(),
44576
- /**
44577
- * Whether this kind renders a per-action ICON.
44578
- *
44579
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44580
- * run on the addon cap path — three production failures in one day taught
44581
- * this repo that once. Absent is read as false by the degrade engine, which
44582
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44583
- * assumed and dropped costs the operator's trust in the field.
44584
- */
44585
- actionIcons: boolean().optional(),
44586
- levels: array(TargetKindLevelSchema),
44587
- format: array(NotificationFormatSchema),
44588
- clickUrl: boolean(),
44589
- sound: boolean(),
44590
- ttl: boolean(),
44591
- bodyMaxLen: number().int().positive()
44592
- });
44593
- /**
44594
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44595
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44596
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44597
- * the union is large and not meant for runtime validation here; the exported
44598
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44599
- */
44600
- var ConfigSchemaPassthrough$4 = unknown();
44601
- var TargetKindSchema = object({
44602
- kind: string(),
44603
- label: string(),
44604
- icon: string(),
44605
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44606
- addonId: string(),
44607
- /**
44608
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44609
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44610
- * when the addon bundles no icon for that kind — the client then falls back
44611
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44612
- *
44613
- * Root-relative on purpose: it resolves against whatever origin serves a web
44614
- * client, and a native client joins it onto its own hub base.
44615
- *
44616
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44617
- * field that survived only because the runtime cap-router forwards provider
44618
- * output verbatim — so every consumer had to re-declare it by hand to stop
44619
- * its own Zod parse from stripping it, and the whole arrangement would have
44620
- * broken silently the moment output validation was tightened anywhere.
44621
- */
44622
- iconUrl: string().optional(),
44623
- /**
44624
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44625
- *
44626
- * The server knows this and therefore says it, because the client cannot
44627
- * safely guess: a React-Native client renders SVG and raster through two
44628
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44629
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44630
- * placeholder glyph for every vector icon while the web build looked fine.
44631
- *
44632
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44633
- * not been updated — a client that cannot determine the type should prefer
44634
- * its raster path, which is the safe default for an unknown image.
44635
- */
44636
- iconMediaType: string().optional(),
44637
- configSchema: ConfigSchemaPassthrough$4,
44638
- /**
44639
- * The config keys that decide WHERE this kind's secrets are sent (server,
44640
- * base URL, instance, chat, recipient). A save that changes any of them
44641
- * while leaving a secret redacted is refused by the provider (D634), so an
44642
- * editor uses this to ask for the secret on exactly those edits instead of
44643
- * on every edit.
44644
- *
44645
- * Optional: absent from a provider that holds no secret (the Home Assistant
44646
- * kinds) and from a provider older than this field — an editor that finds
44647
- * it absent must assume ANY edit may need the secret.
44648
- */
44649
- destinationKeys: array(string()).optional(),
44650
- supportsDiscovery: boolean(),
44651
- /**
44652
- * Extra delivery parameters a rule may set for a target of this kind (D938).
44653
- * Absent = none; the rule editor then offers nothing.
44654
- */
44655
- deliveryParams: array(DeliveryParamSchema).optional(),
44656
- caps: TargetKindCapsSchema
44657
- });
44658
- /**
44659
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44660
- * (return a presence marker only) when serving `listTargets` — never
44661
- * round-trip a stored secret to the UI.
44662
- */
44663
- var TargetSchema = object({
44664
- id: string(),
44665
- name: string(),
44666
- kind: string(),
44667
- addonId: string(),
44668
- enabled: boolean(),
44669
- config: record(string(), unknown())
44670
- });
44671
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44672
- var DiscoveredTargetSchema = object({
44673
- kind: string(),
44674
- suggestedName: string(),
44675
- config: record(string(), unknown())
44676
- });
44677
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44678
- var RenderedAsSchema = object({
44679
- level: string(),
44680
- format: NotificationFormatSchema,
44681
- attachmentsSent: number().int().nonnegative(),
44682
- actionsSent: number().int().nonnegative(),
44683
- truncated: boolean(),
44684
- dropped: array(string())
44685
- });
44686
- var SendResultSchema = object({
44687
- success: boolean(),
44688
- error: string().optional(),
44689
- renderedAs: RenderedAsSchema.optional()
44690
- });
44691
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44692
- var TestResultSchema = SendResultSchema;
44693
- /**
44694
- * Pre-save credential probe against a partial (unsaved) target config.
44695
- * `resolvedUrl` never includes secrets (token stripped from path).
44696
- */
44697
- var ProbeTargetConfigResultSchema = object({
44698
- ok: boolean(),
44699
- resolvedUrl: string(),
44700
- httpStatus: number().int().optional(),
44701
- stateInstance: string().optional(),
44702
- error: string().optional()
44703
- });
44704
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44705
- kind: string(),
44706
- config: record(string(), unknown()).optional(),
44707
- /**
44708
- * When editing / duplicating, the blank password field never round-trips
44709
- * the stored token. Pass the source target id so the provider can restore
44710
- * secrets server-side before dialling (same merge as upsert).
44711
- */
44712
- targetId: string().optional()
44713
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44714
- kind: string(),
44715
- config: record(string(), unknown()),
44716
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44717
- targetId: string().optional()
44718
- }), ProbeTargetConfigResultSchema, {
44719
- kind: "mutation",
44720
- auth: "admin"
44721
- }), method(object({
44722
- targetId: string(),
44723
- notification: NotificationSchema
44724
- }), SendResultSchema, {
44725
- kind: "mutation",
44726
- auth: "admin"
44727
- }), method(object({
44728
- targetId: string(),
44729
- sample: NotificationSchema.optional()
44730
- }), TestResultSchema, {
44731
- kind: "mutation",
44732
- auth: "admin"
44733
- }), method(object({
44734
- target: TargetSchema,
44735
- /**
44736
- * Duplicate flow: create a NEW target id while copying secrets from an
44737
- * existing row. The UI never holds the stored token; blank / redacted
44738
- * password fields are restored from this source (D634 still applies if
44739
- * destinations diverge without a re-typed secret).
44740
- */
44741
- cloneSecretsFrom: string().optional()
44742
- }), TargetSchema, {
44743
- kind: "mutation",
44744
- auth: "admin"
44745
- }), method(object({ targetId: string() }), _void(), {
44746
- kind: "mutation",
44747
- auth: "admin"
44748
- }), method(object({
44749
- targetId: string(),
44750
- enabled: boolean()
44751
- }), _void(), {
44752
- kind: "mutation",
44753
- auth: "admin"
44754
- });
44755
45046
  _enum([
44756
45047
  "automation",
44757
45048
  "action",
@@ -44819,6 +45110,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
44819
45110
  kind: "mutation",
44820
45111
  auth: "admin"
44821
45112
  });
45113
+ /** `timeoutMs` of `actions.run`: a waited call outlives any legal run. */
45114
+ var ACTION_RUN_TIMEOUT_MS = 363e4;
44822
45115
  /**
44823
45116
  * actions — the ONE surface for runnable actions, for the UI and for
44824
45117
  * automations. Provided by the core-blocks builtin on the hub.
@@ -44837,6 +45130,12 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
44837
45130
  * An admin, and an in-process caller (an automation block), may run any action.
44838
45131
  * Every refusal is typed (`[not-linked] …`) and logged.
44839
45132
  *
45133
+ * **A run lasts at most `ACTION_RUN_MAX_MS` (60 min).** The provider stops a
45134
+ * run that reaches it and answers `timed-out` (never `ran`); an action whose
45135
+ * `wait` steps alone add up to more is refused at create/update
45136
+ * (`[invalid-steps]`). `run` declares a `timeoutMs` above that ceiling, so a
45137
+ * waited call (an automation step) is never cut by the 60 s transport default.
45138
+ *
44840
45139
  * A second `run` of an action that is already running is REFUSED — traced and
44841
45140
  * logged — never queued.
44842
45141
  */
@@ -44863,7 +45162,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
44863
45162
  role: "viewer",
44864
45163
  auth: "protected",
44865
45164
  kind: "mutation",
44866
- caller: "required"
45165
+ caller: "required",
45166
+ timeoutMs: ACTION_RUN_TIMEOUT_MS
44867
45167
  }), method(ActionIdInput, _void(), {
44868
45168
  kind: "mutation",
44869
45169
  auth: "admin"
@@ -46938,52 +47238,7 @@ DeviceType.Light, method(object({
46938
47238
  level: number().min(0).max(100),
46939
47239
  lastChangedAt: number()
46940
47240
  });
46941
- /**
46942
- * `broker` — unified pub/sub broker registry, system-scoped collection.
46943
- *
46944
- * The cap models any kind-tagged message broker the user wants to
46945
- * register and that other addons might consume. The first two kinds
46946
- * are MQTT (mosquitto / aedes embedded / cloud bridge) and
46947
- * Home Assistant (HA WebSocket — subscribe_entities + call_service).
46948
- * Future kinds (Zigbee2MQTT bridge, ZHA, KNX, Telegram, …) plug in
46949
- * the same surface.
46950
- *
46951
- * Why one cap, not one cap per kind:
46952
- * - The integrations page wants a single table of "every broker"
46953
- * across kinds; a unified cap drives it without join logic.
46954
- * - Generic admin operations (add / remove / test / status) are
46955
- * identical across kinds — duplicating them per cap was busywork.
46956
- * - The `network-access` cap precedent: same interface, many
46957
- * `providerKind: 'ingress'` implementations (Tailscale, ngrok, …).
46958
- *
46959
- * What stays kind-specific:
46960
- * - `getBrokerConfig` payload (kind decides whether it returns
46961
- * mqtt URL+creds, HA baseUrl+token, …) — typed as
46962
- * `Record<string, unknown>` at the wire; consumers narrow.
46963
- * - `publish` / `subscribe` / `getState` arguments (target / filter /
46964
- * key) — also typed as `Record<string, unknown>` so each kind can
46965
- * evolve its surface (MQTT topic+qos vs HA entity_id+domain)
46966
- * without rebreaking the cap signature.
46967
- * - `add` `settings` payload (different fields per kind, validated by
46968
- * the kind-specific provider).
46969
- *
46970
- * Bidirectionality:
46971
- * - `publish` is RPC — synchronous result (provider-defined).
46972
- * - `subscribe` returns a subscription handle; the actual message
46973
- * stream flows over the typed event-bus as `broker.message` events
46974
- * keyed by `(brokerId, subscriptionId)`. Consumers filter in their
46975
- * event handler. Subscriptions persist across reconnects — the
46976
- * provider re-subscribes upstream after a transport drop.
46977
- *
46978
- * Why event-bus push (not a subscription RPC stream):
46979
- * - Matches the rest of CamStack's D8 contract — events for telemetry,
46980
- * RPC for loss-is-a-bug. Broker messages are telemetry (a single
46981
- * drop is recoverable via `getState({key})`).
46982
- * - Frees `broker.subscribe` from holding a long-lived RPC channel.
46983
- * - Cross-process: events already route through `$event-bus`; no
46984
- * per-broker wire-shaping needed.
46985
- */
46986
- var BrokerStatusEnum = _enum([
47241
+ _enum([
46987
47242
  "connected",
46988
47243
  "disconnected",
46989
47244
  "connecting",
@@ -46991,141 +47246,12 @@ var BrokerStatusEnum = _enum([
46991
47246
  "unreachable",
46992
47247
  "error"
46993
47248
  ]);
46994
- var BrokerInfoSchema = object({
46995
- /** Stable broker id. Persisted; survives addon restarts. */
46996
- id: string(),
46997
- /** Addon id of the provider that OWNS this broker.
46998
- *
46999
- * The `broker` cap is a system-scoped collection: several addons
47000
- * register a `broker` provider, each owning a DISJOINT set of
47001
- * brokers (mqtt-broker owns `mqtt_*`, provider-homeassistant owns
47002
- * `ha_*`). A broker therefore belongs to exactly one addon — like a
47003
- * device belongs to one integration. The admin UI threads this id
47004
- * back as the `{ addonId }` system-collection selector on every
47005
- * id-keyed call (`get` / `getSettings` / `setSettings` / `remove` /
47006
- * `testConnection`), so the call routes to the OWNING provider
47007
- * instead of defaulting to the first-registered one. */
47008
- addonId: string(),
47009
- /** Human-readable name (operator-chosen at add-time). */
47010
- name: string(),
47011
- /** Provider-defined kind tag — `mqtt` / `home-assistant` / future. */
47012
- kind: string(),
47013
- status: BrokerStatusEnum,
47014
- /** Free-form provider-specific info (HA version, MQTT broker
47015
- * flavour, latency, mTLS active, …). */
47016
- info: record(string(), unknown()),
47017
- /** Ms epoch of the last connection probe / status update. */
47018
- lastCheckedAt: number().nullable(),
47019
- /** Last error message, when `status` indicates failure. */
47020
- error: string().nullable()
47021
- });
47022
47249
  var RegistryStatusSchema = object({
47023
47250
  brokerCount: number().int().nonnegative(),
47024
47251
  connectedCount: number().int().nonnegative()
47025
47252
  });
47026
- /**
47027
- * One entry per `broker` provider — which addon provides which broker
47028
- * kind(s). The unified create picker reads this to know, for each
47029
- * (addonId, kind) pair the operator can pick, where to route the
47030
- * follow-up `getSettingsSchema` / `testSettings` / `add` calls (via the
47031
- * `{ addonId }` selector). A provider only advertises a kind here when
47032
- * it implements `getSettingsSchema` for that kind (so the picker never
47033
- * offers a kind whose creation form can't be rendered).
47034
- */
47035
- var BrokerProviderInfoSchema = object({
47036
- /** Addon id of the `broker` provider this entry describes. */
47037
- addonId: string(),
47038
- /** Broker kinds this provider can create, with a display label. */
47039
- kinds: array(object({
47040
- kind: string(),
47041
- label: string(),
47042
- /**
47043
- * Relative hub path to start an interactive account link (OAuth popup).
47044
- * May include `{{brokerId}}`; admin-ui substitutes and appends `?popup=1`.
47045
- */
47046
- interactiveConnectPath: string().min(1).optional(),
47047
- /** Relative hub path to disconnect the linked account (same popup pattern). */
47048
- interactiveDisconnectPath: string().min(1).optional(),
47049
- /**
47050
- * The kind signs in through a server-held interactive session instead of
47051
- * (or before) typed credentials. `basePath` is a hub-relative route set
47052
- * served by the owning addon (`/addon/<id>/...`) speaking the sign-in
47053
- * contract: `POST {basePath}/start` (body: the form's settings) answers
47054
- * `{ sessionId, loginUrl }`; `GET {basePath}/status?sessionId=` answers
47055
- * `{ phase: 'starting' | 'awaiting-login' | 'captured' | 'error' |
47056
- * 'cancelled', loginUrl, error }`; `POST {basePath}/commit`
47057
- * (`{ sessionId, name, brokerId? }`) stores the credentials on a new or
47058
- * existing broker and answers `{ brokerId }`; `POST {basePath}/cancel`
47059
- * (`{ sessionId }`) drops the session. The dialog that edits a broker
47060
- * offers it as the default path; the fields the session fills are
47061
- * marked `filledBySignIn` in the kind's settings schema.
47062
- *
47063
- * `methods` lists the ways the session can sign in, recommended first:
47064
- * `'device-code'` adds `POST {basePath}/code/start` (body: the form's
47065
- * settings) answering `{ sessionId, userCode, verificationUrl,
47066
- * expiresAt }` — the operator types `userCode` at `verificationUrl` on
47067
- * any device, and the same `status` / `commit` / `cancel` routes follow
47068
- * (status then carries `method`, `userCode`, `verificationUrl`,
47069
- * `expiresAt` and the phases `'awaiting-code'` / `'expired'`);
47070
- * `'proxy'` is the `{basePath}/start` flow above. Absent means
47071
- * `['proxy']`.
47072
- */
47073
- signIn: object({
47074
- basePath: string().min(1),
47075
- methods: array(_enum(["device-code", "proxy"])).optional()
47076
- }).optional()
47077
- }))
47078
- });
47079
- var ListInputSchema = object({
47080
- /** Optional kind filter — `list({kind:'home-assistant'})` returns
47081
- * only HA brokers. Omit to list every broker. */
47082
- kind: string().optional() });
47083
47253
  var GetInputSchema = object({ id: string() });
47084
- var AddInputSchema = object({
47085
- kind: string().min(1),
47086
- name: string().min(1),
47087
- /**
47088
- * ADOPT an existing id instead of minting a new one.
47089
- *
47090
- * Written the day this cost an outage. A broker's id is not a detail: HA
47091
- * devices carry it inside their `stableId` (`ha:ha_004:dev:…`), so a broker
47092
- * lost from config and re-added as `ha_001` leaves every one of its devices
47093
- * bound to a broker that no longer exists. Re-entering the password under the
47094
- * ORIGINAL id turns a multi-step device migration back into re-entering a
47095
- * password.
47096
- *
47097
- * A provider MUST refuse an id that is already in use — adopting a live
47098
- * broker's id would silently take it over.
47099
- */
47100
- id: string().min(1).optional(),
47101
- /** Kind-specific settings (e.g. MQTT `{url,username,password}` or HA
47102
- * `{baseUrl,accessToken}`). Validated by the kind-specific provider
47103
- * branch on receipt — invalid shape rejects the add. */
47104
- settings: record(string(), unknown())
47105
- });
47106
- var AddResultSchema = object({ id: string() });
47107
- var RemoveInputSchema = object({ id: string() });
47108
- var TestConnectionResultSchema = discriminatedUnion("ok", [object({
47109
- ok: literal(true),
47110
- latencyMs: number().nonnegative()
47111
- }), object({
47112
- ok: literal(false),
47113
- error: string()
47114
- })]);
47115
47254
  var SettingsRecordSchema$1 = record(string(), unknown());
47116
- var SettingsSchemaInputSchema = object({ kind: string() });
47117
- var TestSettingsInputSchema = object({
47118
- kind: string(),
47119
- settings: SettingsRecordSchema$1
47120
- });
47121
- var TestSettingsResultSchema = discriminatedUnion("ok", [object({
47122
- ok: literal(true),
47123
- latencyMs: number().nonnegative().optional()
47124
- }).strict(), object({
47125
- ok: literal(false),
47126
- error: string()
47127
- })]);
47128
- var SettingsSchemaResultSchema = unknown().nullable();
47129
47255
  var PublishInputSchema = object({
47130
47256
  brokerId: string(),
47131
47257
  /** Kind-specific routing target.
@@ -47159,25 +47285,7 @@ var GetStateInputSchema = object({
47159
47285
  * HA: entity_id (returns the cached entity state). */
47160
47286
  key: string()
47161
47287
  });
47162
- method(ListInputSchema, array(BrokerInfoSchema)), method(GetInputSchema, BrokerInfoSchema.nullable()), method(_void(), array(BrokerProviderInfoSchema), { auth: "admin" }), method(AddInputSchema, AddResultSchema, {
47163
- kind: "mutation",
47164
- auth: "admin"
47165
- }), method(RemoveInputSchema, _void(), {
47166
- kind: "mutation",
47167
- auth: "admin"
47168
- }), method(GetInputSchema, TestConnectionResultSchema, {
47169
- kind: "mutation",
47170
- auth: "admin"
47171
- }), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(object({
47172
- id: string(),
47173
- settings: SettingsRecordSchema$1
47174
- }), _void(), {
47175
- kind: "mutation",
47176
- auth: "admin"
47177
- }), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(SettingsSchemaInputSchema, SettingsSchemaResultSchema, { auth: "admin" }), method(TestSettingsInputSchema, TestSettingsResultSchema, {
47178
- kind: "mutation",
47179
- auth: "admin"
47180
- }), method(PublishInputSchema, unknown(), {
47288
+ method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(PublishInputSchema, unknown(), {
47181
47289
  kind: "mutation",
47182
47290
  auth: "admin"
47183
47291
  }), method(SubscribeInputSchema, SubscribeResultSchema, {
@@ -48841,37 +48949,6 @@ method(object({
48841
48949
  kind: "mutation",
48842
48950
  auth: "admin"
48843
48951
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
48844
- var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
48845
- object({
48846
- outcome: literal("validated"),
48847
- /** Round-trip of the sign-in, when the provider measured it. */
48848
- latencyMs: number().nonnegative().optional(),
48849
- /** Optional human detail worth showing next to the tick
48850
- * ("3 devices visible on this account"). */
48851
- detail: string().optional()
48852
- }).strict(),
48853
- object({
48854
- outcome: literal("rejected"),
48855
- error: string()
48856
- }).strict(),
48857
- object({
48858
- outcome: literal("inconclusive"),
48859
- error: string()
48860
- }).strict()
48861
- ]);
48862
- var ConnectionTestInputSchema = object({
48863
- /** Candidate integration settings, exactly as the create form collected them. */
48864
- settings: record(string(), unknown()) });
48865
- /**
48866
- * What the provider's test actually DOES, so the UI can say it in words before
48867
- * the operator presses the button ("Signs in to the Dreo cloud"). Purely
48868
- * descriptive — it never changes routing.
48869
- */
48870
- var ConnectionTestDescriptorSchema = object({ label: string() });
48871
- method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
48872
- kind: "mutation",
48873
- auth: "admin"
48874
- }), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
48875
48952
  object({
48876
48953
  /** True when the upstream system considers the entity connected. */
48877
48954
  connected: boolean(),
@@ -49129,6 +49206,9 @@ var MediaPlayerStatusSchema = object({
49129
49206
  /** Repeat mode. Null when no repeat surface.
49130
49207
  * Pair with `DeviceFeature.MediaPlayerRepeat`. */
49131
49208
  repeat: MediaPlayerRepeatSchema.nullable(),
49209
+ /** Ms epoch when `position` was read from the device. Null when the driver
49210
+ * does not say; a UI that advances the position while playing counts from it. */
49211
+ positionUpdatedAt: number().nullable().default(null),
49132
49212
  /** Ms epoch when the slice was last updated. */
49133
49213
  lastChangedAt: number()
49134
49214
  });
@@ -49708,7 +49788,9 @@ var ThresholdTransformDraftSchema = object({
49708
49788
  comparison: _enum(["gte", "lte"]),
49709
49789
  threshold: number(),
49710
49790
  startDwellMs: number().nonnegative(),
49711
- stopDwellMs: number().nonnegative()
49791
+ stopDwellMs: number().nonnegative(),
49792
+ /** Samples a start needs; absent = the compiler's default for the source (2 for running power, else 1). */
49793
+ minSamples: number().int().min(1).optional()
49712
49794
  });
49713
49795
  var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
49714
49796
  IdentityTransformDraftSchema,
@@ -51275,7 +51357,14 @@ var DiscoveryCandidateSchema = object({
51275
51357
  /** `stableId` of the gateway candidate this device was found BEHIND. */
51276
51358
  parentStableId: string().optional(),
51277
51359
  /** `false` = shown for context but not pickable. Default true. */
51278
- selectable: boolean().optional()
51360
+ selectable: boolean().optional(),
51361
+ /**
51362
+ * Keys of the provider's creation form (`getChildCreationSchema`) this candidate
51363
+ * cannot be adopted without — a key for an encrypted board, a pairing code. The
51364
+ * admin asks for exactly these, on the creation form prefilled with
51365
+ * `prefilledConfig`, before it adopts. Absent or empty = adopt as it is.
51366
+ */
51367
+ needsParams: array(string()).optional()
51279
51368
  });
51280
51369
  /**
51281
51370
  * Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
@@ -51334,12 +51423,24 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
51334
51423
  }), array(DiscoveryCandidateSchema), {
51335
51424
  kind: "mutation",
51336
51425
  auth: "admin"
51337
- }), method(object({}), CreationSchemaOutputSchema), method(object({}), object({ deviceType: _enum(DeviceType).nullable() })), method(object({ candidate: DiscoveryCandidateSchema }), DeviceSummarySchema, {
51426
+ }), method(object({}), CreationSchemaOutputSchema), method(object({
51427
+ /** The integration asked about; a provider whose integrations differ answers per one. */
51428
+ integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nullable() })), method(object({
51429
+ candidate: DiscoveryCandidateSchema,
51430
+ /** The integration the operator adopts into; a provider with several instances needs it. */
51431
+ integrationId: string().optional()
51432
+ }), DeviceSummarySchema, {
51338
51433
  kind: "mutation",
51339
51434
  auth: "admin"
51340
- }), method(object({}), boolean()), method(object({ type: _enum(DeviceType) }), CreationSchemaOutputSchema), method(object({
51435
+ }), method(object({}), boolean()), method(object({
51341
51436
  type: _enum(DeviceType),
51342
- config: record(string(), unknown())
51437
+ /** The integration asked about; a provider whose integrations differ answers per one. */
51438
+ integrationId: string().optional()
51439
+ }), CreationSchemaOutputSchema), method(object({
51440
+ type: _enum(DeviceType),
51441
+ config: record(string(), unknown()),
51442
+ /** The integration the operator adds the device to; a provider with several instances needs it. */
51443
+ integrationId: string().optional()
51343
51444
  }), DeviceSummarySchema, {
51344
51445
  kind: "mutation",
51345
51446
  auth: "admin"
@@ -52049,7 +52150,10 @@ method(object({
52049
52150
  auth: "admin"
52050
52151
  }), method(object({
52051
52152
  addonId: string(),
52052
- type: _enum(DeviceType)
52153
+ type: _enum(DeviceType),
52154
+ /** The integration the form is for; a provider whose integrations differ (a hub
52155
+ * integration takes no manual add) answers per integration. Absent = the addon's own. */
52156
+ integrationId: string().optional()
52053
52157
  }), unknown().nullable()), method(object({
52054
52158
  addonId: string(),
52055
52159
  type: _enum(DeviceType),
@@ -52133,7 +52237,11 @@ method(object({
52133
52237
  kind: "mutation",
52134
52238
  auth: "admin",
52135
52239
  timeoutMs: 12e4
52136
- }), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
52240
+ }), method(object({
52241
+ addonId: string(),
52242
+ /** The integration the Add-Device dialog is open on; absent = the addon's own. */
52243
+ integrationId: string().optional()
52244
+ }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
52137
52245
  deviceId: number(),
52138
52246
  key: string(),
52139
52247
  value: unknown()
@@ -54912,6 +55020,7 @@ var IntegrationWithStateSchema = object({
54912
55020
  id: string(),
54913
55021
  addonId: string(),
54914
55022
  name: string(),
55023
+ /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
54915
55024
  enabled: boolean(),
54916
55025
  info: record(string(), unknown()).readonly(),
54917
55026
  /** The discovery candidate this integration was set up from (D984). */
@@ -54924,6 +55033,7 @@ var IntegrationLiteSchema = object({
54924
55033
  id: string(),
54925
55034
  addonId: string(),
54926
55035
  name: string(),
55036
+ /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
54927
55037
  enabled: boolean(),
54928
55038
  info: record(string(), unknown()).readonly(),
54929
55039
  /** The discovery candidate this integration was set up from (D984). */
@@ -54969,10 +55079,9 @@ var AvailableIntegrationTypeSchema = object({
54969
55079
  * locations" checkbox. Provider-declared in the addon manifest. */
54970
55080
  supportsLocationImport: boolean(),
54971
55081
  /**
54972
- * True when this integration DECLARES a pre-creation test (the
54973
- * `connection-test` cap, or a broker whose settings it stores). Drives the
54974
- * Test button: an integration that cannot be tested must say so up front
54975
- * rather than offering a button that always answers the same nonsense.
55082
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
55083
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
55084
+ * button that always answers the same nonsense.
54976
55085
  */
54977
55086
  canTest: boolean(),
54978
55087
  existingInstances: array(object({
@@ -55006,7 +55115,7 @@ var TestConnectionStatusEnum = _enum([
55006
55115
  "inconclusive",
55007
55116
  "unsupported"
55008
55117
  ]);
55009
- var TestConnectionResultSchema$1 = object({
55118
+ var TestConnectionResultSchema = object({
55010
55119
  /** True ONLY for `validated`. Never true for a test that did not run. */
55011
55120
  success: boolean(),
55012
55121
  error: string().optional(),
@@ -55023,15 +55132,21 @@ var TestConnectionResultSchema$1 = object({
55023
55132
  var CreateIntegrationInputSchema = object({
55024
55133
  addonId: string(),
55025
55134
  name: string(),
55026
- enabled: boolean().optional(),
55027
55135
  info: record(string(), unknown()).optional(),
55028
55136
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
55029
55137
  originStableId: string().optional(),
55030
- settings: record(string(), unknown()).optional()
55138
+ settings: record(string(), unknown()).optional(),
55139
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
55140
+ kind: string().min(1).optional()
55031
55141
  });
55032
55142
  var UpdateIntegrationInputSchema = object({
55033
55143
  id: string(),
55034
55144
  name: string().optional(),
55145
+ /**
55146
+ * Accepted for a FIXED builtin only (`info.fixed`: alarm panel, camera grid, core blocks,
55147
+ * terminal), which keeps no instance record: the registry flag is its one store. Any other
55148
+ * integration is switched through `integration-instances.setInstanceEnabled`.
55149
+ */
55035
55150
  enabled: boolean().optional(),
55036
55151
  info: record(string(), unknown()).optional()
55037
55152
  });
@@ -55048,13 +55163,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
55048
55163
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
55049
55164
  kind: "mutation",
55050
55165
  auth: "admin"
55051
- }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
55052
- addonId: string(),
55053
- settings: record(string(), unknown())
55054
- }), TestConnectionResultSchema$1, {
55055
- kind: "mutation",
55056
- auth: "admin"
55057
- });
55166
+ }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
55058
55167
  /**
55059
55168
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
55060
55169
  * (an account, a relay, a destination) as typed records (D985, D986). The addon's
@@ -55078,6 +55187,14 @@ var ConfigSchemaPassthrough$3 = custom();
55078
55187
  var IntegrationInstanceIdSchema = string().min(1);
55079
55188
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
55080
55189
  /**
55190
+ * What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
55191
+ * instance is an integration that brings devices (its record body owns the on/off switch);
55192
+ * `services`: a connection configured from the addon's own function page, never listed on
55193
+ * Integrations.
55194
+ * It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
55195
+ */
55196
+ var IntegrationInstanceRoleSchema = _enum(["devices", "services"]);
55197
+ /**
55081
55198
  * One kind of instance a provider can create (an adapter, an account type). The sign-in and
55082
55199
  * connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
55083
55200
  * hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
@@ -55088,6 +55205,22 @@ var IntegrationInstanceKindSchema = object({
55088
55205
  /** Stable id of the kind, sent back as `createInstance.kind`. */
55089
55206
  id: string().min(1),
55090
55207
  label: string().min(1),
55208
+ /**
55209
+ * The function capability this kind is configured for (`broker`, `smtp-provider`,
55210
+ * `device-provider`, ...). A page section is the kinds whose `functionCap` it names (D1013); a
55211
+ * provider with more than one section must name it on every kind.
55212
+ */
55213
+ functionCap: string().min(1),
55214
+ /**
55215
+ * For `functionCap: 'broker'`: the registry kind of the broker an instance of this kind is
55216
+ * (`matter`, `home-assistant`, ...). A caller that needs a broker of one kind (a link field)
55217
+ * finds the instances whose kind names it; absent takes the kind `id`.
55218
+ */
55219
+ brokerKind: string().min(1).optional(),
55220
+ /** What instances of this kind are for the Integrations page; absent takes the provider's `role`. */
55221
+ role: IntegrationInstanceRoleSchema.optional(),
55222
+ /** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
55223
+ canTest: boolean().optional(),
55091
55224
  /** The kind signs in through a server-held interactive session. */
55092
55225
  signIn: object({
55093
55226
  basePath: string().min(1),
@@ -55098,22 +55231,38 @@ var IntegrationInstanceKindSchema = object({
55098
55231
  /** Relative hub path to disconnect that account. */
55099
55232
  disconnectPath: string().min(1).optional()
55100
55233
  });
55234
+ /**
55235
+ * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
55236
+ * scans the network before any instance exists (the wizard offers the candidates); `account`: the
55237
+ * devices appear after the instance signs in. `scopedToInstance`: a discovery run belongs to ONE
55238
+ * instance and its candidates are claimed by it.
55239
+ */
55240
+ var IntegrationInstanceDiscoverySchema = object({
55241
+ mode: _enum([
55242
+ "none",
55243
+ "lan",
55244
+ "account"
55245
+ ]),
55246
+ scopedToInstance: boolean()
55247
+ });
55248
+ /**
55249
+ * One link a kind of this provider declares (D1013 rule 5): the body `field` of an instance of
55250
+ * `kind` holds the id of an instance of the function cap `to.cap` (of kind `to.kind`, when set).
55251
+ * The hub indexes these so the target's delete is refused while a link names it.
55252
+ */
55253
+ var IntegrationInstanceLinkSchema = object({
55254
+ kind: string().min(1),
55255
+ field: string().min(1),
55256
+ to: object({
55257
+ cap: string().min(1),
55258
+ kind: string().min(1).optional()
55259
+ })
55260
+ });
55101
55261
  var IntegrationInstanceDescriptionSchema = object({
55102
55262
  /** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
55103
- role: _enum([
55104
- "devices",
55105
- "services",
55106
- "both"
55107
- ]),
55263
+ role: IntegrationInstanceRoleSchema,
55108
55264
  /** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
55109
- discovery: object({
55110
- mode: _enum([
55111
- "none",
55112
- "lan",
55113
- "account"
55114
- ]),
55115
- scopedToInstance: boolean()
55116
- }).optional(),
55265
+ discovery: IntegrationInstanceDiscoverySchema.optional(),
55117
55266
  /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
55118
55267
  instanceMode: IntegrationInstanceModeSchema,
55119
55268
  /** What the instance is, for the UI (`destination`, `relay`, `account`). */
@@ -55134,7 +55283,9 @@ var IntegrationInstanceDescriptionSchema = object({
55134
55283
  * `createInstance` without an `id` works: the provider mints it. Absent means the caller must
55135
55284
  * send an id (the UI then mints an opaque one).
55136
55285
  */
55137
- mintsId: boolean().optional()
55286
+ mintsId: boolean().optional(),
55287
+ /** The links to other instances the provider's kinds declare; absent means none. */
55288
+ links: array(IntegrationInstanceLinkSchema).optional()
55138
55289
  });
55139
55290
  var IntegrationInstanceStatusSchema = object({
55140
55291
  state: _enum([
@@ -55154,8 +55305,8 @@ var IntegrationInstanceSchema = object({
55154
55305
  configured: boolean(),
55155
55306
  /**
55156
55307
  * The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
55157
- * so a row written before the field existed is on). Absent when the `integrations` registry
55158
- * owns the switch (`describe().role` is `devices`): read it from the registry row.
55308
+ * so a row written before the field existed is on). The same for every role, `devices` included:
55309
+ * the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
55159
55310
  */
55160
55311
  enabled: boolean().optional(),
55161
55312
  /** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
@@ -55172,10 +55323,16 @@ var IntegrationInstancePatchSchema = object({
55172
55323
  /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
55173
55324
  values: record(string(), unknown())
55174
55325
  });
55175
- 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({
55326
+ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method(object({
55327
+ id: IntegrationInstanceIdSchema.nullable(),
55328
+ /** The kind of the create form (`id: null`) of a provider with several. */
55329
+ kind: string().min(1).optional()
55330
+ }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
55176
55331
  id: IntegrationInstanceIdSchema.optional(),
55177
55332
  name: string().min(1),
55178
- kind: string().min(1).optional()
55333
+ kind: string().min(1).optional(),
55334
+ /** Form values written with the record (a link picked in the create dialog). */
55335
+ values: record(string(), unknown()).optional()
55179
55336
  }), object({ id: string() }), {
55180
55337
  kind: "mutation",
55181
55338
  auth: "admin"
@@ -55193,8 +55350,10 @@ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method
55193
55350
  auth: "admin"
55194
55351
  }), optionalMethod(object({
55195
55352
  id: IntegrationInstanceIdSchema.nullable(),
55196
- values: record(string(), unknown())
55197
- }), TestConnectionResultSchema$1, {
55353
+ values: record(string(), unknown()),
55354
+ /** The kind to test when `id` is null and the provider has several. */
55355
+ kind: string().min(1).optional()
55356
+ }), TestConnectionResultSchema, {
55198
55357
  kind: "mutation",
55199
55358
  auth: "admin"
55200
55359
  });
@@ -57697,6 +57856,382 @@ var SystemMetricsSchema = object({
57697
57856
  gpuMemoryPercent: number().optional()
57698
57857
  });
57699
57858
  method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(GetLoadSeriesInputSchema, NodeLoadSeriesSchema);
57859
+ /**
57860
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
57861
+ * config documents, mirrors. The third storage API next to `ctx.settings`
57862
+ * (operator intent, D870) and device-history (numbers over time, D850).
57863
+ *
57864
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
57865
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
57866
+ * that with the addon id closed over). It is deliberately NOT in any input
57867
+ * schema, so a session can never supply it, and a call with no stamp is refused
57868
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
57869
+ * addons go through the owner's capability.
57870
+ *
57871
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
57872
+ * never `[]`. Secret fields are never on the wire: a read shows the
57873
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
57874
+ * resolves itself, and a write may carry only a keychain marker bound to the
57875
+ * row's own ref.
57876
+ *
57877
+ * Internal: addons reach it through `ctx.records`, never directly.
57878
+ */
57879
+ var RecordIdSchema = string().min(1).max(256);
57880
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
57881
+ var RecordBodySchema = record(string(), unknown());
57882
+ var RecordInputSchema = object({
57883
+ id: RecordIdSchema,
57884
+ /** The device this row belongs to (D865 removal, per-device reads). */
57885
+ deviceId: number().int().optional(),
57886
+ /** The domain clock, ms: observed / created / opened. */
57887
+ at: number().int().optional(),
57888
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
57889
+ expiresAt: number().int().optional(),
57890
+ data: RecordBodySchema
57891
+ });
57892
+ var RecordViewSchema = object({
57893
+ id: string(),
57894
+ deviceId: number().int().nullable(),
57895
+ at: number().nullable(),
57896
+ expiresAt: number().nullable(),
57897
+ rev: number().int(),
57898
+ updatedAt: number(),
57899
+ data: RecordBodySchema
57900
+ });
57901
+ /** Declared index fields only. Anything else does not compile, by design. */
57902
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
57903
+ string(),
57904
+ number(),
57905
+ boolean(),
57906
+ object({ in: array(union([
57907
+ string(),
57908
+ number(),
57909
+ boolean()
57910
+ ])).min(1).max(RECORD_BATCH_MAX) }),
57911
+ object({
57912
+ gt: union([string(), number()]).optional(),
57913
+ gte: union([string(), number()]).optional(),
57914
+ lt: union([string(), number()]).optional(),
57915
+ lte: union([string(), number()]).optional()
57916
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
57917
+ ]));
57918
+ var KindShape = { kind: RecordKindNameSchema };
57919
+ var TimeWindowShape = {
57920
+ deviceId: number().int().optional(),
57921
+ atFrom: number().optional(),
57922
+ atTo: number().optional()
57923
+ };
57924
+ var RecordQueryInputSchema = object({
57925
+ ...KindShape,
57926
+ ...TimeWindowShape,
57927
+ where: RecordWhereSchema.optional(),
57928
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
57929
+ order: _enum(["at", "id"]).optional(),
57930
+ desc: boolean().optional(),
57931
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
57932
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
57933
+ cursor: string().min(1).optional()
57934
+ });
57935
+ var RecordQueryResultSchema = object({
57936
+ records: array(RecordViewSchema),
57937
+ nextCursor: string().nullable()
57938
+ });
57939
+ var RecordKindStateSchema = _enum([
57940
+ "created",
57941
+ "unchanged",
57942
+ "updated"
57943
+ ]);
57944
+ var DeclareKindResultSchema = object({
57945
+ kindId: number().int(),
57946
+ state: RecordKindStateSchema,
57947
+ createdIndexes: array(string())
57948
+ });
57949
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
57950
+ var SecretRefsList = array(string());
57951
+ /**
57952
+ * One op of a `transact`: the single-row writes, each on a kind of the caller.
57953
+ * All ops of one call share ONE database file and ONE `transactFamily`.
57954
+ */
57955
+ var RecordTransactOpSchema = discriminatedUnion("op", [
57956
+ object({
57957
+ op: literal("put"),
57958
+ kind: RecordKindNameSchema,
57959
+ record: RecordInputSchema,
57960
+ ifRev: number().int().min(0).optional()
57961
+ }),
57962
+ object({
57963
+ op: literal("patch"),
57964
+ kind: RecordKindNameSchema,
57965
+ id: RecordIdSchema,
57966
+ data: RecordBodySchema,
57967
+ at: number().int().nullable().optional(),
57968
+ expiresAt: number().int().nullable().optional(),
57969
+ ifRev: number().int().min(1).optional()
57970
+ }),
57971
+ object({
57972
+ op: literal("delete"),
57973
+ kind: RecordKindNameSchema,
57974
+ id: RecordIdSchema
57975
+ })
57976
+ ]);
57977
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
57978
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
57979
+ kind: "mutation",
57980
+ auth: "admin"
57981
+ }), method(object({
57982
+ ...KindShape,
57983
+ id: RecordIdSchema
57984
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
57985
+ ...KindShape,
57986
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
57987
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
57988
+ ...KindShape,
57989
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
57990
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
57991
+ ...KindShape,
57992
+ record: RecordInputSchema,
57993
+ /** Compare-and-set. `0` means "the row must not exist". */
57994
+ ifRev: number().int().min(0).optional()
57995
+ }), object({
57996
+ rev: number().int(),
57997
+ releasedRefs: SecretRefsList
57998
+ }), {
57999
+ kind: "mutation",
58000
+ auth: "admin"
58001
+ }), method(object({
58002
+ ...KindShape,
58003
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
58004
+ }), object({
58005
+ count: number().int(),
58006
+ releasedRefs: SecretRefsList
58007
+ }), {
58008
+ kind: "mutation",
58009
+ auth: "admin"
58010
+ }), method(object({
58011
+ ...KindShape,
58012
+ id: RecordIdSchema,
58013
+ data: RecordBodySchema,
58014
+ at: number().int().nullable().optional(),
58015
+ expiresAt: number().int().nullable().optional(),
58016
+ ifRev: number().int().min(1).optional()
58017
+ }), object({
58018
+ rev: number().int(),
58019
+ releasedRefs: SecretRefsList
58020
+ }), {
58021
+ kind: "mutation",
58022
+ auth: "admin"
58023
+ }), method(object({
58024
+ ...KindShape,
58025
+ id: RecordIdSchema
58026
+ }), object({
58027
+ deleted: boolean(),
58028
+ secretRefs: SecretRefsList
58029
+ }), {
58030
+ kind: "mutation",
58031
+ auth: "admin"
58032
+ }), method(object({
58033
+ ...KindShape,
58034
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
58035
+ }), object({
58036
+ deleted: number().int(),
58037
+ secretRefs: SecretRefsList
58038
+ }), {
58039
+ kind: "mutation",
58040
+ auth: "admin"
58041
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
58042
+ ...KindShape,
58043
+ ...TimeWindowShape,
58044
+ where: RecordWhereSchema.optional()
58045
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
58046
+ ...KindShape,
58047
+ deviceId: number().int().optional(),
58048
+ from: number(),
58049
+ to: number(),
58050
+ bucketMs: number().int().positive()
58051
+ }), object({ buckets: array(object({
58052
+ bucketStart: number(),
58053
+ count: number().int()
58054
+ })) }), { auth: "admin" }), method(object({
58055
+ ...KindShape,
58056
+ op: _enum([
58057
+ "sum",
58058
+ "min",
58059
+ "max",
58060
+ "count"
58061
+ ]),
58062
+ field: RecordFieldPathSchema.optional(),
58063
+ groupBy: RecordFieldPathSchema.optional(),
58064
+ where: RecordWhereSchema.optional()
58065
+ }), object({ rows: array(object({
58066
+ group: union([
58067
+ string(),
58068
+ number(),
58069
+ _null()
58070
+ ]),
58071
+ value: number().nullable()
58072
+ })) }), { auth: "admin" }), method(object({
58073
+ ...KindShape,
58074
+ deviceId: number().int().optional(),
58075
+ atBefore: number().optional(),
58076
+ where: RecordWhereSchema.optional()
58077
+ }), object({
58078
+ deleted: number().int(),
58079
+ secretRefs: SecretRefsList
58080
+ }), {
58081
+ kind: "mutation",
58082
+ auth: "admin"
58083
+ }), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
58084
+ results: array(object({
58085
+ rev: number().int().nullable(),
58086
+ deleted: boolean()
58087
+ })),
58088
+ releasedRefs: SecretRefsList,
58089
+ secretRefs: SecretRefsList
58090
+ }), {
58091
+ kind: "mutation",
58092
+ auth: "admin"
58093
+ }), method(object({
58094
+ deviceId: number().int(),
58095
+ kinds: array(RecordKindNameSchema).optional()
58096
+ }), object({
58097
+ deleted: record(string(), number().int()),
58098
+ secretRefs: SecretRefsList
58099
+ }), {
58100
+ kind: "mutation",
58101
+ auth: "admin"
58102
+ }), method(object(KindShape), object({ id: number().int() }), {
58103
+ kind: "mutation",
58104
+ auth: "admin"
58105
+ });
58106
+ /**
58107
+ * The wire shapes of the migration API, version 1 (planning#447).
58108
+ *
58109
+ * A migration is code that outlives the server it was written against: an addon at
58110
+ * version 1.4 that is brought to 1.9 in one jump still runs its 1.4 catalogue, against
58111
+ * the 1.9 kernel. The only thing that code may call is {@link MigrationApiV1}; this file
58112
+ * is the contract of every method of it, one Zod pair per method.
58113
+ *
58114
+ * APPEND-ONLY. A released method is never removed and never changes meaning: an input
58115
+ * field is never removed or made required, an enum never narrows, an output field is
58116
+ * never removed. A change that cannot be expressed that way is `migration-api.v2`, next
58117
+ * to this file. `scripts/check-migration-api-append-only.ts` holds the line against
58118
+ * `scripts/migration-api-contract.json`, and every `behaviours` id below must have an
58119
+ * `it('<id>'` in `migration-api.contract.spec.ts`.
58120
+ */
58121
+ var Rows = record(string(), unknown());
58122
+ var IntegrationId = object({ integrationId: string().min(1) });
58123
+ var RecordId = object({ id: string().min(1) });
58124
+ var RecordRowSchema = object({
58125
+ id: string(),
58126
+ deviceId: number().int().nullable(),
58127
+ at: number().nullable(),
58128
+ expiresAt: number().nullable(),
58129
+ rev: number().int(),
58130
+ updatedAt: number(),
58131
+ data: Rows
58132
+ });
58133
+ var RecordPutShape = {
58134
+ id: string().min(1),
58135
+ deviceId: number().int().optional(),
58136
+ at: number().int().optional(),
58137
+ expiresAt: number().int().optional(),
58138
+ data: Rows
58139
+ };
58140
+ var MigrationIntegrationSchema = object({
58141
+ id: string(),
58142
+ addonId: string(),
58143
+ name: string(),
58144
+ info: Rows,
58145
+ /** The registry's stored switch: read by the one-switch migration, nothing else. */
58146
+ enabled: boolean().optional(),
58147
+ originStableId: string().optional()
58148
+ });
58149
+ var MigrationDeviceSchema = object({
58150
+ id: number().int(),
58151
+ integrationId: string().nullable().optional(),
58152
+ /** The owning device; null or absent for a root. */
58153
+ parentDeviceId: number().int().nullable().optional(),
58154
+ type: string().optional(),
58155
+ name: string().optional(),
58156
+ stableId: string().optional()
58157
+ });
58158
+ /** What the engine says about the migration API it serves: lets an addon notice an older server. */
58159
+ var MigrationApiInfoSchema = object({
58160
+ version: number().int(),
58161
+ methods: array(string())
58162
+ });
58163
+ object({
58164
+ message: string(),
58165
+ meta: Rows.optional(),
58166
+ /** Grouping tags of the line; a line about a device carries `{ deviceId }`. */
58167
+ tags: object({ deviceId: number().int().optional() }).optional()
58168
+ });
58169
+ object({
58170
+ owner: string().min(1),
58171
+ metas: array(MigrationMetaSchema)
58172
+ }), object({
58173
+ bootId: string(),
58174
+ snapshot: _enum([
58175
+ "none",
58176
+ "written",
58177
+ "refused"
58178
+ ]),
58179
+ steps: array(MigrationOwnerStepSchema),
58180
+ /** The migration API the engine serves; absent from a server that predates it. */
58181
+ migrationApi: MigrationApiInfoSchema.optional()
58182
+ }), object({ id: string().min(1) }), object({
58183
+ proceed: boolean(),
58184
+ state: union([literal("pending"), MigrationStatusSchema]),
58185
+ reason: string().nullable()
58186
+ }), object({
58187
+ id: string().min(1),
58188
+ result: MigrationOwnerResultSchema
58189
+ }), object({
58190
+ status: MigrationStatusSchema,
58191
+ error: string().nullable(),
58192
+ rowsChanged: number().int().nonnegative()
58193
+ }), object({
58194
+ rows: number().int().nonnegative(),
58195
+ secrets: number().int().nonnegative()
58196
+ }), IntegrationId.extend({ patch: Rows }), object({ written: boolean() }), IntegrationId.extend({ keys: array(string().min(1)) }), object({
58197
+ present: boolean(),
58198
+ removed: Rows
58199
+ }), RecordRowSchema.nullable(), RecordRowSchema.nullable(), object({
58200
+ ...RecordPutShape,
58201
+ ifRev: number().int().optional()
58202
+ }), object({ rev: number().int() }), object({ records: array(object(RecordPutShape)) }), object({ count: number().int().nonnegative() }), RecordId.extend({
58203
+ partial: Rows,
58204
+ ifRev: number().int().optional()
58205
+ }), object({ rev: number().int() }), object({ deleted: boolean() }), object({
58206
+ deviceId: number().int().optional(),
58207
+ atFrom: number().optional(),
58208
+ atTo: number().optional(),
58209
+ where: RecordWhereSchema.optional(),
58210
+ limit: number().int().min(1).optional(),
58211
+ cursor: string().min(1).optional(),
58212
+ resolveSecrets: boolean().optional()
58213
+ }), object({
58214
+ records: array(RecordRowSchema),
58215
+ nextCursor: string().nullable()
58216
+ }), object({
58217
+ deviceId: number().int().optional(),
58218
+ atBefore: number().optional(),
58219
+ where: RecordWhereSchema.optional()
58220
+ }), object({ count: number().int().nonnegative() }), object({}), object({ store: Rows }), object({ patch: Rows }), object({}), object({ keys: array(string().min(1)) }), object({ removed: array(string()) }), object({ refs: array(string()) }), object({ values: record(string(), string().nullable()) }), object({
58221
+ ref: string().min(1),
58222
+ value: string()
58223
+ }), object({}), object({ refs: array(string()) }), object({ deleted: number().int().nonnegative() }), object({}), object({ integrations: array(MigrationIntegrationSchema) }), object({ id: string().min(1) }), MigrationIntegrationSchema.nullable(), object({
58224
+ addonId: string().min(1),
58225
+ integrationId: string().min(1).optional()
58226
+ }), object({ devices: array(MigrationDeviceSchema) }), object({ deviceId: number().int() }), object({
58227
+ id: number().int(),
58228
+ integrationId: string().nullable(),
58229
+ /** Whether the device carries any stored config; its content is not offered. */
58230
+ hasConfig: boolean()
58231
+ }).nullable(), object({
58232
+ deviceId: number().int(),
58233
+ integrationId: string().min(1)
58234
+ }), object({}), object({}), object({ nodeId: string() }), object({}), object({});
57700
58235
  method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { auth: "admin" }), method(object({ owner: string().optional() }), object({ pending: array(MigrationPendingEntrySchema) }), { auth: "admin" }), method(object({ id: string().min(1) }), MigrationDryRunResultSchema, { auth: "admin" }), method(object({
57701
58236
  id: string().min(1),
57702
58237
  error: string().min(1)
@@ -57726,7 +58261,9 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
57726
58261
  "written",
57727
58262
  "refused"
57728
58263
  ]),
57729
- steps: array(MigrationOwnerStepSchema)
58264
+ steps: array(MigrationOwnerStepSchema),
58265
+ /** The migration API this engine serves (additive: a server that predates it omits it). */
58266
+ migrationApi: MigrationApiInfoSchema.optional()
57730
58267
  }), {
57731
58268
  kind: "mutation",
57732
58269
  auth: "admin"
@@ -60443,7 +60980,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
60443
60980
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
60444
60981
  kind: "mutation",
60445
60982
  auth: "admin"
60446
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
60983
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(MediaLocationCensusInputSchema, MediaLocationCensusSchema, {
60984
+ kind: "query",
60985
+ auth: "admin"
60986
+ }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
60447
60987
  kind: "query",
60448
60988
  auth: "admin"
60449
60989
  }), method(object({}), array(RelocateJobSchema).readonly(), {
@@ -63268,7 +63808,7 @@ var BrokerStatusSchema$1 = _enum([
63268
63808
  "unreachable",
63269
63809
  "tls-error"
63270
63810
  ]);
63271
- var BrokerInfoSchema$1 = object({
63811
+ var BrokerInfoSchema = object({
63272
63812
  id: string(),
63273
63813
  name: string(),
63274
63814
  url: string(),
@@ -63308,13 +63848,6 @@ var AddBrokerInputSchema = object({
63308
63848
  });
63309
63849
  var AddBrokerResultSchema = object({ id: string() });
63310
63850
  var IdInputSchema = object({ id: string() });
63311
- var TestResultSchema$1 = discriminatedUnion("ok", [object({
63312
- ok: literal(true),
63313
- latencyMs: number()
63314
- }), object({
63315
- ok: literal(false),
63316
- error: string()
63317
- })]);
63318
63851
  var StartEmbeddedInputSchema = object({
63319
63852
  port: number().int().min(1).max(65535).default(1883),
63320
63853
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -63331,15 +63864,12 @@ var StatusSchema = object({
63331
63864
  brokerCount: number(),
63332
63865
  embeddedRunning: boolean()
63333
63866
  });
63334
- method(_void(), array(BrokerInfoSchema$1)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
63867
+ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
63335
63868
  kind: "mutation",
63336
63869
  auth: "admin"
63337
63870
  }), method(IdInputSchema, _void(), {
63338
63871
  kind: "mutation",
63339
63872
  auth: "admin"
63340
- }), method(IdInputSchema, TestResultSchema$1, {
63341
- kind: "mutation",
63342
- auth: "admin"
63343
63873
  }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
63344
63874
  kind: "mutation",
63345
63875
  auth: "admin"
@@ -67600,14 +68130,6 @@ object({
67600
68130
  empty: boolean().nullable(),
67601
68131
  /** True while the pump is running. Null while unknown. */
67602
68132
  pumpRunning: boolean().nullable(),
67603
- /** Water drunk in the last drink, in litres. */
67604
- lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
67605
- /** Water drunk in the current hour, in litres. */
67606
- currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
67607
- /** Water drunk over the last 24 hours (rolling), in litres. */
67608
- last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
67609
- /** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
67610
- todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
67611
68133
  /** Decoded fault message. Null means healthy; a non-null string is an active fault. */
67612
68134
  error: string().nullable(),
67613
68135
  /** Ms epoch when the slice was last refreshed. */
@@ -67620,9 +68142,6 @@ DeviceType.PetFountain, method(object({
67620
68142
  }), _void(), {
67621
68143
  kind: "mutation",
67622
68144
  auth: "protected"
67623
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
67624
- kind: "mutation",
67625
- auth: "protected"
67626
68145
  });
67627
68146
  /**
67628
68147
  * The wire shapes of the Auto tune plan and apply (D745), used by the
@@ -70854,253 +71373,6 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, met
70854
71373
  auth: "admin"
70855
71374
  });
70856
71375
  /**
70857
- * records - an addon's own facts and documents (D881): ledgers, audit rows,
70858
- * config documents, mirrors. The third storage API next to `ctx.settings`
70859
- * (operator intent, D870) and device-history (numbers over time, D850).
70860
- *
70861
- * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
70862
- * crossed a process and stated by a hub in-process caller (`ctx.records` does
70863
- * that with the addon id closed over). It is deliberately NOT in any input
70864
- * schema, so a session can never supply it, and a call with no stamp is refused
70865
- * `records/no-caller`. A kind is readable and writable only by its owner; other
70866
- * addons go through the owner's capability.
70867
- *
70868
- * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
70869
- * never `[]`. Secret fields are never on the wire: a read shows the
70870
- * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
70871
- * resolves itself, and a write may carry only a keychain marker bound to the
70872
- * row's own ref.
70873
- *
70874
- * Internal: addons reach it through `ctx.records`, never directly.
70875
- */
70876
- var RecordIdSchema = string().min(1).max(256);
70877
- /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
70878
- var RecordBodySchema = record(string(), unknown());
70879
- var RecordInputSchema = object({
70880
- id: RecordIdSchema,
70881
- /** The device this row belongs to (D865 removal, per-device reads). */
70882
- deviceId: number().int().optional(),
70883
- /** The domain clock, ms: observed / created / opened. */
70884
- at: number().int().optional(),
70885
- /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
70886
- expiresAt: number().int().optional(),
70887
- data: RecordBodySchema
70888
- });
70889
- var RecordViewSchema = object({
70890
- id: string(),
70891
- deviceId: number().int().nullable(),
70892
- at: number().nullable(),
70893
- expiresAt: number().nullable(),
70894
- rev: number().int(),
70895
- updatedAt: number(),
70896
- data: RecordBodySchema
70897
- });
70898
- /** Declared index fields only. Anything else does not compile, by design. */
70899
- var RecordWhereSchema = record(RecordFieldPathSchema, union([
70900
- string(),
70901
- number(),
70902
- boolean(),
70903
- object({ in: array(union([
70904
- string(),
70905
- number(),
70906
- boolean()
70907
- ])).min(1).max(RECORD_BATCH_MAX) }),
70908
- object({
70909
- gt: union([string(), number()]).optional(),
70910
- gte: union([string(), number()]).optional(),
70911
- lt: union([string(), number()]).optional(),
70912
- lte: union([string(), number()]).optional()
70913
- }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
70914
- ]));
70915
- var KindShape = { kind: RecordKindNameSchema };
70916
- var TimeWindowShape = {
70917
- deviceId: number().int().optional(),
70918
- atFrom: number().optional(),
70919
- atTo: number().optional()
70920
- };
70921
- var RecordQueryInputSchema = object({
70922
- ...KindShape,
70923
- ...TimeWindowShape,
70924
- where: RecordWhereSchema.optional(),
70925
- /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
70926
- order: _enum(["at", "id"]).optional(),
70927
- desc: boolean().optional(),
70928
- limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
70929
- /** Opaque keyset cursor from a previous answer. There is no offset. */
70930
- cursor: string().min(1).optional()
70931
- });
70932
- var RecordQueryResultSchema = object({
70933
- records: array(RecordViewSchema),
70934
- nextCursor: string().nullable()
70935
- });
70936
- var RecordKindStateSchema = _enum([
70937
- "created",
70938
- "unchanged",
70939
- "updated"
70940
- ]);
70941
- var DeclareKindResultSchema = object({
70942
- kindId: number().int(),
70943
- state: RecordKindStateSchema,
70944
- createdIndexes: array(string())
70945
- });
70946
- /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
70947
- var SecretRefsList = array(string());
70948
- /**
70949
- * One op of a `transact`: the single-row writes, each on a kind of the caller.
70950
- * All ops of one call share ONE database file and ONE `transactFamily`.
70951
- */
70952
- var RecordTransactOpSchema = discriminatedUnion("op", [
70953
- object({
70954
- op: literal("put"),
70955
- kind: RecordKindNameSchema,
70956
- record: RecordInputSchema,
70957
- ifRev: number().int().min(0).optional()
70958
- }),
70959
- object({
70960
- op: literal("patch"),
70961
- kind: RecordKindNameSchema,
70962
- id: RecordIdSchema,
70963
- data: RecordBodySchema,
70964
- at: number().int().nullable().optional(),
70965
- expiresAt: number().int().nullable().optional(),
70966
- ifRev: number().int().min(1).optional()
70967
- }),
70968
- object({
70969
- op: literal("delete"),
70970
- kind: RecordKindNameSchema,
70971
- id: RecordIdSchema
70972
- })
70973
- ]);
70974
- var RecordSecretRefsSchema = record(string(), record(string(), string()));
70975
- method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
70976
- kind: "mutation",
70977
- auth: "admin"
70978
- }), method(object({
70979
- ...KindShape,
70980
- id: RecordIdSchema
70981
- }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
70982
- ...KindShape,
70983
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
70984
- }), array(RecordViewSchema), { auth: "admin" }), method(object({
70985
- ...KindShape,
70986
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
70987
- }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
70988
- ...KindShape,
70989
- record: RecordInputSchema,
70990
- /** Compare-and-set. `0` means "the row must not exist". */
70991
- ifRev: number().int().min(0).optional()
70992
- }), object({
70993
- rev: number().int(),
70994
- releasedRefs: SecretRefsList
70995
- }), {
70996
- kind: "mutation",
70997
- auth: "admin"
70998
- }), method(object({
70999
- ...KindShape,
71000
- records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
71001
- }), object({
71002
- count: number().int(),
71003
- releasedRefs: SecretRefsList
71004
- }), {
71005
- kind: "mutation",
71006
- auth: "admin"
71007
- }), method(object({
71008
- ...KindShape,
71009
- id: RecordIdSchema,
71010
- data: RecordBodySchema,
71011
- at: number().int().nullable().optional(),
71012
- expiresAt: number().int().nullable().optional(),
71013
- ifRev: number().int().min(1).optional()
71014
- }), object({
71015
- rev: number().int(),
71016
- releasedRefs: SecretRefsList
71017
- }), {
71018
- kind: "mutation",
71019
- auth: "admin"
71020
- }), method(object({
71021
- ...KindShape,
71022
- id: RecordIdSchema
71023
- }), object({
71024
- deleted: boolean(),
71025
- secretRefs: SecretRefsList
71026
- }), {
71027
- kind: "mutation",
71028
- auth: "admin"
71029
- }), method(object({
71030
- ...KindShape,
71031
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
71032
- }), object({
71033
- deleted: number().int(),
71034
- secretRefs: SecretRefsList
71035
- }), {
71036
- kind: "mutation",
71037
- auth: "admin"
71038
- }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
71039
- ...KindShape,
71040
- ...TimeWindowShape,
71041
- where: RecordWhereSchema.optional()
71042
- }), object({ count: number().int() }), { auth: "admin" }), method(object({
71043
- ...KindShape,
71044
- deviceId: number().int().optional(),
71045
- from: number(),
71046
- to: number(),
71047
- bucketMs: number().int().positive()
71048
- }), object({ buckets: array(object({
71049
- bucketStart: number(),
71050
- count: number().int()
71051
- })) }), { auth: "admin" }), method(object({
71052
- ...KindShape,
71053
- op: _enum([
71054
- "sum",
71055
- "min",
71056
- "max",
71057
- "count"
71058
- ]),
71059
- field: RecordFieldPathSchema.optional(),
71060
- groupBy: RecordFieldPathSchema.optional(),
71061
- where: RecordWhereSchema.optional()
71062
- }), object({ rows: array(object({
71063
- group: union([
71064
- string(),
71065
- number(),
71066
- _null()
71067
- ]),
71068
- value: number().nullable()
71069
- })) }), { auth: "admin" }), method(object({
71070
- ...KindShape,
71071
- deviceId: number().int().optional(),
71072
- atBefore: number().optional(),
71073
- where: RecordWhereSchema.optional()
71074
- }), object({
71075
- deleted: number().int(),
71076
- secretRefs: SecretRefsList
71077
- }), {
71078
- kind: "mutation",
71079
- auth: "admin"
71080
- }), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
71081
- results: array(object({
71082
- rev: number().int().nullable(),
71083
- deleted: boolean()
71084
- })),
71085
- releasedRefs: SecretRefsList,
71086
- secretRefs: SecretRefsList
71087
- }), {
71088
- kind: "mutation",
71089
- auth: "admin"
71090
- }), method(object({
71091
- deviceId: number().int(),
71092
- kinds: array(RecordKindNameSchema).optional()
71093
- }), object({
71094
- deleted: record(string(), number().int()),
71095
- secretRefs: SecretRefsList
71096
- }), {
71097
- kind: "mutation",
71098
- auth: "admin"
71099
- }), method(object(KindShape), object({ id: number().int() }), {
71100
- kind: "mutation",
71101
- auth: "admin"
71102
- });
71103
- /**
71104
71376
  * record-entries - the ONE admin surface for every list of user-created entries
71105
71377
  * (D881): notification targets, brokers, LLM profiles, anything an addon
71106
71378
  * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
@@ -76448,7 +76720,7 @@ var TrainingProviderTypeSchema = object({
76448
76720
  label: string(),
76449
76721
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
76450
76722
  iconAsset: string(),
76451
- /** Owning `training-provider` addon — collection selector for createEntry. */
76723
+ /** Owning `training-provider` addon. */
76452
76724
  addonId: string(),
76453
76725
  /**
76454
76726
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -76493,36 +76765,6 @@ var TrainingProviderDescriptorSchema = object({
76493
76765
  */
76494
76766
  formValues: record(string(), unknown()).optional()
76495
76767
  });
76496
- /**
76497
- * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
76498
- * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
76499
- * `{ $secretClear: true }` clears it.
76500
- */
76501
- var TrainingProviderUpdateEntryInputSchema = object({
76502
- entryId: string().min(1),
76503
- name: string().min(1),
76504
- tokenId: string().optional(),
76505
- tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
76506
- environment: string().optional(),
76507
- gpuType: string().optional(),
76508
- region: string().optional(),
76509
- costCapUsd: number().nonnegative().optional(),
76510
- maxRuntimeSec: number().int().positive().optional(),
76511
- failedDatasetGraceHours: number().nonnegative().optional()
76512
- });
76513
- var TrainingCredentialCheckSchema = object({
76514
- ok: boolean(),
76515
- /** Workspace / account name, when the provider says. */
76516
- account: string().optional(),
76517
- reason: _enum([
76518
- "missing",
76519
- "invalid",
76520
- "forbidden",
76521
- "network",
76522
- "quota"
76523
- ]).optional(),
76524
- detail: string().optional()
76525
- });
76526
76768
  var ProviderJobStateSchema = _enum([
76527
76769
  "pending",
76528
76770
  "starting",
@@ -76570,22 +76812,6 @@ var TrainingLogLineSchema = object({
76570
76812
  text: string()
76571
76813
  });
76572
76814
  method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
76573
- typeId: string().min(1),
76574
- name: string().min(1)
76575
- }), object({ entryId: string() }), {
76576
- kind: "mutation",
76577
- auth: "admin"
76578
- }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
76579
- kind: "mutation",
76580
- auth: "admin"
76581
- }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
76582
- kind: "mutation",
76583
- auth: "admin"
76584
- }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
76585
- kind: "mutation",
76586
- auth: "admin",
76587
- timeoutMs: 3e4
76588
- }), method(object({
76589
76815
  entryId: string().min(1),
76590
76816
  gpuType: string(),
76591
76817
  region: string(),
@@ -79737,20 +79963,6 @@ Object.freeze({
79737
79963
  access: "create",
79738
79964
  role: "viewer"
79739
79965
  },
79740
- "broker.add": {
79741
- capName: "broker",
79742
- capScope: "system",
79743
- addonId: null,
79744
- access: "create",
79745
- role: "admin"
79746
- },
79747
- "broker.get": {
79748
- capName: "broker",
79749
- capScope: "system",
79750
- addonId: null,
79751
- access: "view",
79752
- role: "admin"
79753
- },
79754
79966
  "broker.getBrokerConfig": {
79755
79967
  capName: "broker",
79756
79968
  capScope: "system",
@@ -79758,20 +79970,6 @@ Object.freeze({
79758
79970
  access: "view",
79759
79971
  role: "admin"
79760
79972
  },
79761
- "broker.getSettings": {
79762
- capName: "broker",
79763
- capScope: "system",
79764
- addonId: null,
79765
- access: "view",
79766
- role: "admin"
79767
- },
79768
- "broker.getSettingsSchema": {
79769
- capName: "broker",
79770
- capScope: "system",
79771
- addonId: null,
79772
- access: "view",
79773
- role: "admin"
79774
- },
79775
79973
  "broker.getState": {
79776
79974
  capName: "broker",
79777
79975
  capScope: "system",
@@ -79786,20 +79984,6 @@ Object.freeze({
79786
79984
  access: "view",
79787
79985
  role: "admin"
79788
79986
  },
79789
- "broker.list": {
79790
- capName: "broker",
79791
- capScope: "system",
79792
- addonId: null,
79793
- access: "view",
79794
- role: "admin"
79795
- },
79796
- "broker.listProviders": {
79797
- capName: "broker",
79798
- capScope: "system",
79799
- addonId: null,
79800
- access: "view",
79801
- role: "admin"
79802
- },
79803
79987
  "broker.publish": {
79804
79988
  capName: "broker",
79805
79989
  capScope: "system",
@@ -79807,20 +79991,6 @@ Object.freeze({
79807
79991
  access: "create",
79808
79992
  role: "admin"
79809
79993
  },
79810
- "broker.remove": {
79811
- capName: "broker",
79812
- capScope: "system",
79813
- addonId: null,
79814
- access: "delete",
79815
- role: "admin"
79816
- },
79817
- "broker.setSettings": {
79818
- capName: "broker",
79819
- capScope: "system",
79820
- addonId: null,
79821
- access: "create",
79822
- role: "admin"
79823
- },
79824
79994
  "broker.subscribe": {
79825
79995
  capName: "broker",
79826
79996
  capScope: "system",
@@ -79828,20 +79998,6 @@ Object.freeze({
79828
79998
  access: "create",
79829
79999
  role: "admin"
79830
80000
  },
79831
- "broker.testConnection": {
79832
- capName: "broker",
79833
- capScope: "system",
79834
- addonId: null,
79835
- access: "create",
79836
- role: "admin"
79837
- },
79838
- "broker.testSettings": {
79839
- capName: "broker",
79840
- capScope: "system",
79841
- addonId: null,
79842
- access: "create",
79843
- role: "admin"
79844
- },
79845
80001
  "broker.unsubscribe": {
79846
80002
  capName: "broker",
79847
80003
  capScope: "system",
@@ -80101,20 +80257,6 @@ Object.freeze({
80101
80257
  access: "view",
80102
80258
  role: "admin"
80103
80259
  },
80104
- "connectionTest.describeTest": {
80105
- capName: "connection-test",
80106
- capScope: "system",
80107
- addonId: null,
80108
- access: "view",
80109
- role: "admin"
80110
- },
80111
- "connectionTest.testSettings": {
80112
- capName: "connection-test",
80113
- capScope: "system",
80114
- addonId: null,
80115
- access: "create",
80116
- role: "admin"
80117
- },
80118
80260
  "connectivity.getStatus": {
80119
80261
  capName: "connectivity",
80120
80262
  capScope: "device",
@@ -82481,13 +82623,6 @@ Object.freeze({
82481
82623
  access: "view",
82482
82624
  role: "admin"
82483
82625
  },
82484
- "integrations.testConnection": {
82485
- capName: "integrations",
82486
- capScope: "system",
82487
- addonId: null,
82488
- access: "create",
82489
- role: "admin"
82490
- },
82491
82626
  "integrations.update": {
82492
82627
  capName: "integrations",
82493
82628
  capScope: "system",
@@ -83720,13 +83855,6 @@ Object.freeze({
83720
83855
  access: "create",
83721
83856
  role: "admin"
83722
83857
  },
83723
- "mqttBroker.testConnection": {
83724
- capName: "mqtt-broker",
83725
- capScope: "system",
83726
- addonId: null,
83727
- access: "create",
83728
- role: "admin"
83729
- },
83730
83858
  "nativeObjectDetection.getOptions": {
83731
83859
  capName: "native-object-detection",
83732
83860
  capScope: "device",
@@ -84602,13 +84730,6 @@ Object.freeze({
84602
84730
  access: "view",
84603
84731
  role: "viewer"
84604
84732
  },
84605
- "petFountain.resetDailyConsumption": {
84606
- capName: "pet-fountain",
84607
- capScope: "device",
84608
- addonId: null,
84609
- access: "delete",
84610
- role: "viewer"
84611
- },
84612
84733
  "petFountain.setPump": {
84613
84734
  capName: "pet-fountain",
84614
84735
  capScope: "device",
@@ -84805,6 +84926,13 @@ Object.freeze({
84805
84926
  access: "view",
84806
84927
  role: "viewer"
84807
84928
  },
84929
+ "pipelineAnalytics.getMediaLocationCensus": {
84930
+ capName: "pipeline-analytics",
84931
+ capScope: "device",
84932
+ addonId: null,
84933
+ access: "view",
84934
+ role: "admin"
84935
+ },
84808
84936
  "pipelineAnalytics.getMediaReclaimStatus": {
84809
84937
  capName: "pipeline-analytics",
84810
84938
  capScope: "device",
@@ -88557,20 +88685,6 @@ Object.freeze({
88557
88685
  access: "create",
88558
88686
  role: "admin"
88559
88687
  },
88560
- "trainingProvider.createEntry": {
88561
- capName: "training-provider",
88562
- capScope: "system",
88563
- addonId: null,
88564
- access: "create",
88565
- role: "admin"
88566
- },
88567
- "trainingProvider.deleteEntry": {
88568
- capName: "training-provider",
88569
- capScope: "system",
88570
- addonId: null,
88571
- access: "delete",
88572
- role: "admin"
88573
- },
88574
88688
  "trainingProvider.describe": {
88575
88689
  capName: "training-provider",
88576
88690
  capScope: "system",
@@ -88641,13 +88755,6 @@ Object.freeze({
88641
88755
  access: "create",
88642
88756
  role: "admin"
88643
88757
  },
88644
- "trainingProvider.updateEntry": {
88645
- capName: "training-provider",
88646
- capScope: "system",
88647
- addonId: null,
88648
- access: "create",
88649
- role: "admin"
88650
- },
88651
88758
  "trainingProvider.uploadDataset": {
88652
88759
  capName: "training-provider",
88653
88760
  capScope: "system",
@@ -88655,13 +88762,6 @@ Object.freeze({
88655
88762
  access: "create",
88656
88763
  role: "admin"
88657
88764
  },
88658
- "trainingProvider.validateCredentials": {
88659
- capName: "training-provider",
88660
- capScope: "system",
88661
- addonId: null,
88662
- access: "create",
88663
- role: "admin"
88664
- },
88665
88765
  "turnProvider.getTurnServers": {
88666
88766
  capName: "turn-provider",
88667
88767
  capScope: "system",
@@ -91026,11 +91126,6 @@ Object.freeze({
91026
91126
  form: "single",
91027
91127
  optional: false
91028
91128
  }],
91029
- "petFountain.resetDailyConsumption": [{
91030
- name: "deviceId",
91031
- form: "single",
91032
- optional: false
91033
- }],
91034
91129
  "petFountain.setPump": [{
91035
91130
  name: "deviceId",
91036
91131
  form: "single",