@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.js CHANGED
@@ -6012,7 +6012,7 @@ var ZodIssueCode = {
6012
6012
  var ZodFirstPartyTypeKind;
6013
6013
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6014
6014
  //#endregion
6015
- //#region ../types/dist/sleep-DEZaLbiu.mjs
6015
+ //#region ../types/dist/sleep-D7ZKm4nb.mjs
6016
6016
  /**
6017
6017
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6018
6018
  * window to float samples (D455).
@@ -6705,6 +6705,344 @@ async function runAddonMigrations(host, migrations, logger, options = {}) {
6705
6705
  blockOwner
6706
6706
  };
6707
6707
  }
6708
+ /** The record calls the one-switch migration makes, over the migration API. */
6709
+ function switchRecordsOverMigrationApi(api) {
6710
+ return { kind: (definition) => {
6711
+ const handle = api.records.kind(definition);
6712
+ return {
6713
+ get: (id) => handle.get({ id }),
6714
+ put: (input, opts) => handle.put({
6715
+ ...input,
6716
+ ...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
6717
+ }),
6718
+ patch: (id, partial) => handle.patch({
6719
+ id,
6720
+ partial
6721
+ })
6722
+ };
6723
+ } };
6724
+ }
6725
+ function integrationRowsApiOver(api) {
6726
+ return {
6727
+ list: async () => (await api.integrations.list({})).integrations,
6728
+ readLegacyIntegrationRows: (input) => api.legacyRows.read(input),
6729
+ clearLegacyIntegrationRows: (input) => api.legacyRows.clear(input)
6730
+ };
6731
+ }
6732
+ var PREFIX = "records/";
6733
+ /**
6734
+ * Cross-realm brand. An addon bundles its own copy of this module (D15) while
6735
+ * `ctx.records` is the HOST's door, so an error thrown by the host is an
6736
+ * instance of the host's classes, not of the addon's. The brand plus the code
6737
+ * make `instanceof` answer by identity of the failure, not of the copy.
6738
+ */
6739
+ var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
6740
+ function carriesBrand(value) {
6741
+ return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
6742
+ }
6743
+ /** The base of every records failure. `detail` is the human part of the message. */
6744
+ var RecordsError = class extends Error {
6745
+ /** The code a subclass stands for; the base stands for every code. */
6746
+ static code = void 0;
6747
+ /**
6748
+ * `instanceof` across copies of this module: any branded error is a
6749
+ * `RecordsError`, and is an instance of a subclass only when its code is the
6750
+ * subclass's code. Same-copy answers are unchanged.
6751
+ */
6752
+ static [Symbol.hasInstance](value) {
6753
+ if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
6754
+ if (!carriesBrand(value)) return false;
6755
+ return this.code === void 0 || value.code === this.code;
6756
+ }
6757
+ code;
6758
+ detail;
6759
+ [RECORDS_ERROR_BRAND] = true;
6760
+ constructor(code, detail) {
6761
+ super(`${PREFIX}${code}: ${detail}`);
6762
+ this.name = "RecordsError";
6763
+ this.code = code;
6764
+ this.detail = detail;
6765
+ }
6766
+ };
6767
+ var InvalidRecordError = class InvalidRecordError extends RecordsError {
6768
+ static code = "invalid-record";
6769
+ constructor(detail) {
6770
+ super(InvalidRecordError.code, detail);
6771
+ this.name = "InvalidRecordError";
6772
+ }
6773
+ };
6774
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
6775
+ var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
6776
+ static code = "declaration-refused";
6777
+ constructor(detail) {
6778
+ super(DeclarationRefusedError.code, detail);
6779
+ this.name = "DeclarationRefusedError";
6780
+ }
6781
+ };
6782
+ object({
6783
+ cap: string().min(1),
6784
+ kind: string().min(1).optional()
6785
+ });
6786
+ var GLOBAL_SCOPE = { kind: "global" };
6787
+ /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6788
+ function globalSecretScope() {
6789
+ return GLOBAL_SCOPE;
6790
+ }
6791
+ function encodeSegment(value) {
6792
+ return encodeURIComponent(value);
6793
+ }
6794
+ function decodeSegment(value) {
6795
+ try {
6796
+ return decodeURIComponent(value);
6797
+ } catch {
6798
+ return null;
6799
+ }
6800
+ }
6801
+ /**
6802
+ * The field path of a value inside an array item, addressed by the item's id:
6803
+ * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6804
+ * `providers[authentik].clientSecret`.
6805
+ */
6806
+ function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6807
+ return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6808
+ }
6809
+ function parseScope(segments) {
6810
+ switch (segments[0]) {
6811
+ case "global": return {
6812
+ scope: GLOBAL_SCOPE,
6813
+ used: 1
6814
+ };
6815
+ case "node": {
6816
+ const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6817
+ return nodeId === null || nodeId.length === 0 ? null : {
6818
+ scope: {
6819
+ kind: "node",
6820
+ nodeId
6821
+ },
6822
+ used: 2
6823
+ };
6824
+ }
6825
+ case "device": {
6826
+ const raw = segments[1];
6827
+ if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6828
+ return {
6829
+ scope: {
6830
+ kind: "device",
6831
+ deviceId: Number(raw)
6832
+ },
6833
+ used: 2
6834
+ };
6835
+ }
6836
+ case "integration": {
6837
+ const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6838
+ return id === null || id.length === 0 ? null : {
6839
+ scope: {
6840
+ kind: "integration",
6841
+ integrationId: id
6842
+ },
6843
+ used: 2
6844
+ };
6845
+ }
6846
+ case "row": {
6847
+ const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6848
+ const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6849
+ if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6850
+ return {
6851
+ scope: {
6852
+ kind: "row",
6853
+ collection,
6854
+ rowId
6855
+ },
6856
+ used: 3
6857
+ };
6858
+ }
6859
+ default: return null;
6860
+ }
6861
+ }
6862
+ /** Take a ref apart; `null` when it is not a well-formed ref. */
6863
+ function parseSecretRef(ref) {
6864
+ if (!ref.startsWith("secret://")) return null;
6865
+ const segments = ref.slice(9).split("/");
6866
+ const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6867
+ if (owner === null || owner.length === 0) return null;
6868
+ const parsed = parseScope(segments.slice(1));
6869
+ if (parsed === null) return null;
6870
+ const fieldPath = segments.slice(1 + parsed.used).join("/");
6871
+ if (fieldPath.length === 0) return null;
6872
+ return {
6873
+ owner,
6874
+ scope: parsed.scope,
6875
+ fieldPath
6876
+ };
6877
+ }
6878
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
6879
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
6880
+ var RECORD_DATABASES = ["settings", "events"];
6881
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
6882
+ var RECORD_CLASSES = [
6883
+ "config",
6884
+ "ledger",
6885
+ "audit",
6886
+ "mirror",
6887
+ "ephemeral"
6888
+ ];
6889
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
6890
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
6891
+ var RECORD_BATCH_MAX = 1e3;
6892
+ var RECORD_QUERY_MAX = 1e3;
6893
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
6894
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
6895
+ /**
6896
+ * Secret fields of a record, addressed the way a Zod schema declares them
6897
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
6898
+ * (`auth.accessToken`, `headers[].value`).
6899
+ *
6900
+ * `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
6901
+ * names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
6902
+ * key releases exactly that key's secret.
6903
+ *
6904
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
6905
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
6906
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
6907
+ * leaf names its element: `headers[X-Api].value`.
6908
+ *
6909
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
6910
+ */
6911
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
6912
+ function parseSecretPath(path) {
6913
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
6914
+ return path.split(".").map((raw) => {
6915
+ const each = raw.endsWith("[]");
6916
+ const map = raw.endsWith("{}");
6917
+ const key = each || map ? raw.slice(0, -2) : raw;
6918
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
6919
+ return {
6920
+ key,
6921
+ each,
6922
+ map
6923
+ };
6924
+ });
6925
+ }
6926
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
6927
+ function secretArrayPrefixes(path) {
6928
+ const segments = parseSecretPath(path);
6929
+ const prefixes = [];
6930
+ const walked = [];
6931
+ for (const segment of segments) {
6932
+ walked.push(segment.key);
6933
+ if (segment.each) prefixes.push(walked.join("."));
6934
+ }
6935
+ return prefixes;
6936
+ }
6937
+ /** The body key of the switch; only {@link RecordIntegrationInstances.setInstanceEnabled} writes it. */
6938
+ var SWITCH_KEY = "enabled";
6939
+ /**
6940
+ * The one-switch migration (epic #440, step 3). An integration's on/off state used to live in the
6941
+ * registry's `enabled` column for a device addon; it now lives only in the instance record's
6942
+ * body (`enabled`, D1007 superseded). This moves a registry `enabled = false` into the body, once.
6943
+ *
6944
+ * For every registry row of the addon that is OFF:
6945
+ * - no record under its id: the record is created from `initialBody(name)` with `enabled: false`
6946
+ * (a default integration that never had settings, Reolink's among them);
6947
+ * - a record whose body states no `enabled`: `enabled: false` is written into it;
6948
+ * - a record that already states `enabled` (either way) is the newer truth and is left alone.
6949
+ * A row that is ON writes nothing: an absent field reads as on. A rerun finds every off row with
6950
+ * a stated switch and does nothing, so nothing switched off comes back on and nothing switched on
6951
+ * goes off. The registry column itself is neither read afterwards nor written; its drop is step 5.
6952
+ *
6953
+ * It runs in the addon process, BEFORE the addon registers its `integration-instances` provider,
6954
+ * which is also why `integrations.list` still answers the stored column at that point.
6955
+ */
6956
+ function registrySwitchToBodyId(addonId, date) {
6957
+ return `${addonId}/${date}-registry-switch-to-body`;
6958
+ }
6959
+ async function moveRegistrySwitchToBody(ports, spec) {
6960
+ const rows = await ports.listIntegrations(spec.addonId);
6961
+ let created = 0;
6962
+ let switched = 0;
6963
+ let kept = 0;
6964
+ for (const row of rows) {
6965
+ if (row.enabled) continue;
6966
+ const body = await ports.readBody(row.id);
6967
+ if (body === null) {
6968
+ if (await ports.createRecord(row.id, {
6969
+ ...spec.initialBody(row.name),
6970
+ ["enabled"]: false
6971
+ }) === "created") created += 1;
6972
+ else kept += 1;
6973
+ continue;
6974
+ }
6975
+ if ("enabled" in body) {
6976
+ kept += 1;
6977
+ continue;
6978
+ }
6979
+ await ports.switchOff(row.id);
6980
+ switched += 1;
6981
+ }
6982
+ const summary = {
6983
+ integrations: rows.length,
6984
+ off: rows.filter((r) => !r.enabled).length,
6985
+ created,
6986
+ switched,
6987
+ kept
6988
+ };
6989
+ return created === 0 && switched === 0 ? {
6990
+ outcome: "already-done",
6991
+ summary
6992
+ } : {
6993
+ outcome: "done",
6994
+ summary
6995
+ };
6996
+ }
6997
+ /** A migration entry: an addon states its kind and how a new body starts, nothing else. */
6998
+ function registrySwitchToBodyMigration(spec) {
6999
+ return {
7000
+ meta: {
7001
+ id: registrySwitchToBodyId(spec.addonId, spec.date),
7002
+ owner: spec.addonId,
7003
+ level: "addon-state",
7004
+ seq: spec.seq,
7005
+ dependsOn: [],
7006
+ store: "settings",
7007
+ scope: "cluster",
7008
+ onFailure: "block-owner",
7009
+ bodyKind: "procedure",
7010
+ description: "Move the registry enabled flag of every switched-off integration into its instance record body, creating the record when there is none",
7011
+ fixtureMark: "enabled"
7012
+ },
7013
+ procedure: (ports) => moveRegistrySwitchToBody(ports, {
7014
+ addonId: spec.addonId,
7015
+ initialBody: spec.initialBody
7016
+ })
7017
+ };
7018
+ }
7019
+ /** The hub and records sides of {@link registrySwitchToBodyMigration}. */
7020
+ function registrySwitchPortsOver(deps) {
7021
+ const handle = deps.records.kind({
7022
+ name: deps.kind.name,
7023
+ declaration: deps.kind.declaration,
7024
+ schema: record(string(), unknown())
7025
+ });
7026
+ return {
7027
+ listIntegrations: async (addonId) => (await deps.api.list()).filter((i) => i.addonId === addonId).map((i) => ({
7028
+ id: i.id,
7029
+ name: i.name,
7030
+ enabled: i.enabled !== false
7031
+ })),
7032
+ readBody: async (id) => (await handle.get(id))?.data ?? null,
7033
+ createRecord: async (id, body) => {
7034
+ if (await handle.get(id) !== null) return "exists";
7035
+ await handle.put({
7036
+ id,
7037
+ data: body
7038
+ }, { ifRev: 0 });
7039
+ return "created";
7040
+ },
7041
+ switchOff: async (id) => {
7042
+ await handle.patch(id, { [SWITCH_KEY]: false });
7043
+ }
7044
+ };
7045
+ }
6708
7046
  /**
6709
7047
  * Build a {@link DurableState} over a single store key. Transport-agnostic:
6710
7048
  * `read`/`write` are the addon-store or device-store accessors. The whole
@@ -6836,98 +7174,6 @@ var SCOPED_SETTINGS_SCOPES = [
6836
7174
  "device-defaults",
6837
7175
  "node"
6838
7176
  ];
6839
- var GLOBAL_SCOPE = { kind: "global" };
6840
- /** The scope every addon-wide (not per-node, not per-device) setting lives in. */
6841
- function globalSecretScope() {
6842
- return GLOBAL_SCOPE;
6843
- }
6844
- function encodeSegment(value) {
6845
- return encodeURIComponent(value);
6846
- }
6847
- function decodeSegment(value) {
6848
- try {
6849
- return decodeURIComponent(value);
6850
- } catch {
6851
- return null;
6852
- }
6853
- }
6854
- /**
6855
- * The field path of a value inside an array item, addressed by the item's id:
6856
- * `arrayItemFieldPath('providers', 'authentik', 'clientSecret')` →
6857
- * `providers[authentik].clientSecret`.
6858
- */
6859
- function arrayItemFieldPath(arrayKey, itemId, fieldKey) {
6860
- return `${arrayKey}[${encodeSegment(itemId)}].${fieldKey}`;
6861
- }
6862
- function parseScope(segments) {
6863
- switch (segments[0]) {
6864
- case "global": return {
6865
- scope: GLOBAL_SCOPE,
6866
- used: 1
6867
- };
6868
- case "node": {
6869
- const nodeId = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6870
- return nodeId === null || nodeId.length === 0 ? null : {
6871
- scope: {
6872
- kind: "node",
6873
- nodeId
6874
- },
6875
- used: 2
6876
- };
6877
- }
6878
- case "device": {
6879
- const raw = segments[1];
6880
- if (raw === void 0 || !/^\d+$/.test(raw)) return null;
6881
- return {
6882
- scope: {
6883
- kind: "device",
6884
- deviceId: Number(raw)
6885
- },
6886
- used: 2
6887
- };
6888
- }
6889
- case "integration": {
6890
- const id = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6891
- return id === null || id.length === 0 ? null : {
6892
- scope: {
6893
- kind: "integration",
6894
- integrationId: id
6895
- },
6896
- used: 2
6897
- };
6898
- }
6899
- case "row": {
6900
- const collection = segments[1] !== void 0 ? decodeSegment(segments[1]) : null;
6901
- const rowId = segments[2] !== void 0 ? decodeSegment(segments[2]) : null;
6902
- if (collection === null || rowId === null || collection.length === 0 || rowId.length === 0) return null;
6903
- return {
6904
- scope: {
6905
- kind: "row",
6906
- collection,
6907
- rowId
6908
- },
6909
- used: 3
6910
- };
6911
- }
6912
- default: return null;
6913
- }
6914
- }
6915
- /** Take a ref apart; `null` when it is not a well-formed ref. */
6916
- function parseSecretRef(ref) {
6917
- if (!ref.startsWith("secret://")) return null;
6918
- const segments = ref.slice(9).split("/");
6919
- const owner = segments[0] !== void 0 ? decodeSegment(segments[0]) : null;
6920
- if (owner === null || owner.length === 0) return null;
6921
- const parsed = parseScope(segments.slice(1));
6922
- if (parsed === null) return null;
6923
- const fieldPath = segments.slice(1 + parsed.used).join("/");
6924
- if (fieldPath.length === 0) return null;
6925
- return {
6926
- owner,
6927
- scope: parsed.scope,
6928
- fieldPath
6929
- };
6930
- }
6931
7177
  /** A write to a secret path could not be stored in the keychain, so it was refused. */
6932
7178
  var KeychainWriteRefusedError = class extends Error {
6933
7179
  fieldPath;
@@ -6938,7 +7184,7 @@ var KeychainWriteRefusedError = class extends Error {
6938
7184
  }
6939
7185
  };
6940
7186
  var KEEP = { kind: "keep" };
6941
- function isRecord$6(value) {
7187
+ function isRecord$4(value) {
6942
7188
  return typeof value === "object" && value !== null && !Array.isArray(value);
6943
7189
  }
6944
7190
  function defaultMintId() {
@@ -6951,7 +7197,7 @@ function collectSecretMarkerRefs(value, out = []) {
6951
7197
  return out;
6952
7198
  }
6953
7199
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6954
- else if (isRecord$6(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
7200
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6955
7201
  return out;
6956
7202
  }
6957
7203
  async function storedValueEquals(secrets, marker, candidate) {
@@ -7006,7 +7252,7 @@ function rowId(row, idKey) {
7006
7252
  return null;
7007
7253
  }
7008
7254
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
7009
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$6) : [];
7255
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
7010
7256
  if (!Array.isArray(incoming)) {
7011
7257
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
7012
7258
  return {
@@ -7022,7 +7268,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
7022
7268
  const kept = /* @__PURE__ */ new Set();
7023
7269
  const rows = [];
7024
7270
  for (const row of incoming) {
7025
- if (!isRecord$6(row)) {
7271
+ if (!isRecord$4(row)) {
7026
7272
  rows.push(row);
7027
7273
  continue;
7028
7274
  }
@@ -7047,7 +7293,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7047
7293
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
7048
7294
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
7049
7295
  case "object": {
7050
- if (!isRecord$6(incoming)) {
7296
+ if (!isRecord$4(incoming)) {
7051
7297
  if (incoming === void 0) return KEEP;
7052
7298
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
7053
7299
  return {
@@ -7055,7 +7301,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
7055
7301
  value: incoming
7056
7302
  };
7057
7303
  }
7058
- const storedObj = isRecord$6(stored) ? stored : {};
7304
+ const storedObj = isRecord$4(stored) ? stored : {};
7059
7305
  return {
7060
7306
  kind: "value",
7061
7307
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -7178,7 +7424,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
7178
7424
  value: items
7179
7425
  };
7180
7426
  }
7181
- if (isRecord$6(v)) {
7427
+ if (isRecord$4(v)) {
7182
7428
  const out = {};
7183
7429
  for (const [k, child] of Object.entries(v)) {
7184
7430
  const s = substitute(child);
@@ -7210,7 +7456,7 @@ var SecretOverwriteRefusedError = class extends Error {
7210
7456
  this.name = "SecretOverwriteRefusedError";
7211
7457
  }
7212
7458
  };
7213
- function isRecord$5(value) {
7459
+ function isRecord$3(value) {
7214
7460
  return typeof value === "object" && value !== null && !Array.isArray(value);
7215
7461
  }
7216
7462
  function resolvedValue(pass, marker) {
@@ -7239,7 +7485,7 @@ function inArray(pass, incoming, stored) {
7239
7485
  return incoming.map((item, index) => {
7240
7486
  const twin = stored[index];
7241
7487
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
7242
- if (isRecord$5(item) && isRecord$5(twin)) return inArrayRow(pass, item, twin);
7488
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
7243
7489
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
7244
7490
  return item;
7245
7491
  });
@@ -7250,7 +7496,7 @@ function inArrayRow(pass, incoming, stored) {
7250
7496
  const twin = stored[key];
7251
7497
  if (isSecretMarker(twin)) {
7252
7498
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
7253
- } else if (isRecord$5(value) && isRecord$5(twin)) out[key] = inArrayRow(pass, value, twin);
7499
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
7254
7500
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
7255
7501
  }
7256
7502
  return out;
@@ -7258,7 +7504,7 @@ function inArrayRow(pass, incoming, stored) {
7258
7504
  async function walk(pass, incoming, stored) {
7259
7505
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
7260
7506
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
7261
- if (!isRecord$5(incoming) || !isRecord$5(stored)) return incoming;
7507
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
7262
7508
  const out = { ...incoming };
7263
7509
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
7264
7510
  return out;
@@ -7289,7 +7535,7 @@ async function restoreUnchangedSecrets(input) {
7289
7535
  function isJsonEqual(a, b) {
7290
7536
  if (Object.is(a, b)) return true;
7291
7537
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
7292
- if (isRecord$5(a) && isRecord$5(b)) {
7538
+ if (isRecord$3(a) && isRecord$3(b)) {
7293
7539
  const keys = Object.keys(a);
7294
7540
  if (keys.length !== Object.keys(b).length) return false;
7295
7541
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -7313,7 +7559,7 @@ function markerKeysOf(blob, owner) {
7313
7559
  }
7314
7560
  function nodeFromStored(value, owner) {
7315
7561
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
7316
- if (!isRecord$5(value)) return null;
7562
+ if (!isRecord$3(value)) return null;
7317
7563
  const children = /* @__PURE__ */ new Map();
7318
7564
  for (const [key, child] of Object.entries(value)) {
7319
7565
  const node = nodeFromStored(child, owner);
@@ -7608,6 +7854,28 @@ var SECRET_RETRY_MAX_MS = 5 * 6e4;
7608
7854
  /** Coalesces a burst of `keychain.changed` events into one re-resolve. */
7609
7855
  var SECRET_CHANGE_DEBOUNCE_MS = 250;
7610
7856
  /**
7857
+ * Pair a catalogue with the function that builds its ports FROM THE MIGRATION API. The one
7858
+ * place a catalogue is bound: a migration reaches nothing a ports binder cannot reach
7859
+ * through `api` (guard `check-migration-ports-surface`).
7860
+ */
7861
+ function migrationSet(catalogue, bindPorts) {
7862
+ return { bind: (api) => defineAddonMigrations(catalogue, bindPorts(api)) };
7863
+ }
7864
+ /** A mixed array is a mistake: the other kind would be dropped without a word. */
7865
+ function refuseMixed(form, kept, dropped) {
7866
+ 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`);
7867
+ }
7868
+ function catalogueOf(list) {
7869
+ const kept = list.filter((entry) => !("execute" in entry));
7870
+ refuseMixed("catalogue, (api) => ports", kept.length, list.length - kept.length);
7871
+ return kept;
7872
+ }
7873
+ function boundOf(list) {
7874
+ const kept = list.filter((entry) => "execute" in entry);
7875
+ refuseMixed("bound migrations", kept.length, list.length - kept.length);
7876
+ return kept;
7877
+ }
7878
+ /**
7611
7879
  * Base class for CamStack addons. Eliminates settings boilerplate:
7612
7880
  *
7613
7881
  * - Typed `config` property with automatic resolution from store + defaults
@@ -7774,29 +8042,62 @@ var BaseAddon = class {
7774
8042
  await this.loadScopedSchemas();
7775
8043
  return normalized;
7776
8044
  }
8045
+ async runMigrations(first, second, third) {
8046
+ if (typeof second === "function") return this.runMigrationSets([migrationSet(catalogueOf(first), second)], third);
8047
+ return this.runBound(boundOf(first), second);
8048
+ }
7777
8049
  /**
7778
- * Run this addon's migration catalogue (D987 M3) through the hub's `migrations`
7779
- * engine. Call it at the point of the boot where the data must already have the new
7780
- * shape — `onInitialize`, or `onRestoreDevices` for a migration that needs the
7781
- * restored devices — with the catalogue bound to the addon's ports
7782
- * (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
7783
- *
7784
- * An engine that cannot be reached or refuses the catalogue is logged and runs
7785
- * nothing; the boot continues. A migration that FAILED (or was blocked by one)
7786
- * and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
7787
- * serve data whose shape it cannot trust; `tolerate` migrations never do.
7788
- *
7789
- * ALWAYS pass the whole catalogue; a phase that must run only some of it passes
7790
- * `{ only: [ids] }` — never a filtered catalogue (the engine would judge the
7791
- * omitted applied ids "newer").
8050
+ * Several catalogues of ONE owner in one declaration (the engine replaces an owner's
8051
+ * catalogue on every declare, so two calls would each judge the other's ids "newer").
8052
+ * Build each entry with `migrationSet(catalogue, (api) => ports)`.
7792
8053
  */
7793
- async runMigrations(migrations, options) {
8054
+ async runMigrationSets(sets, options) {
8055
+ const api = this.ctx.migrationApi;
8056
+ if (api === void 0) throw new Error(`${this.ctx.id}: the migration API is not available on this context`);
8057
+ return this.runBound(sets.flatMap((set) => set.bind(api)), options);
8058
+ }
8059
+ /**
8060
+ * A device addon states its instance kind once, before its migrations run, and the one-switch
8061
+ * migration (registry `enabled` to the instance body, epic #440 step 3) joins whatever
8062
+ * catalogue the addon runs, in the SAME declaration (the engine replaces an owner's catalogue
8063
+ * on every declare).
8064
+ */
8065
+ declareRegistrySwitch(spec) {
8066
+ this.registrySwitchSpec = spec;
8067
+ }
8068
+ registrySwitchSpec = null;
8069
+ registrySwitchBound() {
8070
+ const spec = this.registrySwitchSpec;
8071
+ if (spec === null) return [];
8072
+ const api = this.ctx.migrationApi;
8073
+ if (api === void 0) {
8074
+ this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
8075
+ return [];
8076
+ }
8077
+ return migrationSet([registrySwitchToBodyMigration({
8078
+ addonId: this.ctx.id,
8079
+ date: "2026-11-06",
8080
+ seq: 1e3,
8081
+ initialBody: spec.initialBody
8082
+ })], (a) => registrySwitchPortsOver({
8083
+ api: integrationRowsApiOver(a),
8084
+ records: switchRecordsOverMigrationApi(a),
8085
+ kind: spec.kind
8086
+ })).bind(api);
8087
+ }
8088
+ async runBound(declared, options) {
8089
+ const added = this.registrySwitchBound();
8090
+ const migrations = [...declared, ...added];
8091
+ const phased = options?.only === void 0 || added.length === 0 ? options : {
8092
+ ...options,
8093
+ only: [...options.only, ...added.map((m) => m.meta.id)]
8094
+ };
7794
8095
  const api = this.ctx.api.migrations;
7795
8096
  const report = await runAddonMigrations({
7796
8097
  declareOwner: (input) => api.declareOwner.mutate(input),
7797
8098
  startMigration: (input) => api.startMigration.mutate(input),
7798
8099
  finishMigration: (input) => api.finishMigration.mutate(input)
7799
- }, migrations, this.ctx.logger, options);
8100
+ }, migrations, this.ctx.logger, phased);
7800
8101
  if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
7801
8102
  return report;
7802
8103
  }
@@ -8869,114 +9170,94 @@ function normalizeAddonInitResult(result) {
8869
9170
  if (Array.isArray(result)) return { providers: result };
8870
9171
  return result;
8871
9172
  }
8872
- var PREFIX = "records/";
8873
- /** The base of every records failure. `detail` is the human part of the message. */
8874
- var RecordsError = class extends Error {
8875
- code;
8876
- detail;
8877
- constructor(code, detail) {
8878
- super(`${PREFIX}${code}: ${detail}`);
8879
- this.name = "RecordsError";
8880
- this.code = code;
8881
- this.detail = detail;
8882
- }
8883
- };
8884
- var InvalidRecordError = class extends RecordsError {
8885
- constructor(detail) {
8886
- super("invalid-record", detail);
8887
- this.name = "InvalidRecordError";
8888
- }
8889
- };
8890
- /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
8891
- var DeclarationRefusedError = class extends RecordsError {
8892
- constructor(detail) {
8893
- super("declaration-refused", detail);
8894
- this.name = "DeclarationRefusedError";
8895
- }
8896
- };
8897
- /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
8898
- /** The files a kind may live in. `history` is device-history's (D850), never records. */
8899
- var RECORD_DATABASES = ["settings", "events"];
8900
- /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
8901
- var RECORD_CLASSES = [
8902
- "config",
8903
- "ledger",
8904
- "audit",
8905
- "mirror",
8906
- "ephemeral"
8907
- ];
8908
- var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
8909
- var RECORD_MAX_DATA_BYTES = 1024 * 1024;
8910
- var RECORD_BATCH_MAX = 1e3;
8911
- var RECORD_QUERY_MAX = 1e3;
8912
- /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
8913
- var RECORD_SETTINGS_MAX_ROWS = 5e4;
9173
+ object({
9174
+ field: string().min(1),
9175
+ on: literal("advance")
9176
+ });
8914
9177
  /**
8915
- * Secret fields of a record, addressed the way a Zod schema declares them
8916
- * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8917
- * (`auth.accessToken`, `headers[].value`).
8918
- *
8919
- * `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
8920
- * names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
8921
- * key releases exactly that key's secret.
9178
+ * Output schema shared by the contribution + live methods.
8922
9179
  *
8923
- * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8924
- * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8925
- * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8926
- * leaf names its element: `headers[X-Api].value`.
9180
+ * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
9181
+ * tabs[]) without importing from `../interfaces/config-ui.js` — a
9182
+ * concrete-but-lenient Zod object keeps tRPC output inference happy
9183
+ * (using `z.unknown()` here collapses unrelated router branches to
9184
+ * `unknown` when the generator re-inlines the huge AppRouter type).
8927
9185
  *
8928
- * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
9186
+ * `.passthrough()` on sections/fields accepts whatever FormBuilder
9187
+ * extensions the caller adds (showWhen, displayScale, …) without
9188
+ * rebuilding every time a new field kind is introduced.
8929
9189
  */
8930
- /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8931
- function parseSecretPath(path) {
8932
- if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8933
- return path.split(".").map((raw) => {
8934
- const each = raw.endsWith("[]");
8935
- const map = raw.endsWith("{}");
8936
- const key = each || map ? raw.slice(0, -2) : raw;
8937
- if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8938
- return {
8939
- key,
8940
- each,
8941
- map
8942
- };
8943
- });
9190
+ var ContributionSectionSchema = object({
9191
+ id: string(),
9192
+ title: string(),
9193
+ description: string().optional(),
9194
+ style: _enum(["card", "accordion"]).optional(),
9195
+ defaultCollapsed: boolean().optional(),
9196
+ columns: union([
9197
+ literal(1),
9198
+ literal(2),
9199
+ literal(3),
9200
+ literal(4)
9201
+ ]).optional(),
9202
+ tab: string().optional(),
9203
+ location: _enum([
9204
+ "settings",
9205
+ "top-tab",
9206
+ "hero"
9207
+ ]).optional(),
9208
+ order: number().optional(),
9209
+ fields: array(any())
9210
+ });
9211
+ object({
9212
+ tabs: array(object({
9213
+ id: string(),
9214
+ label: string(),
9215
+ icon: string(),
9216
+ order: number().optional()
9217
+ })).optional(),
9218
+ sections: array(ContributionSectionSchema)
9219
+ }).nullable();
9220
+ object({ deviceId: number() }), object({ deviceId: number() }), object({
9221
+ deviceId: number(),
9222
+ patch: record(string(), unknown())
9223
+ }), object({ success: literal(true) });
9224
+ object({ deviceId: number() }), unknown().nullable();
9225
+ function method(input, output, options) {
9226
+ return {
9227
+ input,
9228
+ output,
9229
+ kind: options?.kind ?? "query",
9230
+ ...options?.auth !== void 0 ? { auth: options.auth } : {},
9231
+ ...options?.access !== void 0 ? { access: options.access } : {},
9232
+ ...options?.role !== void 0 ? { role: options.role } : {},
9233
+ ...options?.caller !== void 0 ? { caller: options.caller } : {},
9234
+ timeoutMs: options?.timeoutMs
9235
+ };
8944
9236
  }
8945
- /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8946
- function secretArrayPrefixes(path) {
8947
- const segments = parseSecretPath(path);
8948
- const prefixes = [];
8949
- const walked = [];
8950
- for (const segment of segments) {
8951
- walked.push(segment.key);
8952
- if (segment.each) prefixes.push(walked.join("."));
8953
- }
8954
- return prefixes;
9237
+ /**
9238
+ * A wrapper/system-only method: served exclusively by the cap's system-level
9239
+ * provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
9240
+ * driver natives don't stub out a wrapper concern (e.g. a cross-device cache
9241
+ * overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
9242
+ */
9243
+ function systemMethod(input, output, options) {
9244
+ return {
9245
+ ...method(input, output, options),
9246
+ systemOnly: true
9247
+ };
8955
9248
  }
8956
9249
  /**
8957
- * The share-view scope kinds a share-link token can carry. The hub mints
8958
- * and validates them (`ShareViewGrantSchema` builds its
8959
- * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9250
+ * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
9251
+ * on `InferProvider`. The `providerOptional: true` literal is what
9252
+ * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
9253
+ * for when this is the honest answer and when it is a soft stub.
8960
9254
  */
8961
- var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
8962
- /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
8963
- var PeerBytesTicketSchema = object({
8964
- /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
8965
- url: string().min(1),
8966
- /**
8967
- * The HOST node this URL means something on — the hub or a named agent,
8968
- * never a runner. {@link AddonPeerBytes.open} compares it to its own and
8969
- * refuses `cross-node` by name when they differ, without dialling.
8970
- */
8971
- hostNodeId: string().min(1),
8972
- expiresAtMs: number().int().nonnegative(),
8973
- /**
8974
- * What the producer DECLARED the body to be, when it knows — `null` when it
8975
- * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
8976
- * must be able to tell "the producer did not say" from "the body is empty".
8977
- */
8978
- declaredBytes: number().int().nonnegative().nullable()
8979
- });
9255
+ function optionalMethod(input, output, options) {
9256
+ return {
9257
+ ...method(input, output, options),
9258
+ providerOptional: true
9259
+ };
9260
+ }
8980
9261
  function defOf(schema) {
8981
9262
  const zodBag = Reflect.get(schema, "_zod");
8982
9263
  if (typeof zodBag !== "object" || zodBag === null) return {};
@@ -9195,94 +9476,30 @@ function defineRecordKinds(specs) {
9195
9476
  }
9196
9477
  return out;
9197
9478
  }
9198
- object({
9199
- field: string().min(1),
9200
- on: literal("advance")
9201
- });
9202
9479
  /**
9203
- * Output schema shared by the contribution + live methods.
9204
- *
9205
- * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
9206
- * tabs[]) without importing from `../interfaces/config-ui.js` — a
9207
- * concrete-but-lenient Zod object keeps tRPC output inference happy
9208
- * (using `z.unknown()` here collapses unrelated router branches to
9209
- * `unknown` when the generator re-inlines the huge AppRouter type).
9210
- *
9211
- * `.passthrough()` on sections/fields accepts whatever FormBuilder
9212
- * extensions the caller adds (showWhen, displayScale, …) without
9213
- * rebuilding every time a new field kind is introduced.
9480
+ * The share-view scope kinds a share-link token can carry. The hub mints
9481
+ * and validates them (`ShareViewGrantSchema` builds its
9482
+ * enum from this list); a data plane names the kinds it ACCEPTS in `share`.
9214
9483
  */
9215
- var ContributionSectionSchema = object({
9216
- id: string(),
9217
- title: string(),
9218
- description: string().optional(),
9219
- style: _enum(["card", "accordion"]).optional(),
9220
- defaultCollapsed: boolean().optional(),
9221
- columns: union([
9222
- literal(1),
9223
- literal(2),
9224
- literal(3),
9225
- literal(4)
9226
- ]).optional(),
9227
- tab: string().optional(),
9228
- location: _enum([
9229
- "settings",
9230
- "top-tab",
9231
- "hero"
9232
- ]).optional(),
9233
- order: number().optional(),
9234
- fields: array(any())
9484
+ var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
9485
+ /** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
9486
+ var PeerBytesTicketSchema = object({
9487
+ /** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
9488
+ url: string().min(1),
9489
+ /**
9490
+ * The HOST node this URL means something on — the hub or a named agent,
9491
+ * never a runner. {@link AddonPeerBytes.open} compares it to its own and
9492
+ * refuses `cross-node` by name when they differ, without dialling.
9493
+ */
9494
+ hostNodeId: string().min(1),
9495
+ expiresAtMs: number().int().nonnegative(),
9496
+ /**
9497
+ * What the producer DECLARED the body to be, when it knows — `null` when it
9498
+ * does not. Never `0` for unknown (D393): a consumer sizing a bound off this
9499
+ * must be able to tell "the producer did not say" from "the body is empty".
9500
+ */
9501
+ declaredBytes: number().int().nonnegative().nullable()
9235
9502
  });
9236
- object({
9237
- tabs: array(object({
9238
- id: string(),
9239
- label: string(),
9240
- icon: string(),
9241
- order: number().optional()
9242
- })).optional(),
9243
- sections: array(ContributionSectionSchema)
9244
- }).nullable();
9245
- object({ deviceId: number() }), object({ deviceId: number() }), object({
9246
- deviceId: number(),
9247
- patch: record(string(), unknown())
9248
- }), object({ success: literal(true) });
9249
- object({ deviceId: number() }), unknown().nullable();
9250
- function method(input, output, options) {
9251
- return {
9252
- input,
9253
- output,
9254
- kind: options?.kind ?? "query",
9255
- ...options?.auth !== void 0 ? { auth: options.auth } : {},
9256
- ...options?.access !== void 0 ? { access: options.access } : {},
9257
- ...options?.role !== void 0 ? { role: options.role } : {},
9258
- ...options?.caller !== void 0 ? { caller: options.caller } : {},
9259
- timeoutMs: options?.timeoutMs
9260
- };
9261
- }
9262
- /**
9263
- * A wrapper/system-only method: served exclusively by the cap's system-level
9264
- * provider (`InferProvider`), and OPTIONAL on `InferNativeProvider` so per-device
9265
- * driver natives don't stub out a wrapper concern (e.g. a cross-device cache
9266
- * overview). The `systemOnly: true` literal is what `InferNativeProvider` keys on.
9267
- */
9268
- function systemMethod(input, output, options) {
9269
- return {
9270
- ...method(input, output, options),
9271
- systemOnly: true
9272
- };
9273
- }
9274
- /**
9275
- * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
9276
- * on `InferProvider`. The `providerOptional: true` literal is what
9277
- * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
9278
- * for when this is the honest answer and when it is a soft stub.
9279
- */
9280
- function optionalMethod(input, output, options) {
9281
- return {
9282
- ...method(input, output, options),
9283
- providerOptional: true
9284
- };
9285
- }
9286
9503
  var READING_QUANTITIES = [
9287
9504
  "temperature",
9288
9505
  "pressure",
@@ -10417,7 +10634,6 @@ var CAP_NAMES = Object.freeze([
10417
10634
  "climate-control",
10418
10635
  "color",
10419
10636
  "composer",
10420
- "connection-test",
10421
10637
  "connectivity",
10422
10638
  "consumables",
10423
10639
  "contact",
@@ -11564,6 +11780,10 @@ Object.freeze({
11564
11780
  "all",
11565
11781
  "one"
11566
11782
  ]
11783
+ },
11784
+ {
11785
+ "path": "positionUpdatedAt",
11786
+ "valueType": "number"
11567
11787
  }
11568
11788
  ],
11569
11789
  "meter": [{
@@ -11818,22 +12038,6 @@ Object.freeze({
11818
12038
  "path": "pumpRunning",
11819
12039
  "valueType": "boolean"
11820
12040
  },
11821
- {
11822
- "path": "lastDrink",
11823
- "valueType": "number"
11824
- },
11825
- {
11826
- "path": "currentHourDrink",
11827
- "valueType": "number"
11828
- },
11829
- {
11830
- "path": "last24hDrink",
11831
- "valueType": "number"
11832
- },
11833
- {
11834
- "path": "todayDrink",
11835
- "valueType": "number"
11836
- },
11837
12041
  {
11838
12042
  "path": "error",
11839
12043
  "valueType": "string"
@@ -12399,6 +12603,59 @@ Object.freeze({
12399
12603
  }
12400
12604
  ]
12401
12605
  });
12606
+ Object.freeze({
12607
+ "actions": { "run": 363e4 },
12608
+ "audio-analyzer": { "classify": 3e4 },
12609
+ "custom-model-registry": { "importModelBundle": 18e5 },
12610
+ "database-snapshot": { "writeSnapshot": 18e5 },
12611
+ "device-manager": {
12612
+ "migrateDevice": 72e4,
12613
+ "runDiscoverySweep": 12e4
12614
+ },
12615
+ "device-provider": { "reloadDevice": 18e4 },
12616
+ "llm": {
12617
+ "generate": 6e5,
12618
+ "generateVision": 6e5,
12619
+ "testProfile": 6e5
12620
+ },
12621
+ "llm-runtime": {
12622
+ "complete": 6e5,
12623
+ "completeApple": 6e5,
12624
+ "ensureStarted": 6e5,
12625
+ "installModel": 36e5
12626
+ },
12627
+ "local-network": { "scanNetwork": 9e4 },
12628
+ "model-convert": { "convert": 6e5 },
12629
+ "pipeline-analytics": {
12630
+ "addRetrainFrameFromRecording": 6e4,
12631
+ "offerRetrainArchive": 12e4,
12632
+ "proposeRetrainAnnotationsWithLlm": 18e4,
12633
+ "resolveRetrainTrainingCorpus": 6e4,
12634
+ "writeRetrainArchive": 36e5
12635
+ },
12636
+ "server-management": { "applyServerUpdate": 96e4 },
12637
+ "terminal-session": { "pullOutput": 15e3 },
12638
+ "training": {
12639
+ "canaryResult": 12e4,
12640
+ "cancelJob": 12e4,
12641
+ "planJob": 6e4,
12642
+ "registerResult": 18e5,
12643
+ "rollbackCanary": 12e4,
12644
+ "startJob": 12e4,
12645
+ "startJobBatch": 12e4
12646
+ },
12647
+ "training-provider": {
12648
+ "cancelJob": 6e4,
12649
+ "cleanupJob": 3e5,
12650
+ "getJob": 6e4,
12651
+ "listJobEvents": 6e4,
12652
+ "listJobs": 12e4,
12653
+ "offerArtifact": 3e5,
12654
+ "readResult": 3e5,
12655
+ "submitJob": 18e5,
12656
+ "uploadDataset": 72e5
12657
+ }
12658
+ });
12402
12659
  object({
12403
12660
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
12404
12661
  params: record(string(), union([string(), number()])).optional()
@@ -12428,7 +12685,7 @@ function sleep(ms) {
12428
12685
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
12429
12686
  }
12430
12687
  //#endregion
12431
- //#region ../types/dist/composition-pOHbTzRB.mjs
12688
+ //#region ../types/dist/composition-BmBHuDTQ.mjs
12432
12689
  /**
12433
12690
  * The ffmpeg build every CamStack node downloads, per platform and arch.
12434
12691
  *
@@ -12861,7 +13118,7 @@ var table = {
12861
13118
  },
12862
13119
  dwell: {
12863
13120
  minArgs: 3,
12864
- maxArgs: 3,
13121
+ maxArgs: 4,
12865
13122
  apply: () => {
12866
13123
  throw new ExpressionEvalError("dwell: stateful evaluation context is required");
12867
13124
  }
@@ -13943,6 +14200,432 @@ var IntegrationInstanceRefSchema = object({
13943
14200
  ]),
13944
14201
  candidateStableId: string().optional()
13945
14202
  });
14203
+ /**
14204
+ * notification-output — canonical, capability-gated notification delivery.
14205
+ *
14206
+ * Apprise-derived model (see
14207
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14208
+ * callers emit ONE canonical `Notification`; each provider declares a
14209
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14210
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14211
+ * message to what the kind supports — callers never special-case a service.
14212
+ *
14213
+ * DESIGN DECISIONS (locked):
14214
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14215
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14216
+ * cap. Rationale: the admin UI needs one uniform surface across the
14217
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14218
+ * alternative would fork the UI per addon and cannot host the
14219
+ * discovery→adopt flow.
14220
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14221
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14222
+ * registered provider (notifiers addon + HA addon) so one catalog is
14223
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14224
+ * `addonId` the generated collection router extracts from the call input.
14225
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14226
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14227
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14228
+ * base64 fallback needed.
14229
+ *
14230
+ * TODO (deferred, closed-set change — separate decision): add
14231
+ * `providerKind: 'notify'` so notification providers surface on the unified
14232
+ * admin "Integrations" page.
14233
+ */
14234
+ /**
14235
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14236
+ * adapter picks what it supports and the degrade engine filters the rest.
14237
+ */
14238
+ var AttachmentMediaTypeSchema = _enum([
14239
+ "image",
14240
+ "video",
14241
+ "gif",
14242
+ "audio",
14243
+ "icon"
14244
+ ]);
14245
+ /**
14246
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14247
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14248
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14249
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14250
+ */
14251
+ var AttachmentSchema = object({
14252
+ mediaType: AttachmentMediaTypeSchema,
14253
+ url: string().optional(),
14254
+ bytes: _instanceof(Uint8Array).optional(),
14255
+ mime: string().optional(),
14256
+ name: string().optional()
14257
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14258
+ var NotificationFormatSchema = _enum([
14259
+ "text",
14260
+ "markdown",
14261
+ "html"
14262
+ ]);
14263
+ /**
14264
+ * The CLOSED icon vocabulary an action button may use.
14265
+ *
14266
+ * A closed set, not a free string, and that is the whole point: an arbitrary
14267
+ * icon name is one that ntfy renders, zentik silently drops, and nobody
14268
+ * notices — the same class of gap as a zone vocabulary nothing produced
14269
+ * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
14270
+ * declares `actionIcons: false` and the degrade engine strips the field.
14271
+ *
14272
+ * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
14273
+ * renderer's icon set; "acknowledge" survives an adapter that draws it
14274
+ * differently.
14275
+ *
14276
+ * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
14277
+ *
14278
+ * These names are for US. **No adapter may forward one verbatim.** Each maps
14279
+ * the whole set onto its own renderer's vocabulary through a
14280
+ * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
14281
+ * fallback, so adding a member here fails every adapter's build until someone
14282
+ * decides its glyph, which is the only place that decision can be made
14283
+ * honestly.
14284
+ *
14285
+ * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
14286
+ * `disarm` straight through; iOS feeds that string to
14287
+ * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
14288
+ * and every snooze and alarm button arrived BLANK. A pass-through is not a
14289
+ * mapping, and "the field is documented" is not "the value renders".
14290
+ *
14291
+ * Adding a member is TRAIN-BOUND. The enum lives in the published
14292
+ * `@camstack/server` closure and the cap seam validates against the HUB's copy,
14293
+ * so an addon that emits a token the running hub does not know does not lose an
14294
+ * icon — its whole `send` fails Zod validation and the notification never
14295
+ * arrives. Never emit a new token from an addon before the train carrying it.
14296
+ */
14297
+ var NotificationActionIconSchema = _enum([
14298
+ "acknowledge",
14299
+ "dismiss",
14300
+ "silence",
14301
+ "snooze",
14302
+ "view",
14303
+ "play",
14304
+ "open",
14305
+ "close",
14306
+ "lock",
14307
+ "unlock",
14308
+ "arm",
14309
+ "arm-home",
14310
+ "arm-away",
14311
+ "arm-night",
14312
+ "disarm",
14313
+ "light",
14314
+ "alert",
14315
+ "camera"
14316
+ ]);
14317
+ /** A single tap-through action button. */
14318
+ var NotificationActionSchema = object({
14319
+ id: string(),
14320
+ label: string(),
14321
+ url: string().optional(),
14322
+ /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
14323
+ icon: NotificationActionIconSchema.optional(),
14324
+ /**
14325
+ * Renders in a warning style where the notifier supports it.
14326
+ *
14327
+ * A HINT, never a gate. The callback's authority is its token and nothing
14328
+ * else — see `notification-center/action-token.ts` for what that does and
14329
+ * does not buy.
14330
+ */
14331
+ destructive: boolean().optional(),
14332
+ /**
14333
+ * How the tap should REACH the url.
14334
+ *
14335
+ * `navigate` (absent, and every button authored before this field) opens it:
14336
+ * the phone leaves the notification and shows whatever the callback returns.
14337
+ * That is right for a button whose answer the operator wants to read.
14338
+ *
14339
+ * `background` fires it as a POST and stays put. It exists for the buttons
14340
+ * whose whole point is not to interrupt — "silence this for 30 minutes" is
14341
+ * an answer to the notification, and being thrown into a browser tab to
14342
+ * confirm it costs more attention than the notification did. A backend that
14343
+ * cannot do a background call renders it as an ordinary link (the adapters
14344
+ * fall back rather than dropping the button), so this is a preference, never
14345
+ * a requirement.
14346
+ */
14347
+ mode: _enum(["navigate", "background"]).optional()
14348
+ });
14349
+ /** A delivery parameter value: what a notifier declared it takes. */
14350
+ var DeliveryParamValueSchema = union([
14351
+ string(),
14352
+ number(),
14353
+ boolean()
14354
+ ]);
14355
+ /**
14356
+ * One extra delivery parameter a notifier KIND declares (D938). A rule that
14357
+ * addresses a target of that kind may set it; a kind that declares nothing is
14358
+ * never handed one. The admin UI derives its control from this descriptor —
14359
+ * no editor knows a service by name.
14360
+ *
14361
+ * Optional fields are `.optional()`, never `.default()` (a Zod default does not
14362
+ * run on the addon cap path).
14363
+ */
14364
+ var DeliveryParamSchema = object({
14365
+ key: string().min(1),
14366
+ label: string(),
14367
+ /** i18n key of the label, resolved by the declaring addon's namespace. */
14368
+ labelKey: string().optional(),
14369
+ type: _enum([
14370
+ "enum",
14371
+ "number",
14372
+ "boolean",
14373
+ "string"
14374
+ ]),
14375
+ /** `enum` only: the closed set of accepted values. */
14376
+ options: array(object({
14377
+ value: string(),
14378
+ label: string()
14379
+ })).optional(),
14380
+ /** `number` only. */
14381
+ min: number().optional(),
14382
+ max: number().optional(),
14383
+ /** What the notifier does when the rule sets nothing; shown as the placeholder. */
14384
+ default: DeliveryParamValueSchema.optional()
14385
+ });
14386
+ /**
14387
+ * The canonical notification. `body` is the only hard field (Apprise model).
14388
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14389
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14390
+ * the adapter maps this ordinal onto its native level. `level?` is an
14391
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14392
+ * `priority` for that one target.
14393
+ */
14394
+ var NotificationSchema = object({
14395
+ body: string(),
14396
+ title: string().optional(),
14397
+ format: NotificationFormatSchema.default("text"),
14398
+ priority: number().int().min(1).max(5).default(3),
14399
+ level: string().optional(),
14400
+ attachments: array(AttachmentSchema).optional(),
14401
+ clickUrl: string().optional(),
14402
+ actions: array(NotificationActionSchema).optional(),
14403
+ sound: string().optional(),
14404
+ ttl: number().optional(),
14405
+ tag: string().optional(),
14406
+ deviceId: number().optional(),
14407
+ eventId: string().optional(),
14408
+ metadata: record(string(), unknown()).optional(),
14409
+ /**
14410
+ * Values for the parameters the target's kind DECLARES in
14411
+ * {@link TargetKindSchema} `deliveryParams`. Already validated against the
14412
+ * declaration by the sender; a notifier reads only the keys it declared.
14413
+ */
14414
+ delivery: record(string(), DeliveryParamValueSchema).optional()
14415
+ });
14416
+ /** One declared native severity/priority level for a kind. */
14417
+ var TargetKindLevelSchema = object({
14418
+ id: string(),
14419
+ label: string(),
14420
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14421
+ ordinal: number().int().min(1).max(5).nullable(),
14422
+ flags: object({
14423
+ critical: boolean().optional(),
14424
+ silent: boolean().optional(),
14425
+ noPush: boolean().optional()
14426
+ }).optional(),
14427
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14428
+ requires: array(string()).optional(),
14429
+ description: string().optional()
14430
+ });
14431
+ /** The full capability block consulted before dispatch. */
14432
+ var TargetKindCapsSchema = object({
14433
+ attachments: object({
14434
+ mediaTypes: array(AttachmentMediaTypeSchema),
14435
+ mode: _enum([
14436
+ "url",
14437
+ "bytes",
14438
+ "both"
14439
+ ]),
14440
+ max: number().int().nonnegative(),
14441
+ maxBytes: number().int().positive().optional()
14442
+ }),
14443
+ /** Max action buttons (0 = none). */
14444
+ actions: number().int().nonnegative(),
14445
+ /**
14446
+ * Whether this kind renders a per-action ICON.
14447
+ *
14448
+ * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
14449
+ * run on the addon cap path — three production failures in one day taught
14450
+ * this repo that once. Absent is read as false by the degrade engine, which
14451
+ * is the safe direction: an icon that is not rendered costs nothing, an icon
14452
+ * assumed and dropped costs the operator's trust in the field.
14453
+ */
14454
+ actionIcons: boolean().optional(),
14455
+ levels: array(TargetKindLevelSchema),
14456
+ format: array(NotificationFormatSchema),
14457
+ clickUrl: boolean(),
14458
+ sound: boolean(),
14459
+ ttl: boolean(),
14460
+ bodyMaxLen: number().int().positive()
14461
+ });
14462
+ /**
14463
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14464
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14465
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14466
+ * the union is large and not meant for runtime validation here; the exported
14467
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14468
+ */
14469
+ var ConfigSchemaPassthrough$4 = unknown();
14470
+ var TargetKindSchema = object({
14471
+ kind: string(),
14472
+ label: string(),
14473
+ icon: string(),
14474
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14475
+ addonId: string(),
14476
+ /**
14477
+ * URL of the kind's bundled BRAND icon, served by the providing addon over
14478
+ * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
14479
+ * when the addon bundles no icon for that kind — the client then falls back
14480
+ * to a neutral glyph rather than rendering the raw `icon` NAME as text.
14481
+ *
14482
+ * Root-relative on purpose: it resolves against whatever origin serves a web
14483
+ * client, and a native client joins it onto its own hub base.
14484
+ *
14485
+ * DECLARED here deliberately. It used to travel as an undeclared passthrough
14486
+ * field that survived only because the runtime cap-router forwards provider
14487
+ * output verbatim — so every consumer had to re-declare it by hand to stop
14488
+ * its own Zod parse from stripping it, and the whole arrangement would have
14489
+ * broken silently the moment output validation was tightened anywhere.
14490
+ */
14491
+ iconUrl: string().optional(),
14492
+ /**
14493
+ * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
14494
+ *
14495
+ * The server knows this and therefore says it, because the client cannot
14496
+ * safely guess: a React-Native client renders SVG and raster through two
14497
+ * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
14498
+ * not decode SVG on iOS/Android), so without this it silently fell back to a
14499
+ * placeholder glyph for every vector icon while the web build looked fine.
14500
+ *
14501
+ * Absent when {@link iconUrl} is absent, or for a legacy provider that has
14502
+ * not been updated — a client that cannot determine the type should prefer
14503
+ * its raster path, which is the safe default for an unknown image.
14504
+ */
14505
+ iconMediaType: string().optional(),
14506
+ configSchema: ConfigSchemaPassthrough$4,
14507
+ /**
14508
+ * The config keys that decide WHERE this kind's secrets are sent (server,
14509
+ * base URL, instance, chat, recipient). A save that changes any of them
14510
+ * while leaving a secret redacted is refused by the provider (D634), so an
14511
+ * editor uses this to ask for the secret on exactly those edits instead of
14512
+ * on every edit.
14513
+ *
14514
+ * Optional: absent from a provider that holds no secret (the Home Assistant
14515
+ * kinds) and from a provider older than this field — an editor that finds
14516
+ * it absent must assume ANY edit may need the secret.
14517
+ */
14518
+ destinationKeys: array(string()).optional(),
14519
+ supportsDiscovery: boolean(),
14520
+ /**
14521
+ * Extra delivery parameters a rule may set for a target of this kind (D938).
14522
+ * Absent = none; the rule editor then offers nothing.
14523
+ */
14524
+ deliveryParams: array(DeliveryParamSchema).optional(),
14525
+ caps: TargetKindCapsSchema
14526
+ });
14527
+ /**
14528
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14529
+ * (return a presence marker only) when serving `listTargets` — never
14530
+ * round-trip a stored secret to the UI.
14531
+ */
14532
+ var TargetSchema = object({
14533
+ id: string(),
14534
+ name: string(),
14535
+ kind: string(),
14536
+ addonId: string(),
14537
+ enabled: boolean(),
14538
+ config: record(string(), unknown())
14539
+ });
14540
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14541
+ var DiscoveredTargetSchema = object({
14542
+ kind: string(),
14543
+ suggestedName: string(),
14544
+ config: record(string(), unknown())
14545
+ });
14546
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14547
+ var RenderedAsSchema = object({
14548
+ level: string(),
14549
+ format: NotificationFormatSchema,
14550
+ attachmentsSent: number().int().nonnegative(),
14551
+ actionsSent: number().int().nonnegative(),
14552
+ truncated: boolean(),
14553
+ dropped: array(string())
14554
+ });
14555
+ var SendResultSchema = object({
14556
+ success: boolean(),
14557
+ error: string().optional(),
14558
+ renderedAs: RenderedAsSchema.optional()
14559
+ });
14560
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14561
+ var TestResultSchema = SendResultSchema;
14562
+ /**
14563
+ * Pre-save credential probe against a partial (unsaved) target config.
14564
+ * `resolvedUrl` never includes secrets (token stripped from path).
14565
+ */
14566
+ var ProbeTargetConfigResultSchema = object({
14567
+ ok: boolean(),
14568
+ resolvedUrl: string(),
14569
+ httpStatus: number().int().optional(),
14570
+ stateInstance: string().optional(),
14571
+ error: string().optional()
14572
+ });
14573
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
14574
+ kind: string(),
14575
+ config: record(string(), unknown()).optional(),
14576
+ /**
14577
+ * When editing / duplicating, the blank password field never round-trips
14578
+ * the stored token. Pass the source target id so the provider can restore
14579
+ * secrets server-side before dialling (same merge as upsert).
14580
+ */
14581
+ targetId: string().optional()
14582
+ }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
14583
+ kind: string(),
14584
+ config: record(string(), unknown()),
14585
+ /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
14586
+ targetId: string().optional()
14587
+ }), ProbeTargetConfigResultSchema, {
14588
+ kind: "mutation",
14589
+ auth: "admin"
14590
+ }), method(object({
14591
+ targetId: string(),
14592
+ notification: NotificationSchema
14593
+ }), SendResultSchema, {
14594
+ kind: "mutation",
14595
+ auth: "admin"
14596
+ }), method(object({
14597
+ targetId: string(),
14598
+ sample: NotificationSchema.optional()
14599
+ }), TestResultSchema, {
14600
+ kind: "mutation",
14601
+ auth: "admin"
14602
+ }), method(object({
14603
+ target: TargetSchema,
14604
+ /**
14605
+ * Duplicate flow: create a NEW target id while copying secrets from an
14606
+ * existing row. The UI never holds the stored token; blank / redacted
14607
+ * password fields are restored from this source (D634 still applies if
14608
+ * destinations diverge without a re-typed secret).
14609
+ */
14610
+ cloneSecretsFrom: string().optional()
14611
+ }), TargetSchema, {
14612
+ kind: "mutation",
14613
+ auth: "admin"
14614
+ }), method(object({ targetId: string() }), _void(), {
14615
+ kind: "mutation",
14616
+ auth: "admin"
14617
+ }), method(object({
14618
+ targetId: string(),
14619
+ enabled: boolean()
14620
+ }), _void(), {
14621
+ kind: "mutation",
14622
+ auth: "admin"
14623
+ });
14624
+ looseObject({
14625
+ name: string().min(1),
14626
+ enabled: boolean().optional()
14627
+ });
14628
+ TargetSchema.omit({ id: true });
13946
14629
  var EncodeProfileSchema = object({
13947
14630
  video: object({
13948
14631
  codec: _enum([
@@ -16408,6 +17091,39 @@ var UnstampedEventMediaCountSchema = object({
16408
17091
  /** Sum across both, or `null` when either lane could not be counted. */
16409
17092
  total: number().int().nonnegative().nullable()
16410
17093
  }).nullable();
17094
+ /**
17095
+ * Where the stored event media sits, per storage location: how many media rows
17096
+ * and how many bytes carry each location id, how many carry none (legacy,
17097
+ * resolved to the default `eventMedia` location), and how many name a location
17098
+ * that was not asked about (a deleted or never-listed one).
17099
+ *
17100
+ * One covering-index aggregate per asked location plus the NULL one, and one
17101
+ * unfiltered total that scans the covering index: O(rows), not a walk of the
17102
+ * rows themselves. `unlisted` is total minus the ASKED locations minus NULL, so
17103
+ * it is a deleted location only when every location id was asked.
17104
+ * `null` is "could not be measured", never zero.
17105
+ */
17106
+ var MediaLocationCensusInputSchema = object({ locationIds: array(string().min(1)).max(50).readonly() });
17107
+ var MediaLocationCensusSchema = object({
17108
+ locations: array(object({
17109
+ locationId: string(),
17110
+ rows: number().int().nonnegative(),
17111
+ bytes: number().nonnegative()
17112
+ })).readonly(),
17113
+ unstamped: object({
17114
+ rows: number().int().nonnegative(),
17115
+ bytes: number().nonnegative()
17116
+ }),
17117
+ /** Rows stamped with a location id that was not in the asked list. */
17118
+ unlisted: object({
17119
+ rows: number().int().nonnegative(),
17120
+ bytes: number().nonnegative()
17121
+ }),
17122
+ total: object({
17123
+ rows: number().int().nonnegative(),
17124
+ bytes: number().nonnegative()
17125
+ })
17126
+ });
16411
17127
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
16412
17128
  /** The independently selectable logical storage classes — every class
16413
17129
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -20406,31 +21122,21 @@ var APPLIANCE_CAP_VOCABULARY = {
20406
21122
  "pet-fountain": {
20407
21123
  scope: "device",
20408
21124
  noun: t("Pet fountain", "Fontana per animali"),
20409
- actions: [
20410
- {
20411
- id: "petFountain.pumpOn",
20412
- method: "setPump",
20413
- label: t("Pump on", "Pompa accesa"),
20414
- phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
20415
- icon: "play",
20416
- args: { on: true }
20417
- },
20418
- {
20419
- id: "petFountain.pumpOff",
20420
- method: "setPump",
20421
- label: t("Pump off", "Pompa spenta"),
20422
- phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
20423
- icon: "square",
20424
- args: { on: false }
20425
- },
20426
- {
20427
- id: "petFountain.resetDailyConsumption",
20428
- method: "resetDailyConsumption",
20429
- label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
20430
- phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
20431
- icon: "rotate-ccw"
20432
- }
20433
- ],
21125
+ actions: [{
21126
+ id: "petFountain.pumpOn",
21127
+ method: "setPump",
21128
+ label: t("Pump on", "Pompa accesa"),
21129
+ phrase: t("Start the pump of {device}", "Avvia la pompa di {device}"),
21130
+ icon: "play",
21131
+ args: { on: true }
21132
+ }, {
21133
+ id: "petFountain.pumpOff",
21134
+ method: "setPump",
21135
+ label: t("Pump off", "Pompa spenta"),
21136
+ phrase: t("Stop the pump of {device}", "Ferma la pompa di {device}"),
21137
+ icon: "square",
21138
+ args: { on: false }
21139
+ }],
20434
21140
  state: [{
20435
21141
  kind: "boolean",
20436
21142
  field: "empty",
@@ -22449,7 +23155,6 @@ var SYSTEM_CAP_VOCABULARY = {
22449
23155
  "calendar-source": system(INTERNAL),
22450
23156
  calendars: system("calendars feed schedules and conditions, not device actions"),
22451
23157
  composer: system("device composition — an authoring tool, not an action"),
22452
- "connection-test": system(INTERNAL),
22453
23158
  "core-blocks": system(INTERNAL),
22454
23159
  "custom-model-registry": system(ML),
22455
23160
  "data-store-provider": system(INTERNAL),
@@ -44324,8 +45029,15 @@ var ActionInputSchema = object({
44324
45029
  var ActionRunOriginSchema = object({
44325
45030
  /** The automation block whose step started it. */
44326
45031
  blockId: string().min(1).optional() });
44327
- /** `started` = the caller did not ask to wait. */
44328
- var ActionRunOutcomeSchema = union([AutomationRunOutcomeSchema, literal("started")]);
45032
+ /**
45033
+ * `started` = the caller did not ask to wait. `timed-out` = the run reached the
45034
+ * ceiling (`ACTION_RUN_MAX_MS`) and was stopped; it is never a `ran`.
45035
+ */
45036
+ var ActionRunOutcomeSchema = union([
45037
+ AutomationRunOutcomeSchema,
45038
+ literal("started"),
45039
+ literal("timed-out")
45040
+ ]);
44329
45041
  var ActionRunResultSchema = object({
44330
45042
  runId: string().min(1),
44331
45043
  outcome: ActionRunOutcomeSchema,
@@ -44359,427 +45071,6 @@ var UnitWarningSchema = object({
44359
45071
  assumedUnit: string(),
44360
45072
  message: string()
44361
45073
  });
44362
- /**
44363
- * notification-output — canonical, capability-gated notification delivery.
44364
- *
44365
- * Apprise-derived model (see
44366
- * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
44367
- * callers emit ONE canonical `Notification`; each provider declares a
44368
- * per-kind capability descriptor (`TargetKind`), and the pure degrade
44369
- * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
44370
- * message to what the kind supports — callers never special-case a service.
44371
- *
44372
- * DESIGN DECISIONS (locked):
44373
- * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
44374
- * `setTargetEnabled`), each provider persisting via the `settings-store`
44375
- * cap. Rationale: the admin UI needs one uniform surface across the
44376
- * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
44377
- * alternative would fork the UI per addon and cannot host the
44378
- * discovery→adopt flow.
44379
- * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
44380
- * the generated cap-mount auto-`concatCollection`-fans them across every
44381
- * registered provider (notifiers addon + HA addon) so one catalog is
44382
- * routable. `send` / `testTarget` / CRUD route to ONE provider by the
44383
- * `addonId` the generated collection router extracts from the call input.
44384
- * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
44385
- * transformer) + UDS MsgPack both round-trip typed arrays — already used by
44386
- * `storage` / `storage-provider` / `recording` caps over the same path. No
44387
- * base64 fallback needed.
44388
- *
44389
- * TODO (deferred, closed-set change — separate decision): add
44390
- * `providerKind: 'notify'` so notification providers surface on the unified
44391
- * admin "Integrations" page.
44392
- */
44393
- /**
44394
- * Zentik-derived typed-media enum — the superset across every kind. Each
44395
- * adapter picks what it supports and the degrade engine filters the rest.
44396
- */
44397
- var AttachmentMediaTypeSchema = _enum([
44398
- "image",
44399
- "video",
44400
- "gif",
44401
- "audio",
44402
- "icon"
44403
- ]);
44404
- /**
44405
- * A single attachment. Exactly one of `url` (remote source, most adapters
44406
- * prefer this) or `bytes` (inline source; required for Pushover-style
44407
- * bytes-only kinds) MUST be present — the degrade engine expresses a
44408
- * url→bytes fetch as a `needsFetch` directive the adapter executes.
44409
- */
44410
- var AttachmentSchema = object({
44411
- mediaType: AttachmentMediaTypeSchema,
44412
- url: string().optional(),
44413
- bytes: _instanceof(Uint8Array).optional(),
44414
- mime: string().optional(),
44415
- name: string().optional()
44416
- }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
44417
- var NotificationFormatSchema = _enum([
44418
- "text",
44419
- "markdown",
44420
- "html"
44421
- ]);
44422
- /**
44423
- * The CLOSED icon vocabulary an action button may use.
44424
- *
44425
- * A closed set, not a free string, and that is the whole point: an arbitrary
44426
- * icon name is one that ntfy renders, zentik silently drops, and nobody
44427
- * notices — the same class of gap as a zone vocabulary nothing produced
44428
- * ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
44429
- * declares `actionIcons: false` and the degrade engine strips the field.
44430
- *
44431
- * Named by INTENT, never by glyph. "check" would tie the vocabulary to one
44432
- * renderer's icon set; "acknowledge" survives an adapter that draws it
44433
- * differently.
44434
- *
44435
- * ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
44436
- *
44437
- * These names are for US. **No adapter may forward one verbatim.** Each maps
44438
- * the whole set onto its own renderer's vocabulary through a
44439
- * `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
44440
- * fallback, so adding a member here fails every adapter's build until someone
44441
- * decides its glyph, which is the only place that decision can be made
44442
- * honestly.
44443
- *
44444
- * This paragraph is the bug. Zentik declared `actionIcons: true` and passed
44445
- * `disarm` straight through; iOS feeds that string to
44446
- * `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
44447
- * and every snooze and alarm button arrived BLANK. A pass-through is not a
44448
- * mapping, and "the field is documented" is not "the value renders".
44449
- *
44450
- * Adding a member is TRAIN-BOUND. The enum lives in the published
44451
- * `@camstack/server` closure and the cap seam validates against the HUB's copy,
44452
- * so an addon that emits a token the running hub does not know does not lose an
44453
- * icon — its whole `send` fails Zod validation and the notification never
44454
- * arrives. Never emit a new token from an addon before the train carrying it.
44455
- */
44456
- var NotificationActionIconSchema = _enum([
44457
- "acknowledge",
44458
- "dismiss",
44459
- "silence",
44460
- "snooze",
44461
- "view",
44462
- "play",
44463
- "open",
44464
- "close",
44465
- "lock",
44466
- "unlock",
44467
- "arm",
44468
- "arm-home",
44469
- "arm-away",
44470
- "arm-night",
44471
- "disarm",
44472
- "light",
44473
- "alert",
44474
- "camera"
44475
- ]);
44476
- /** A single tap-through action button. */
44477
- var NotificationActionSchema = object({
44478
- id: string(),
44479
- label: string(),
44480
- url: string().optional(),
44481
- /** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
44482
- icon: NotificationActionIconSchema.optional(),
44483
- /**
44484
- * Renders in a warning style where the notifier supports it.
44485
- *
44486
- * A HINT, never a gate. The callback's authority is its token and nothing
44487
- * else — see `notification-center/action-token.ts` for what that does and
44488
- * does not buy.
44489
- */
44490
- destructive: boolean().optional(),
44491
- /**
44492
- * How the tap should REACH the url.
44493
- *
44494
- * `navigate` (absent, and every button authored before this field) opens it:
44495
- * the phone leaves the notification and shows whatever the callback returns.
44496
- * That is right for a button whose answer the operator wants to read.
44497
- *
44498
- * `background` fires it as a POST and stays put. It exists for the buttons
44499
- * whose whole point is not to interrupt — "silence this for 30 minutes" is
44500
- * an answer to the notification, and being thrown into a browser tab to
44501
- * confirm it costs more attention than the notification did. A backend that
44502
- * cannot do a background call renders it as an ordinary link (the adapters
44503
- * fall back rather than dropping the button), so this is a preference, never
44504
- * a requirement.
44505
- */
44506
- mode: _enum(["navigate", "background"]).optional()
44507
- });
44508
- /** A delivery parameter value: what a notifier declared it takes. */
44509
- var DeliveryParamValueSchema = union([
44510
- string(),
44511
- number(),
44512
- boolean()
44513
- ]);
44514
- /**
44515
- * One extra delivery parameter a notifier KIND declares (D938). A rule that
44516
- * addresses a target of that kind may set it; a kind that declares nothing is
44517
- * never handed one. The admin UI derives its control from this descriptor —
44518
- * no editor knows a service by name.
44519
- *
44520
- * Optional fields are `.optional()`, never `.default()` (a Zod default does not
44521
- * run on the addon cap path).
44522
- */
44523
- var DeliveryParamSchema = object({
44524
- key: string().min(1),
44525
- label: string(),
44526
- /** i18n key of the label, resolved by the declaring addon's namespace. */
44527
- labelKey: string().optional(),
44528
- type: _enum([
44529
- "enum",
44530
- "number",
44531
- "boolean",
44532
- "string"
44533
- ]),
44534
- /** `enum` only: the closed set of accepted values. */
44535
- options: array(object({
44536
- value: string(),
44537
- label: string()
44538
- })).optional(),
44539
- /** `number` only. */
44540
- min: number().optional(),
44541
- max: number().optional(),
44542
- /** What the notifier does when the rule sets nothing; shown as the placeholder. */
44543
- default: DeliveryParamValueSchema.optional()
44544
- });
44545
- /**
44546
- * The canonical notification. `body` is the only hard field (Apprise model).
44547
- * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
44548
- * NOT a fixed severity enum — each kind declares its own `caps.levels` and
44549
- * the adapter maps this ordinal onto its native level. `level?` is an
44550
- * optional kind-native level id (`emergency`, `silent`, …) that overrides
44551
- * `priority` for that one target.
44552
- */
44553
- var NotificationSchema = object({
44554
- body: string(),
44555
- title: string().optional(),
44556
- format: NotificationFormatSchema.default("text"),
44557
- priority: number().int().min(1).max(5).default(3),
44558
- level: string().optional(),
44559
- attachments: array(AttachmentSchema).optional(),
44560
- clickUrl: string().optional(),
44561
- actions: array(NotificationActionSchema).optional(),
44562
- sound: string().optional(),
44563
- ttl: number().optional(),
44564
- tag: string().optional(),
44565
- deviceId: number().optional(),
44566
- eventId: string().optional(),
44567
- metadata: record(string(), unknown()).optional(),
44568
- /**
44569
- * Values for the parameters the target's kind DECLARES in
44570
- * {@link TargetKindSchema} `deliveryParams`. Already validated against the
44571
- * declaration by the sender; a notifier reads only the keys it declared.
44572
- */
44573
- delivery: record(string(), DeliveryParamValueSchema).optional()
44574
- });
44575
- /** One declared native severity/priority level for a kind. */
44576
- var TargetKindLevelSchema = object({
44577
- id: string(),
44578
- label: string(),
44579
- /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
44580
- ordinal: number().int().min(1).max(5).nullable(),
44581
- flags: object({
44582
- critical: boolean().optional(),
44583
- silent: boolean().optional(),
44584
- noPush: boolean().optional()
44585
- }).optional(),
44586
- /** e.g. Pushover `emergency` requires `retry` / `expire`. */
44587
- requires: array(string()).optional(),
44588
- description: string().optional()
44589
- });
44590
- /** The full capability block consulted before dispatch. */
44591
- var TargetKindCapsSchema = object({
44592
- attachments: object({
44593
- mediaTypes: array(AttachmentMediaTypeSchema),
44594
- mode: _enum([
44595
- "url",
44596
- "bytes",
44597
- "both"
44598
- ]),
44599
- max: number().int().nonnegative(),
44600
- maxBytes: number().int().positive().optional()
44601
- }),
44602
- /** Max action buttons (0 = none). */
44603
- actions: number().int().nonnegative(),
44604
- /**
44605
- * Whether this kind renders a per-action ICON.
44606
- *
44607
- * `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
44608
- * run on the addon cap path — three production failures in one day taught
44609
- * this repo that once. Absent is read as false by the degrade engine, which
44610
- * is the safe direction: an icon that is not rendered costs nothing, an icon
44611
- * assumed and dropped costs the operator's trust in the field.
44612
- */
44613
- actionIcons: boolean().optional(),
44614
- levels: array(TargetKindLevelSchema),
44615
- format: array(NotificationFormatSchema),
44616
- clickUrl: boolean(),
44617
- sound: boolean(),
44618
- ttl: boolean(),
44619
- bodyMaxLen: number().int().positive()
44620
- });
44621
- /**
44622
- * `configSchema` is a `ConfigUISchema` tree passed through to the admin
44623
- * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
44624
- * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
44625
- * the union is large and not meant for runtime validation here; the exported
44626
- * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
44627
- */
44628
- var ConfigSchemaPassthrough$4 = unknown();
44629
- var TargetKindSchema = object({
44630
- kind: string(),
44631
- label: string(),
44632
- icon: string(),
44633
- /** Stamped by each provider so the concat-fanned catalog stays routable. */
44634
- addonId: string(),
44635
- /**
44636
- * URL of the kind's bundled BRAND icon, served by the providing addon over
44637
- * its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
44638
- * when the addon bundles no icon for that kind — the client then falls back
44639
- * to a neutral glyph rather than rendering the raw `icon` NAME as text.
44640
- *
44641
- * Root-relative on purpose: it resolves against whatever origin serves a web
44642
- * client, and a native client joins it onto its own hub base.
44643
- *
44644
- * DECLARED here deliberately. It used to travel as an undeclared passthrough
44645
- * field that survived only because the runtime cap-router forwards provider
44646
- * output verbatim — so every consumer had to re-declare it by hand to stop
44647
- * its own Zod parse from stripping it, and the whole arrangement would have
44648
- * broken silently the moment output validation was tightened anywhere.
44649
- */
44650
- iconUrl: string().optional(),
44651
- /**
44652
- * Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
44653
- *
44654
- * The server knows this and therefore says it, because the client cannot
44655
- * safely guess: a React-Native client renders SVG and raster through two
44656
- * DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
44657
- * not decode SVG on iOS/Android), so without this it silently fell back to a
44658
- * placeholder glyph for every vector icon while the web build looked fine.
44659
- *
44660
- * Absent when {@link iconUrl} is absent, or for a legacy provider that has
44661
- * not been updated — a client that cannot determine the type should prefer
44662
- * its raster path, which is the safe default for an unknown image.
44663
- */
44664
- iconMediaType: string().optional(),
44665
- configSchema: ConfigSchemaPassthrough$4,
44666
- /**
44667
- * The config keys that decide WHERE this kind's secrets are sent (server,
44668
- * base URL, instance, chat, recipient). A save that changes any of them
44669
- * while leaving a secret redacted is refused by the provider (D634), so an
44670
- * editor uses this to ask for the secret on exactly those edits instead of
44671
- * on every edit.
44672
- *
44673
- * Optional: absent from a provider that holds no secret (the Home Assistant
44674
- * kinds) and from a provider older than this field — an editor that finds
44675
- * it absent must assume ANY edit may need the secret.
44676
- */
44677
- destinationKeys: array(string()).optional(),
44678
- supportsDiscovery: boolean(),
44679
- /**
44680
- * Extra delivery parameters a rule may set for a target of this kind (D938).
44681
- * Absent = none; the rule editor then offers nothing.
44682
- */
44683
- deliveryParams: array(DeliveryParamSchema).optional(),
44684
- caps: TargetKindCapsSchema
44685
- });
44686
- /**
44687
- * A persisted target. `config` holds secrets; providers REDACT secret fields
44688
- * (return a presence marker only) when serving `listTargets` — never
44689
- * round-trip a stored secret to the UI.
44690
- */
44691
- var TargetSchema = object({
44692
- id: string(),
44693
- name: string(),
44694
- kind: string(),
44695
- addonId: string(),
44696
- enabled: boolean(),
44697
- config: record(string(), unknown())
44698
- });
44699
- /** A discovery-surfaced candidate (config is partial + non-secret). */
44700
- var DiscoveredTargetSchema = object({
44701
- kind: string(),
44702
- suggestedName: string(),
44703
- config: record(string(), unknown())
44704
- });
44705
- /** The degrade engine's report — what was resolved / dropped / degraded. */
44706
- var RenderedAsSchema = object({
44707
- level: string(),
44708
- format: NotificationFormatSchema,
44709
- attachmentsSent: number().int().nonnegative(),
44710
- actionsSent: number().int().nonnegative(),
44711
- truncated: boolean(),
44712
- dropped: array(string())
44713
- });
44714
- var SendResultSchema = object({
44715
- success: boolean(),
44716
- error: string().optional(),
44717
- renderedAs: RenderedAsSchema.optional()
44718
- });
44719
- /** Same shape as SendResult — kept as a distinct name for the test panel. */
44720
- var TestResultSchema = SendResultSchema;
44721
- /**
44722
- * Pre-save credential probe against a partial (unsaved) target config.
44723
- * `resolvedUrl` never includes secrets (token stripped from path).
44724
- */
44725
- var ProbeTargetConfigResultSchema = object({
44726
- ok: boolean(),
44727
- resolvedUrl: string(),
44728
- httpStatus: number().int().optional(),
44729
- stateInstance: string().optional(),
44730
- error: string().optional()
44731
- });
44732
- method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
44733
- kind: string(),
44734
- config: record(string(), unknown()).optional(),
44735
- /**
44736
- * When editing / duplicating, the blank password field never round-trips
44737
- * the stored token. Pass the source target id so the provider can restore
44738
- * secrets server-side before dialling (same merge as upsert).
44739
- */
44740
- targetId: string().optional()
44741
- }), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
44742
- kind: string(),
44743
- config: record(string(), unknown()),
44744
- /** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
44745
- targetId: string().optional()
44746
- }), ProbeTargetConfigResultSchema, {
44747
- kind: "mutation",
44748
- auth: "admin"
44749
- }), method(object({
44750
- targetId: string(),
44751
- notification: NotificationSchema
44752
- }), SendResultSchema, {
44753
- kind: "mutation",
44754
- auth: "admin"
44755
- }), method(object({
44756
- targetId: string(),
44757
- sample: NotificationSchema.optional()
44758
- }), TestResultSchema, {
44759
- kind: "mutation",
44760
- auth: "admin"
44761
- }), method(object({
44762
- target: TargetSchema,
44763
- /**
44764
- * Duplicate flow: create a NEW target id while copying secrets from an
44765
- * existing row. The UI never holds the stored token; blank / redacted
44766
- * password fields are restored from this source (D634 still applies if
44767
- * destinations diverge without a re-typed secret).
44768
- */
44769
- cloneSecretsFrom: string().optional()
44770
- }), TargetSchema, {
44771
- kind: "mutation",
44772
- auth: "admin"
44773
- }), method(object({ targetId: string() }), _void(), {
44774
- kind: "mutation",
44775
- auth: "admin"
44776
- }), method(object({
44777
- targetId: string(),
44778
- enabled: boolean()
44779
- }), _void(), {
44780
- kind: "mutation",
44781
- auth: "admin"
44782
- });
44783
45074
  _enum([
44784
45075
  "automation",
44785
45076
  "action",
@@ -44847,6 +45138,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
44847
45138
  kind: "mutation",
44848
45139
  auth: "admin"
44849
45140
  });
45141
+ /** `timeoutMs` of `actions.run`: a waited call outlives any legal run. */
45142
+ var ACTION_RUN_TIMEOUT_MS = 363e4;
44850
45143
  /**
44851
45144
  * actions — the ONE surface for runnable actions, for the UI and for
44852
45145
  * automations. Provided by the core-blocks builtin on the hub.
@@ -44865,6 +45158,12 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
44865
45158
  * An admin, and an in-process caller (an automation block), may run any action.
44866
45159
  * Every refusal is typed (`[not-linked] …`) and logged.
44867
45160
  *
45161
+ * **A run lasts at most `ACTION_RUN_MAX_MS` (60 min).** The provider stops a
45162
+ * run that reaches it and answers `timed-out` (never `ran`); an action whose
45163
+ * `wait` steps alone add up to more is refused at create/update
45164
+ * (`[invalid-steps]`). `run` declares a `timeoutMs` above that ceiling, so a
45165
+ * waited call (an automation step) is never cut by the 60 s transport default.
45166
+ *
44868
45167
  * A second `run` of an action that is already running is REFUSED — traced and
44869
45168
  * logged — never queued.
44870
45169
  */
@@ -44891,7 +45190,8 @@ method(object({}), array(ActionEntrySchema), { auth: "admin" }), method(object({
44891
45190
  role: "viewer",
44892
45191
  auth: "protected",
44893
45192
  kind: "mutation",
44894
- caller: "required"
45193
+ caller: "required",
45194
+ timeoutMs: ACTION_RUN_TIMEOUT_MS
44895
45195
  }), method(ActionIdInput, _void(), {
44896
45196
  kind: "mutation",
44897
45197
  auth: "admin"
@@ -46966,52 +47266,7 @@ DeviceType.Light, method(object({
46966
47266
  level: number().min(0).max(100),
46967
47267
  lastChangedAt: number()
46968
47268
  });
46969
- /**
46970
- * `broker` — unified pub/sub broker registry, system-scoped collection.
46971
- *
46972
- * The cap models any kind-tagged message broker the user wants to
46973
- * register and that other addons might consume. The first two kinds
46974
- * are MQTT (mosquitto / aedes embedded / cloud bridge) and
46975
- * Home Assistant (HA WebSocket — subscribe_entities + call_service).
46976
- * Future kinds (Zigbee2MQTT bridge, ZHA, KNX, Telegram, …) plug in
46977
- * the same surface.
46978
- *
46979
- * Why one cap, not one cap per kind:
46980
- * - The integrations page wants a single table of "every broker"
46981
- * across kinds; a unified cap drives it without join logic.
46982
- * - Generic admin operations (add / remove / test / status) are
46983
- * identical across kinds — duplicating them per cap was busywork.
46984
- * - The `network-access` cap precedent: same interface, many
46985
- * `providerKind: 'ingress'` implementations (Tailscale, ngrok, …).
46986
- *
46987
- * What stays kind-specific:
46988
- * - `getBrokerConfig` payload (kind decides whether it returns
46989
- * mqtt URL+creds, HA baseUrl+token, …) — typed as
46990
- * `Record<string, unknown>` at the wire; consumers narrow.
46991
- * - `publish` / `subscribe` / `getState` arguments (target / filter /
46992
- * key) — also typed as `Record<string, unknown>` so each kind can
46993
- * evolve its surface (MQTT topic+qos vs HA entity_id+domain)
46994
- * without rebreaking the cap signature.
46995
- * - `add` `settings` payload (different fields per kind, validated by
46996
- * the kind-specific provider).
46997
- *
46998
- * Bidirectionality:
46999
- * - `publish` is RPC — synchronous result (provider-defined).
47000
- * - `subscribe` returns a subscription handle; the actual message
47001
- * stream flows over the typed event-bus as `broker.message` events
47002
- * keyed by `(brokerId, subscriptionId)`. Consumers filter in their
47003
- * event handler. Subscriptions persist across reconnects — the
47004
- * provider re-subscribes upstream after a transport drop.
47005
- *
47006
- * Why event-bus push (not a subscription RPC stream):
47007
- * - Matches the rest of CamStack's D8 contract — events for telemetry,
47008
- * RPC for loss-is-a-bug. Broker messages are telemetry (a single
47009
- * drop is recoverable via `getState({key})`).
47010
- * - Frees `broker.subscribe` from holding a long-lived RPC channel.
47011
- * - Cross-process: events already route through `$event-bus`; no
47012
- * per-broker wire-shaping needed.
47013
- */
47014
- var BrokerStatusEnum = _enum([
47269
+ _enum([
47015
47270
  "connected",
47016
47271
  "disconnected",
47017
47272
  "connecting",
@@ -47019,141 +47274,12 @@ var BrokerStatusEnum = _enum([
47019
47274
  "unreachable",
47020
47275
  "error"
47021
47276
  ]);
47022
- var BrokerInfoSchema = object({
47023
- /** Stable broker id. Persisted; survives addon restarts. */
47024
- id: string(),
47025
- /** Addon id of the provider that OWNS this broker.
47026
- *
47027
- * The `broker` cap is a system-scoped collection: several addons
47028
- * register a `broker` provider, each owning a DISJOINT set of
47029
- * brokers (mqtt-broker owns `mqtt_*`, provider-homeassistant owns
47030
- * `ha_*`). A broker therefore belongs to exactly one addon — like a
47031
- * device belongs to one integration. The admin UI threads this id
47032
- * back as the `{ addonId }` system-collection selector on every
47033
- * id-keyed call (`get` / `getSettings` / `setSettings` / `remove` /
47034
- * `testConnection`), so the call routes to the OWNING provider
47035
- * instead of defaulting to the first-registered one. */
47036
- addonId: string(),
47037
- /** Human-readable name (operator-chosen at add-time). */
47038
- name: string(),
47039
- /** Provider-defined kind tag — `mqtt` / `home-assistant` / future. */
47040
- kind: string(),
47041
- status: BrokerStatusEnum,
47042
- /** Free-form provider-specific info (HA version, MQTT broker
47043
- * flavour, latency, mTLS active, …). */
47044
- info: record(string(), unknown()),
47045
- /** Ms epoch of the last connection probe / status update. */
47046
- lastCheckedAt: number().nullable(),
47047
- /** Last error message, when `status` indicates failure. */
47048
- error: string().nullable()
47049
- });
47050
47277
  var RegistryStatusSchema = object({
47051
47278
  brokerCount: number().int().nonnegative(),
47052
47279
  connectedCount: number().int().nonnegative()
47053
47280
  });
47054
- /**
47055
- * One entry per `broker` provider — which addon provides which broker
47056
- * kind(s). The unified create picker reads this to know, for each
47057
- * (addonId, kind) pair the operator can pick, where to route the
47058
- * follow-up `getSettingsSchema` / `testSettings` / `add` calls (via the
47059
- * `{ addonId }` selector). A provider only advertises a kind here when
47060
- * it implements `getSettingsSchema` for that kind (so the picker never
47061
- * offers a kind whose creation form can't be rendered).
47062
- */
47063
- var BrokerProviderInfoSchema = object({
47064
- /** Addon id of the `broker` provider this entry describes. */
47065
- addonId: string(),
47066
- /** Broker kinds this provider can create, with a display label. */
47067
- kinds: array(object({
47068
- kind: string(),
47069
- label: string(),
47070
- /**
47071
- * Relative hub path to start an interactive account link (OAuth popup).
47072
- * May include `{{brokerId}}`; admin-ui substitutes and appends `?popup=1`.
47073
- */
47074
- interactiveConnectPath: string().min(1).optional(),
47075
- /** Relative hub path to disconnect the linked account (same popup pattern). */
47076
- interactiveDisconnectPath: string().min(1).optional(),
47077
- /**
47078
- * The kind signs in through a server-held interactive session instead of
47079
- * (or before) typed credentials. `basePath` is a hub-relative route set
47080
- * served by the owning addon (`/addon/<id>/...`) speaking the sign-in
47081
- * contract: `POST {basePath}/start` (body: the form's settings) answers
47082
- * `{ sessionId, loginUrl }`; `GET {basePath}/status?sessionId=` answers
47083
- * `{ phase: 'starting' | 'awaiting-login' | 'captured' | 'error' |
47084
- * 'cancelled', loginUrl, error }`; `POST {basePath}/commit`
47085
- * (`{ sessionId, name, brokerId? }`) stores the credentials on a new or
47086
- * existing broker and answers `{ brokerId }`; `POST {basePath}/cancel`
47087
- * (`{ sessionId }`) drops the session. The dialog that edits a broker
47088
- * offers it as the default path; the fields the session fills are
47089
- * marked `filledBySignIn` in the kind's settings schema.
47090
- *
47091
- * `methods` lists the ways the session can sign in, recommended first:
47092
- * `'device-code'` adds `POST {basePath}/code/start` (body: the form's
47093
- * settings) answering `{ sessionId, userCode, verificationUrl,
47094
- * expiresAt }` — the operator types `userCode` at `verificationUrl` on
47095
- * any device, and the same `status` / `commit` / `cancel` routes follow
47096
- * (status then carries `method`, `userCode`, `verificationUrl`,
47097
- * `expiresAt` and the phases `'awaiting-code'` / `'expired'`);
47098
- * `'proxy'` is the `{basePath}/start` flow above. Absent means
47099
- * `['proxy']`.
47100
- */
47101
- signIn: object({
47102
- basePath: string().min(1),
47103
- methods: array(_enum(["device-code", "proxy"])).optional()
47104
- }).optional()
47105
- }))
47106
- });
47107
- var ListInputSchema = object({
47108
- /** Optional kind filter — `list({kind:'home-assistant'})` returns
47109
- * only HA brokers. Omit to list every broker. */
47110
- kind: string().optional() });
47111
47281
  var GetInputSchema = object({ id: string() });
47112
- var AddInputSchema = object({
47113
- kind: string().min(1),
47114
- name: string().min(1),
47115
- /**
47116
- * ADOPT an existing id instead of minting a new one.
47117
- *
47118
- * Written the day this cost an outage. A broker's id is not a detail: HA
47119
- * devices carry it inside their `stableId` (`ha:ha_004:dev:…`), so a broker
47120
- * lost from config and re-added as `ha_001` leaves every one of its devices
47121
- * bound to a broker that no longer exists. Re-entering the password under the
47122
- * ORIGINAL id turns a multi-step device migration back into re-entering a
47123
- * password.
47124
- *
47125
- * A provider MUST refuse an id that is already in use — adopting a live
47126
- * broker's id would silently take it over.
47127
- */
47128
- id: string().min(1).optional(),
47129
- /** Kind-specific settings (e.g. MQTT `{url,username,password}` or HA
47130
- * `{baseUrl,accessToken}`). Validated by the kind-specific provider
47131
- * branch on receipt — invalid shape rejects the add. */
47132
- settings: record(string(), unknown())
47133
- });
47134
- var AddResultSchema = object({ id: string() });
47135
- var RemoveInputSchema = object({ id: string() });
47136
- var TestConnectionResultSchema = discriminatedUnion("ok", [object({
47137
- ok: literal(true),
47138
- latencyMs: number().nonnegative()
47139
- }), object({
47140
- ok: literal(false),
47141
- error: string()
47142
- })]);
47143
47282
  var SettingsRecordSchema$1 = record(string(), unknown());
47144
- var SettingsSchemaInputSchema = object({ kind: string() });
47145
- var TestSettingsInputSchema = object({
47146
- kind: string(),
47147
- settings: SettingsRecordSchema$1
47148
- });
47149
- var TestSettingsResultSchema = discriminatedUnion("ok", [object({
47150
- ok: literal(true),
47151
- latencyMs: number().nonnegative().optional()
47152
- }).strict(), object({
47153
- ok: literal(false),
47154
- error: string()
47155
- })]);
47156
- var SettingsSchemaResultSchema = unknown().nullable();
47157
47283
  var PublishInputSchema = object({
47158
47284
  brokerId: string(),
47159
47285
  /** Kind-specific routing target.
@@ -47187,25 +47313,7 @@ var GetStateInputSchema = object({
47187
47313
  * HA: entity_id (returns the cached entity state). */
47188
47314
  key: string()
47189
47315
  });
47190
- method(ListInputSchema, array(BrokerInfoSchema)), method(GetInputSchema, BrokerInfoSchema.nullable()), method(_void(), array(BrokerProviderInfoSchema), { auth: "admin" }), method(AddInputSchema, AddResultSchema, {
47191
- kind: "mutation",
47192
- auth: "admin"
47193
- }), method(RemoveInputSchema, _void(), {
47194
- kind: "mutation",
47195
- auth: "admin"
47196
- }), method(GetInputSchema, TestConnectionResultSchema, {
47197
- kind: "mutation",
47198
- auth: "admin"
47199
- }), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(object({
47200
- id: string(),
47201
- settings: SettingsRecordSchema$1
47202
- }), _void(), {
47203
- kind: "mutation",
47204
- auth: "admin"
47205
- }), method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(SettingsSchemaInputSchema, SettingsSchemaResultSchema, { auth: "admin" }), method(TestSettingsInputSchema, TestSettingsResultSchema, {
47206
- kind: "mutation",
47207
- auth: "admin"
47208
- }), method(PublishInputSchema, unknown(), {
47316
+ method(GetInputSchema, SettingsRecordSchema$1.nullable(), { auth: "admin" }), method(PublishInputSchema, unknown(), {
47209
47317
  kind: "mutation",
47210
47318
  auth: "admin"
47211
47319
  }), method(SubscribeInputSchema, SubscribeResultSchema, {
@@ -48869,37 +48977,6 @@ method(object({
48869
48977
  kind: "mutation",
48870
48978
  auth: "admin"
48871
48979
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
48872
- var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
48873
- object({
48874
- outcome: literal("validated"),
48875
- /** Round-trip of the sign-in, when the provider measured it. */
48876
- latencyMs: number().nonnegative().optional(),
48877
- /** Optional human detail worth showing next to the tick
48878
- * ("3 devices visible on this account"). */
48879
- detail: string().optional()
48880
- }).strict(),
48881
- object({
48882
- outcome: literal("rejected"),
48883
- error: string()
48884
- }).strict(),
48885
- object({
48886
- outcome: literal("inconclusive"),
48887
- error: string()
48888
- }).strict()
48889
- ]);
48890
- var ConnectionTestInputSchema = object({
48891
- /** Candidate integration settings, exactly as the create form collected them. */
48892
- settings: record(string(), unknown()) });
48893
- /**
48894
- * What the provider's test actually DOES, so the UI can say it in words before
48895
- * the operator presses the button ("Signs in to the Dreo cloud"). Purely
48896
- * descriptive — it never changes routing.
48897
- */
48898
- var ConnectionTestDescriptorSchema = object({ label: string() });
48899
- method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
48900
- kind: "mutation",
48901
- auth: "admin"
48902
- }), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
48903
48980
  object({
48904
48981
  /** True when the upstream system considers the entity connected. */
48905
48982
  connected: boolean(),
@@ -49157,6 +49234,9 @@ var MediaPlayerStatusSchema = object({
49157
49234
  /** Repeat mode. Null when no repeat surface.
49158
49235
  * Pair with `DeviceFeature.MediaPlayerRepeat`. */
49159
49236
  repeat: MediaPlayerRepeatSchema.nullable(),
49237
+ /** Ms epoch when `position` was read from the device. Null when the driver
49238
+ * does not say; a UI that advances the position while playing counts from it. */
49239
+ positionUpdatedAt: number().nullable().default(null),
49160
49240
  /** Ms epoch when the slice was last updated. */
49161
49241
  lastChangedAt: number()
49162
49242
  });
@@ -49736,7 +49816,9 @@ var ThresholdTransformDraftSchema = object({
49736
49816
  comparison: _enum(["gte", "lte"]),
49737
49817
  threshold: number(),
49738
49818
  startDwellMs: number().nonnegative(),
49739
- stopDwellMs: number().nonnegative()
49819
+ stopDwellMs: number().nonnegative(),
49820
+ /** Samples a start needs; absent = the compiler's default for the source (2 for running power, else 1). */
49821
+ minSamples: number().int().min(1).optional()
49740
49822
  });
49741
49823
  var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
49742
49824
  IdentityTransformDraftSchema,
@@ -51303,7 +51385,14 @@ var DiscoveryCandidateSchema = object({
51303
51385
  /** `stableId` of the gateway candidate this device was found BEHIND. */
51304
51386
  parentStableId: string().optional(),
51305
51387
  /** `false` = shown for context but not pickable. Default true. */
51306
- selectable: boolean().optional()
51388
+ selectable: boolean().optional(),
51389
+ /**
51390
+ * Keys of the provider's creation form (`getChildCreationSchema`) this candidate
51391
+ * cannot be adopted without — a key for an encrypted board, a pairing code. The
51392
+ * admin asks for exactly these, on the creation form prefilled with
51393
+ * `prefilledConfig`, before it adopts. Absent or empty = adopt as it is.
51394
+ */
51395
+ needsParams: array(string()).optional()
51307
51396
  });
51308
51397
  /**
51309
51398
  * Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
@@ -51362,12 +51451,24 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
51362
51451
  }), array(DiscoveryCandidateSchema), {
51363
51452
  kind: "mutation",
51364
51453
  auth: "admin"
51365
- }), method(object({}), CreationSchemaOutputSchema), method(object({}), object({ deviceType: _enum(DeviceType).nullable() })), method(object({ candidate: DiscoveryCandidateSchema }), DeviceSummarySchema, {
51454
+ }), method(object({}), CreationSchemaOutputSchema), method(object({
51455
+ /** The integration asked about; a provider whose integrations differ answers per one. */
51456
+ integrationId: string().optional() }), object({ deviceType: _enum(DeviceType).nullable() })), method(object({
51457
+ candidate: DiscoveryCandidateSchema,
51458
+ /** The integration the operator adopts into; a provider with several instances needs it. */
51459
+ integrationId: string().optional()
51460
+ }), DeviceSummarySchema, {
51366
51461
  kind: "mutation",
51367
51462
  auth: "admin"
51368
- }), method(object({}), boolean()), method(object({ type: _enum(DeviceType) }), CreationSchemaOutputSchema), method(object({
51463
+ }), method(object({}), boolean()), method(object({
51369
51464
  type: _enum(DeviceType),
51370
- config: record(string(), unknown())
51465
+ /** The integration asked about; a provider whose integrations differ answers per one. */
51466
+ integrationId: string().optional()
51467
+ }), CreationSchemaOutputSchema), method(object({
51468
+ type: _enum(DeviceType),
51469
+ config: record(string(), unknown()),
51470
+ /** The integration the operator adds the device to; a provider with several instances needs it. */
51471
+ integrationId: string().optional()
51371
51472
  }), DeviceSummarySchema, {
51372
51473
  kind: "mutation",
51373
51474
  auth: "admin"
@@ -52077,7 +52178,10 @@ method(object({
52077
52178
  auth: "admin"
52078
52179
  }), method(object({
52079
52180
  addonId: string(),
52080
- type: _enum(DeviceType)
52181
+ type: _enum(DeviceType),
52182
+ /** The integration the form is for; a provider whose integrations differ (a hub
52183
+ * integration takes no manual add) answers per integration. Absent = the addon's own. */
52184
+ integrationId: string().optional()
52081
52185
  }), unknown().nullable()), method(object({
52082
52186
  addonId: string(),
52083
52187
  type: _enum(DeviceType),
@@ -52161,7 +52265,11 @@ method(object({
52161
52265
  kind: "mutation",
52162
52266
  auth: "admin",
52163
52267
  timeoutMs: 12e4
52164
- }), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
52268
+ }), method(object({
52269
+ addonId: string(),
52270
+ /** The integration the Add-Device dialog is open on; absent = the addon's own. */
52271
+ integrationId: string().optional()
52272
+ }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
52165
52273
  deviceId: number(),
52166
52274
  key: string(),
52167
52275
  value: unknown()
@@ -54940,6 +55048,7 @@ var IntegrationWithStateSchema = object({
54940
55048
  id: string(),
54941
55049
  addonId: string(),
54942
55050
  name: string(),
55051
+ /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
54943
55052
  enabled: boolean(),
54944
55053
  info: record(string(), unknown()).readonly(),
54945
55054
  /** The discovery candidate this integration was set up from (D984). */
@@ -54952,6 +55061,7 @@ var IntegrationLiteSchema = object({
54952
55061
  id: string(),
54953
55062
  addonId: string(),
54954
55063
  name: string(),
55064
+ /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
54955
55065
  enabled: boolean(),
54956
55066
  info: record(string(), unknown()).readonly(),
54957
55067
  /** The discovery candidate this integration was set up from (D984). */
@@ -54997,10 +55107,9 @@ var AvailableIntegrationTypeSchema = object({
54997
55107
  * locations" checkbox. Provider-declared in the addon manifest. */
54998
55108
  supportsLocationImport: boolean(),
54999
55109
  /**
55000
- * True when this integration DECLARES a pre-creation test (the
55001
- * `connection-test` cap, or a broker whose settings it stores). Drives the
55002
- * Test button: an integration that cannot be tested must say so up front
55003
- * rather than offering a button that always answers the same nonsense.
55110
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
55111
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
55112
+ * button that always answers the same nonsense.
55004
55113
  */
55005
55114
  canTest: boolean(),
55006
55115
  existingInstances: array(object({
@@ -55034,7 +55143,7 @@ var TestConnectionStatusEnum = _enum([
55034
55143
  "inconclusive",
55035
55144
  "unsupported"
55036
55145
  ]);
55037
- var TestConnectionResultSchema$1 = object({
55146
+ var TestConnectionResultSchema = object({
55038
55147
  /** True ONLY for `validated`. Never true for a test that did not run. */
55039
55148
  success: boolean(),
55040
55149
  error: string().optional(),
@@ -55051,15 +55160,21 @@ var TestConnectionResultSchema$1 = object({
55051
55160
  var CreateIntegrationInputSchema = object({
55052
55161
  addonId: string(),
55053
55162
  name: string(),
55054
- enabled: boolean().optional(),
55055
55163
  info: record(string(), unknown()).optional(),
55056
55164
  /** `stableId` of the discovery candidate the form was seeded from (D984). */
55057
55165
  originStableId: string().optional(),
55058
- settings: record(string(), unknown()).optional()
55166
+ settings: record(string(), unknown()).optional(),
55167
+ /** The instance kind being created, for a provider with several; omitted = its only testable kind. */
55168
+ kind: string().min(1).optional()
55059
55169
  });
55060
55170
  var UpdateIntegrationInputSchema = object({
55061
55171
  id: string(),
55062
55172
  name: string().optional(),
55173
+ /**
55174
+ * Accepted for a FIXED builtin only (`info.fixed`: alarm panel, camera grid, core blocks,
55175
+ * terminal), which keeps no instance record: the registry flag is its one store. Any other
55176
+ * integration is switched through `integration-instances.setInstanceEnabled`.
55177
+ */
55063
55178
  enabled: boolean().optional(),
55064
55179
  info: record(string(), unknown()).optional()
55065
55180
  });
@@ -55076,13 +55191,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
55076
55191
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
55077
55192
  kind: "mutation",
55078
55193
  auth: "admin"
55079
- }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" }), method(object({
55080
- addonId: string(),
55081
- settings: record(string(), unknown())
55082
- }), TestConnectionResultSchema$1, {
55083
- kind: "mutation",
55084
- auth: "admin"
55085
- });
55194
+ }), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
55086
55195
  /**
55087
55196
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
55088
55197
  * (an account, a relay, a destination) as typed records (D985, D986). The addon's
@@ -55106,6 +55215,14 @@ var ConfigSchemaPassthrough$3 = custom();
55106
55215
  var IntegrationInstanceIdSchema = string().min(1);
55107
55216
  var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
55108
55217
  /**
55218
+ * What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
55219
+ * instance is an integration that brings devices (its record body owns the on/off switch);
55220
+ * `services`: a connection configured from the addon's own function page, never listed on
55221
+ * Integrations.
55222
+ * It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
55223
+ */
55224
+ var IntegrationInstanceRoleSchema = _enum(["devices", "services"]);
55225
+ /**
55109
55226
  * One kind of instance a provider can create (an adapter, an account type). The sign-in and
55110
55227
  * connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
55111
55228
  * hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
@@ -55116,6 +55233,22 @@ var IntegrationInstanceKindSchema = object({
55116
55233
  /** Stable id of the kind, sent back as `createInstance.kind`. */
55117
55234
  id: string().min(1),
55118
55235
  label: string().min(1),
55236
+ /**
55237
+ * The function capability this kind is configured for (`broker`, `smtp-provider`,
55238
+ * `device-provider`, ...). A page section is the kinds whose `functionCap` it names (D1013); a
55239
+ * provider with more than one section must name it on every kind.
55240
+ */
55241
+ functionCap: string().min(1),
55242
+ /**
55243
+ * For `functionCap: 'broker'`: the registry kind of the broker an instance of this kind is
55244
+ * (`matter`, `home-assistant`, ...). A caller that needs a broker of one kind (a link field)
55245
+ * finds the instances whose kind names it; absent takes the kind `id`.
55246
+ */
55247
+ brokerKind: string().min(1).optional(),
55248
+ /** What instances of this kind are for the Integrations page; absent takes the provider's `role`. */
55249
+ role: IntegrationInstanceRoleSchema.optional(),
55250
+ /** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
55251
+ canTest: boolean().optional(),
55119
55252
  /** The kind signs in through a server-held interactive session. */
55120
55253
  signIn: object({
55121
55254
  basePath: string().min(1),
@@ -55126,22 +55259,38 @@ var IntegrationInstanceKindSchema = object({
55126
55259
  /** Relative hub path to disconnect that account. */
55127
55260
  disconnectPath: string().min(1).optional()
55128
55261
  });
55262
+ /**
55263
+ * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
55264
+ * scans the network before any instance exists (the wizard offers the candidates); `account`: the
55265
+ * devices appear after the instance signs in. `scopedToInstance`: a discovery run belongs to ONE
55266
+ * instance and its candidates are claimed by it.
55267
+ */
55268
+ var IntegrationInstanceDiscoverySchema = object({
55269
+ mode: _enum([
55270
+ "none",
55271
+ "lan",
55272
+ "account"
55273
+ ]),
55274
+ scopedToInstance: boolean()
55275
+ });
55276
+ /**
55277
+ * One link a kind of this provider declares (D1013 rule 5): the body `field` of an instance of
55278
+ * `kind` holds the id of an instance of the function cap `to.cap` (of kind `to.kind`, when set).
55279
+ * The hub indexes these so the target's delete is refused while a link names it.
55280
+ */
55281
+ var IntegrationInstanceLinkSchema = object({
55282
+ kind: string().min(1),
55283
+ field: string().min(1),
55284
+ to: object({
55285
+ cap: string().min(1),
55286
+ kind: string().min(1).optional()
55287
+ })
55288
+ });
55129
55289
  var IntegrationInstanceDescriptionSchema = object({
55130
55290
  /** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
55131
- role: _enum([
55132
- "devices",
55133
- "services",
55134
- "both"
55135
- ]),
55291
+ role: IntegrationInstanceRoleSchema,
55136
55292
  /** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
55137
- discovery: object({
55138
- mode: _enum([
55139
- "none",
55140
- "lan",
55141
- "account"
55142
- ]),
55143
- scopedToInstance: boolean()
55144
- }).optional(),
55293
+ discovery: IntegrationInstanceDiscoverySchema.optional(),
55145
55294
  /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
55146
55295
  instanceMode: IntegrationInstanceModeSchema,
55147
55296
  /** What the instance is, for the UI (`destination`, `relay`, `account`). */
@@ -55162,7 +55311,9 @@ var IntegrationInstanceDescriptionSchema = object({
55162
55311
  * `createInstance` without an `id` works: the provider mints it. Absent means the caller must
55163
55312
  * send an id (the UI then mints an opaque one).
55164
55313
  */
55165
- mintsId: boolean().optional()
55314
+ mintsId: boolean().optional(),
55315
+ /** The links to other instances the provider's kinds declare; absent means none. */
55316
+ links: array(IntegrationInstanceLinkSchema).optional()
55166
55317
  });
55167
55318
  var IntegrationInstanceStatusSchema = object({
55168
55319
  state: _enum([
@@ -55182,8 +55333,8 @@ var IntegrationInstanceSchema = object({
55182
55333
  configured: boolean(),
55183
55334
  /**
55184
55335
  * The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
55185
- * so a row written before the field existed is on). Absent when the `integrations` registry
55186
- * owns the switch (`describe().role` is `devices`): read it from the registry row.
55336
+ * so a row written before the field existed is on). The same for every role, `devices` included:
55337
+ * the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
55187
55338
  */
55188
55339
  enabled: boolean().optional(),
55189
55340
  /** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
@@ -55200,10 +55351,16 @@ var IntegrationInstancePatchSchema = object({
55200
55351
  /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
55201
55352
  values: record(string(), unknown())
55202
55353
  });
55203
- 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({
55354
+ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method(object({
55355
+ id: IntegrationInstanceIdSchema.nullable(),
55356
+ /** The kind of the create form (`id: null`) of a provider with several. */
55357
+ kind: string().min(1).optional()
55358
+ }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
55204
55359
  id: IntegrationInstanceIdSchema.optional(),
55205
55360
  name: string().min(1),
55206
- kind: string().min(1).optional()
55361
+ kind: string().min(1).optional(),
55362
+ /** Form values written with the record (a link picked in the create dialog). */
55363
+ values: record(string(), unknown()).optional()
55207
55364
  }), object({ id: string() }), {
55208
55365
  kind: "mutation",
55209
55366
  auth: "admin"
@@ -55221,8 +55378,10 @@ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method
55221
55378
  auth: "admin"
55222
55379
  }), optionalMethod(object({
55223
55380
  id: IntegrationInstanceIdSchema.nullable(),
55224
- values: record(string(), unknown())
55225
- }), TestConnectionResultSchema$1, {
55381
+ values: record(string(), unknown()),
55382
+ /** The kind to test when `id` is null and the provider has several. */
55383
+ kind: string().min(1).optional()
55384
+ }), TestConnectionResultSchema, {
55226
55385
  kind: "mutation",
55227
55386
  auth: "admin"
55228
55387
  });
@@ -57725,6 +57884,382 @@ var SystemMetricsSchema = object({
57725
57884
  gpuMemoryPercent: number().optional()
57726
57885
  });
57727
57886
  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);
57887
+ /**
57888
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
57889
+ * config documents, mirrors. The third storage API next to `ctx.settings`
57890
+ * (operator intent, D870) and device-history (numbers over time, D850).
57891
+ *
57892
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
57893
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
57894
+ * that with the addon id closed over). It is deliberately NOT in any input
57895
+ * schema, so a session can never supply it, and a call with no stamp is refused
57896
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
57897
+ * addons go through the owner's capability.
57898
+ *
57899
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
57900
+ * never `[]`. Secret fields are never on the wire: a read shows the
57901
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
57902
+ * resolves itself, and a write may carry only a keychain marker bound to the
57903
+ * row's own ref.
57904
+ *
57905
+ * Internal: addons reach it through `ctx.records`, never directly.
57906
+ */
57907
+ var RecordIdSchema = string().min(1).max(256);
57908
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
57909
+ var RecordBodySchema = record(string(), unknown());
57910
+ var RecordInputSchema = object({
57911
+ id: RecordIdSchema,
57912
+ /** The device this row belongs to (D865 removal, per-device reads). */
57913
+ deviceId: number().int().optional(),
57914
+ /** The domain clock, ms: observed / created / opened. */
57915
+ at: number().int().optional(),
57916
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
57917
+ expiresAt: number().int().optional(),
57918
+ data: RecordBodySchema
57919
+ });
57920
+ var RecordViewSchema = object({
57921
+ id: string(),
57922
+ deviceId: number().int().nullable(),
57923
+ at: number().nullable(),
57924
+ expiresAt: number().nullable(),
57925
+ rev: number().int(),
57926
+ updatedAt: number(),
57927
+ data: RecordBodySchema
57928
+ });
57929
+ /** Declared index fields only. Anything else does not compile, by design. */
57930
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
57931
+ string(),
57932
+ number(),
57933
+ boolean(),
57934
+ object({ in: array(union([
57935
+ string(),
57936
+ number(),
57937
+ boolean()
57938
+ ])).min(1).max(RECORD_BATCH_MAX) }),
57939
+ object({
57940
+ gt: union([string(), number()]).optional(),
57941
+ gte: union([string(), number()]).optional(),
57942
+ lt: union([string(), number()]).optional(),
57943
+ lte: union([string(), number()]).optional()
57944
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
57945
+ ]));
57946
+ var KindShape = { kind: RecordKindNameSchema };
57947
+ var TimeWindowShape = {
57948
+ deviceId: number().int().optional(),
57949
+ atFrom: number().optional(),
57950
+ atTo: number().optional()
57951
+ };
57952
+ var RecordQueryInputSchema = object({
57953
+ ...KindShape,
57954
+ ...TimeWindowShape,
57955
+ where: RecordWhereSchema.optional(),
57956
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
57957
+ order: _enum(["at", "id"]).optional(),
57958
+ desc: boolean().optional(),
57959
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
57960
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
57961
+ cursor: string().min(1).optional()
57962
+ });
57963
+ var RecordQueryResultSchema = object({
57964
+ records: array(RecordViewSchema),
57965
+ nextCursor: string().nullable()
57966
+ });
57967
+ var RecordKindStateSchema = _enum([
57968
+ "created",
57969
+ "unchanged",
57970
+ "updated"
57971
+ ]);
57972
+ var DeclareKindResultSchema = object({
57973
+ kindId: number().int(),
57974
+ state: RecordKindStateSchema,
57975
+ createdIndexes: array(string())
57976
+ });
57977
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
57978
+ var SecretRefsList = array(string());
57979
+ /**
57980
+ * One op of a `transact`: the single-row writes, each on a kind of the caller.
57981
+ * All ops of one call share ONE database file and ONE `transactFamily`.
57982
+ */
57983
+ var RecordTransactOpSchema = discriminatedUnion("op", [
57984
+ object({
57985
+ op: literal("put"),
57986
+ kind: RecordKindNameSchema,
57987
+ record: RecordInputSchema,
57988
+ ifRev: number().int().min(0).optional()
57989
+ }),
57990
+ object({
57991
+ op: literal("patch"),
57992
+ kind: RecordKindNameSchema,
57993
+ id: RecordIdSchema,
57994
+ data: RecordBodySchema,
57995
+ at: number().int().nullable().optional(),
57996
+ expiresAt: number().int().nullable().optional(),
57997
+ ifRev: number().int().min(1).optional()
57998
+ }),
57999
+ object({
58000
+ op: literal("delete"),
58001
+ kind: RecordKindNameSchema,
58002
+ id: RecordIdSchema
58003
+ })
58004
+ ]);
58005
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
58006
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
58007
+ kind: "mutation",
58008
+ auth: "admin"
58009
+ }), method(object({
58010
+ ...KindShape,
58011
+ id: RecordIdSchema
58012
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
58013
+ ...KindShape,
58014
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
58015
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
58016
+ ...KindShape,
58017
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
58018
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
58019
+ ...KindShape,
58020
+ record: RecordInputSchema,
58021
+ /** Compare-and-set. `0` means "the row must not exist". */
58022
+ ifRev: number().int().min(0).optional()
58023
+ }), object({
58024
+ rev: number().int(),
58025
+ releasedRefs: SecretRefsList
58026
+ }), {
58027
+ kind: "mutation",
58028
+ auth: "admin"
58029
+ }), method(object({
58030
+ ...KindShape,
58031
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
58032
+ }), object({
58033
+ count: number().int(),
58034
+ releasedRefs: SecretRefsList
58035
+ }), {
58036
+ kind: "mutation",
58037
+ auth: "admin"
58038
+ }), method(object({
58039
+ ...KindShape,
58040
+ id: RecordIdSchema,
58041
+ data: RecordBodySchema,
58042
+ at: number().int().nullable().optional(),
58043
+ expiresAt: number().int().nullable().optional(),
58044
+ ifRev: number().int().min(1).optional()
58045
+ }), object({
58046
+ rev: number().int(),
58047
+ releasedRefs: SecretRefsList
58048
+ }), {
58049
+ kind: "mutation",
58050
+ auth: "admin"
58051
+ }), method(object({
58052
+ ...KindShape,
58053
+ id: RecordIdSchema
58054
+ }), object({
58055
+ deleted: boolean(),
58056
+ secretRefs: SecretRefsList
58057
+ }), {
58058
+ kind: "mutation",
58059
+ auth: "admin"
58060
+ }), method(object({
58061
+ ...KindShape,
58062
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
58063
+ }), object({
58064
+ deleted: number().int(),
58065
+ secretRefs: SecretRefsList
58066
+ }), {
58067
+ kind: "mutation",
58068
+ auth: "admin"
58069
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
58070
+ ...KindShape,
58071
+ ...TimeWindowShape,
58072
+ where: RecordWhereSchema.optional()
58073
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
58074
+ ...KindShape,
58075
+ deviceId: number().int().optional(),
58076
+ from: number(),
58077
+ to: number(),
58078
+ bucketMs: number().int().positive()
58079
+ }), object({ buckets: array(object({
58080
+ bucketStart: number(),
58081
+ count: number().int()
58082
+ })) }), { auth: "admin" }), method(object({
58083
+ ...KindShape,
58084
+ op: _enum([
58085
+ "sum",
58086
+ "min",
58087
+ "max",
58088
+ "count"
58089
+ ]),
58090
+ field: RecordFieldPathSchema.optional(),
58091
+ groupBy: RecordFieldPathSchema.optional(),
58092
+ where: RecordWhereSchema.optional()
58093
+ }), object({ rows: array(object({
58094
+ group: union([
58095
+ string(),
58096
+ number(),
58097
+ _null()
58098
+ ]),
58099
+ value: number().nullable()
58100
+ })) }), { auth: "admin" }), method(object({
58101
+ ...KindShape,
58102
+ deviceId: number().int().optional(),
58103
+ atBefore: number().optional(),
58104
+ where: RecordWhereSchema.optional()
58105
+ }), object({
58106
+ deleted: number().int(),
58107
+ secretRefs: SecretRefsList
58108
+ }), {
58109
+ kind: "mutation",
58110
+ auth: "admin"
58111
+ }), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
58112
+ results: array(object({
58113
+ rev: number().int().nullable(),
58114
+ deleted: boolean()
58115
+ })),
58116
+ releasedRefs: SecretRefsList,
58117
+ secretRefs: SecretRefsList
58118
+ }), {
58119
+ kind: "mutation",
58120
+ auth: "admin"
58121
+ }), method(object({
58122
+ deviceId: number().int(),
58123
+ kinds: array(RecordKindNameSchema).optional()
58124
+ }), object({
58125
+ deleted: record(string(), number().int()),
58126
+ secretRefs: SecretRefsList
58127
+ }), {
58128
+ kind: "mutation",
58129
+ auth: "admin"
58130
+ }), method(object(KindShape), object({ id: number().int() }), {
58131
+ kind: "mutation",
58132
+ auth: "admin"
58133
+ });
58134
+ /**
58135
+ * The wire shapes of the migration API, version 1 (planning#447).
58136
+ *
58137
+ * A migration is code that outlives the server it was written against: an addon at
58138
+ * version 1.4 that is brought to 1.9 in one jump still runs its 1.4 catalogue, against
58139
+ * the 1.9 kernel. The only thing that code may call is {@link MigrationApiV1}; this file
58140
+ * is the contract of every method of it, one Zod pair per method.
58141
+ *
58142
+ * APPEND-ONLY. A released method is never removed and never changes meaning: an input
58143
+ * field is never removed or made required, an enum never narrows, an output field is
58144
+ * never removed. A change that cannot be expressed that way is `migration-api.v2`, next
58145
+ * to this file. `scripts/check-migration-api-append-only.ts` holds the line against
58146
+ * `scripts/migration-api-contract.json`, and every `behaviours` id below must have an
58147
+ * `it('<id>'` in `migration-api.contract.spec.ts`.
58148
+ */
58149
+ var Rows = record(string(), unknown());
58150
+ var IntegrationId = object({ integrationId: string().min(1) });
58151
+ var RecordId = object({ id: string().min(1) });
58152
+ var RecordRowSchema = object({
58153
+ id: string(),
58154
+ deviceId: number().int().nullable(),
58155
+ at: number().nullable(),
58156
+ expiresAt: number().nullable(),
58157
+ rev: number().int(),
58158
+ updatedAt: number(),
58159
+ data: Rows
58160
+ });
58161
+ var RecordPutShape = {
58162
+ id: string().min(1),
58163
+ deviceId: number().int().optional(),
58164
+ at: number().int().optional(),
58165
+ expiresAt: number().int().optional(),
58166
+ data: Rows
58167
+ };
58168
+ var MigrationIntegrationSchema = object({
58169
+ id: string(),
58170
+ addonId: string(),
58171
+ name: string(),
58172
+ info: Rows,
58173
+ /** The registry's stored switch: read by the one-switch migration, nothing else. */
58174
+ enabled: boolean().optional(),
58175
+ originStableId: string().optional()
58176
+ });
58177
+ var MigrationDeviceSchema = object({
58178
+ id: number().int(),
58179
+ integrationId: string().nullable().optional(),
58180
+ /** The owning device; null or absent for a root. */
58181
+ parentDeviceId: number().int().nullable().optional(),
58182
+ type: string().optional(),
58183
+ name: string().optional(),
58184
+ stableId: string().optional()
58185
+ });
58186
+ /** What the engine says about the migration API it serves: lets an addon notice an older server. */
58187
+ var MigrationApiInfoSchema = object({
58188
+ version: number().int(),
58189
+ methods: array(string())
58190
+ });
58191
+ object({
58192
+ message: string(),
58193
+ meta: Rows.optional(),
58194
+ /** Grouping tags of the line; a line about a device carries `{ deviceId }`. */
58195
+ tags: object({ deviceId: number().int().optional() }).optional()
58196
+ });
58197
+ object({
58198
+ owner: string().min(1),
58199
+ metas: array(MigrationMetaSchema)
58200
+ }), object({
58201
+ bootId: string(),
58202
+ snapshot: _enum([
58203
+ "none",
58204
+ "written",
58205
+ "refused"
58206
+ ]),
58207
+ steps: array(MigrationOwnerStepSchema),
58208
+ /** The migration API the engine serves; absent from a server that predates it. */
58209
+ migrationApi: MigrationApiInfoSchema.optional()
58210
+ }), object({ id: string().min(1) }), object({
58211
+ proceed: boolean(),
58212
+ state: union([literal("pending"), MigrationStatusSchema]),
58213
+ reason: string().nullable()
58214
+ }), object({
58215
+ id: string().min(1),
58216
+ result: MigrationOwnerResultSchema
58217
+ }), object({
58218
+ status: MigrationStatusSchema,
58219
+ error: string().nullable(),
58220
+ rowsChanged: number().int().nonnegative()
58221
+ }), object({
58222
+ rows: number().int().nonnegative(),
58223
+ secrets: number().int().nonnegative()
58224
+ }), IntegrationId.extend({ patch: Rows }), object({ written: boolean() }), IntegrationId.extend({ keys: array(string().min(1)) }), object({
58225
+ present: boolean(),
58226
+ removed: Rows
58227
+ }), RecordRowSchema.nullable(), RecordRowSchema.nullable(), object({
58228
+ ...RecordPutShape,
58229
+ ifRev: number().int().optional()
58230
+ }), object({ rev: number().int() }), object({ records: array(object(RecordPutShape)) }), object({ count: number().int().nonnegative() }), RecordId.extend({
58231
+ partial: Rows,
58232
+ ifRev: number().int().optional()
58233
+ }), object({ rev: number().int() }), object({ deleted: boolean() }), object({
58234
+ deviceId: number().int().optional(),
58235
+ atFrom: number().optional(),
58236
+ atTo: number().optional(),
58237
+ where: RecordWhereSchema.optional(),
58238
+ limit: number().int().min(1).optional(),
58239
+ cursor: string().min(1).optional(),
58240
+ resolveSecrets: boolean().optional()
58241
+ }), object({
58242
+ records: array(RecordRowSchema),
58243
+ nextCursor: string().nullable()
58244
+ }), object({
58245
+ deviceId: number().int().optional(),
58246
+ atBefore: number().optional(),
58247
+ where: RecordWhereSchema.optional()
58248
+ }), 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({
58249
+ ref: string().min(1),
58250
+ value: string()
58251
+ }), object({}), object({ refs: array(string()) }), object({ deleted: number().int().nonnegative() }), object({}), object({ integrations: array(MigrationIntegrationSchema) }), object({ id: string().min(1) }), MigrationIntegrationSchema.nullable(), object({
58252
+ addonId: string().min(1),
58253
+ integrationId: string().min(1).optional()
58254
+ }), object({ devices: array(MigrationDeviceSchema) }), object({ deviceId: number().int() }), object({
58255
+ id: number().int(),
58256
+ integrationId: string().nullable(),
58257
+ /** Whether the device carries any stored config; its content is not offered. */
58258
+ hasConfig: boolean()
58259
+ }).nullable(), object({
58260
+ deviceId: number().int(),
58261
+ integrationId: string().min(1)
58262
+ }), object({}), object({}), object({ nodeId: string() }), object({}), object({});
57728
58263
  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({
57729
58264
  id: string().min(1),
57730
58265
  error: string().min(1)
@@ -57754,7 +58289,9 @@ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { aut
57754
58289
  "written",
57755
58290
  "refused"
57756
58291
  ]),
57757
- steps: array(MigrationOwnerStepSchema)
58292
+ steps: array(MigrationOwnerStepSchema),
58293
+ /** The migration API this engine serves (additive: a server that predates it omits it). */
58294
+ migrationApi: MigrationApiInfoSchema.optional()
57758
58295
  }), {
57759
58296
  kind: "mutation",
57760
58297
  auth: "admin"
@@ -60471,7 +61008,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
60471
61008
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
60472
61009
  kind: "mutation",
60473
61010
  auth: "admin"
60474
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
61011
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(MediaLocationCensusInputSchema, MediaLocationCensusSchema, {
61012
+ kind: "query",
61013
+ auth: "admin"
61014
+ }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
60475
61015
  kind: "query",
60476
61016
  auth: "admin"
60477
61017
  }), method(object({}), array(RelocateJobSchema).readonly(), {
@@ -63296,7 +63836,7 @@ var BrokerStatusSchema$1 = _enum([
63296
63836
  "unreachable",
63297
63837
  "tls-error"
63298
63838
  ]);
63299
- var BrokerInfoSchema$1 = object({
63839
+ var BrokerInfoSchema = object({
63300
63840
  id: string(),
63301
63841
  name: string(),
63302
63842
  url: string(),
@@ -63336,13 +63876,6 @@ var AddBrokerInputSchema = object({
63336
63876
  });
63337
63877
  var AddBrokerResultSchema = object({ id: string() });
63338
63878
  var IdInputSchema = object({ id: string() });
63339
- var TestResultSchema$1 = discriminatedUnion("ok", [object({
63340
- ok: literal(true),
63341
- latencyMs: number()
63342
- }), object({
63343
- ok: literal(false),
63344
- error: string()
63345
- })]);
63346
63879
  var StartEmbeddedInputSchema = object({
63347
63880
  port: number().int().min(1).max(65535).default(1883),
63348
63881
  /** Allow anonymous connect (no username/password). Default: false. */
@@ -63359,15 +63892,12 @@ var StatusSchema = object({
63359
63892
  brokerCount: number(),
63360
63893
  embeddedRunning: boolean()
63361
63894
  });
63362
- method(_void(), array(BrokerInfoSchema$1)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
63895
+ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema, { auth: "admin" }), method(AddBrokerInputSchema, AddBrokerResultSchema, {
63363
63896
  kind: "mutation",
63364
63897
  auth: "admin"
63365
63898
  }), method(IdInputSchema, _void(), {
63366
63899
  kind: "mutation",
63367
63900
  auth: "admin"
63368
- }), method(IdInputSchema, TestResultSchema$1, {
63369
- kind: "mutation",
63370
- auth: "admin"
63371
63901
  }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
63372
63902
  kind: "mutation",
63373
63903
  auth: "admin"
@@ -67628,14 +68158,6 @@ object({
67628
68158
  empty: boolean().nullable(),
67629
68159
  /** True while the pump is running. Null while unknown. */
67630
68160
  pumpRunning: boolean().nullable(),
67631
- /** Water drunk in the last drink, in litres. */
67632
- lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
67633
- /** Water drunk in the current hour, in litres. */
67634
- currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
67635
- /** Water drunk over the last 24 hours (rolling), in litres. */
67636
- last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
67637
- /** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
67638
- todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
67639
68161
  /** Decoded fault message. Null means healthy; a non-null string is an active fault. */
67640
68162
  error: string().nullable(),
67641
68163
  /** Ms epoch when the slice was last refreshed. */
@@ -67648,9 +68170,6 @@ DeviceType.PetFountain, method(object({
67648
68170
  }), _void(), {
67649
68171
  kind: "mutation",
67650
68172
  auth: "protected"
67651
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
67652
- kind: "mutation",
67653
- auth: "protected"
67654
68173
  });
67655
68174
  /**
67656
68175
  * The wire shapes of the Auto tune plan and apply (D745), used by the
@@ -70882,253 +71401,6 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, met
70882
71401
  auth: "admin"
70883
71402
  });
70884
71403
  /**
70885
- * records - an addon's own facts and documents (D881): ledgers, audit rows,
70886
- * config documents, mirrors. The third storage API next to `ctx.settings`
70887
- * (operator intent, D870) and device-history (numbers over time, D850).
70888
- *
70889
- * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
70890
- * crossed a process and stated by a hub in-process caller (`ctx.records` does
70891
- * that with the addon id closed over). It is deliberately NOT in any input
70892
- * schema, so a session can never supply it, and a call with no stamp is refused
70893
- * `records/no-caller`. A kind is readable and writable only by its owner; other
70894
- * addons go through the owner's capability.
70895
- *
70896
- * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
70897
- * never `[]`. Secret fields are never on the wire: a read shows the
70898
- * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
70899
- * resolves itself, and a write may carry only a keychain marker bound to the
70900
- * row's own ref.
70901
- *
70902
- * Internal: addons reach it through `ctx.records`, never directly.
70903
- */
70904
- var RecordIdSchema = string().min(1).max(256);
70905
- /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
70906
- var RecordBodySchema = record(string(), unknown());
70907
- var RecordInputSchema = object({
70908
- id: RecordIdSchema,
70909
- /** The device this row belongs to (D865 removal, per-device reads). */
70910
- deviceId: number().int().optional(),
70911
- /** The domain clock, ms: observed / created / opened. */
70912
- at: number().int().optional(),
70913
- /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
70914
- expiresAt: number().int().optional(),
70915
- data: RecordBodySchema
70916
- });
70917
- var RecordViewSchema = object({
70918
- id: string(),
70919
- deviceId: number().int().nullable(),
70920
- at: number().nullable(),
70921
- expiresAt: number().nullable(),
70922
- rev: number().int(),
70923
- updatedAt: number(),
70924
- data: RecordBodySchema
70925
- });
70926
- /** Declared index fields only. Anything else does not compile, by design. */
70927
- var RecordWhereSchema = record(RecordFieldPathSchema, union([
70928
- string(),
70929
- number(),
70930
- boolean(),
70931
- object({ in: array(union([
70932
- string(),
70933
- number(),
70934
- boolean()
70935
- ])).min(1).max(RECORD_BATCH_MAX) }),
70936
- object({
70937
- gt: union([string(), number()]).optional(),
70938
- gte: union([string(), number()]).optional(),
70939
- lt: union([string(), number()]).optional(),
70940
- lte: union([string(), number()]).optional()
70941
- }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
70942
- ]));
70943
- var KindShape = { kind: RecordKindNameSchema };
70944
- var TimeWindowShape = {
70945
- deviceId: number().int().optional(),
70946
- atFrom: number().optional(),
70947
- atTo: number().optional()
70948
- };
70949
- var RecordQueryInputSchema = object({
70950
- ...KindShape,
70951
- ...TimeWindowShape,
70952
- where: RecordWhereSchema.optional(),
70953
- /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
70954
- order: _enum(["at", "id"]).optional(),
70955
- desc: boolean().optional(),
70956
- limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
70957
- /** Opaque keyset cursor from a previous answer. There is no offset. */
70958
- cursor: string().min(1).optional()
70959
- });
70960
- var RecordQueryResultSchema = object({
70961
- records: array(RecordViewSchema),
70962
- nextCursor: string().nullable()
70963
- });
70964
- var RecordKindStateSchema = _enum([
70965
- "created",
70966
- "unchanged",
70967
- "updated"
70968
- ]);
70969
- var DeclareKindResultSchema = object({
70970
- kindId: number().int(),
70971
- state: RecordKindStateSchema,
70972
- createdIndexes: array(string())
70973
- });
70974
- /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
70975
- var SecretRefsList = array(string());
70976
- /**
70977
- * One op of a `transact`: the single-row writes, each on a kind of the caller.
70978
- * All ops of one call share ONE database file and ONE `transactFamily`.
70979
- */
70980
- var RecordTransactOpSchema = discriminatedUnion("op", [
70981
- object({
70982
- op: literal("put"),
70983
- kind: RecordKindNameSchema,
70984
- record: RecordInputSchema,
70985
- ifRev: number().int().min(0).optional()
70986
- }),
70987
- object({
70988
- op: literal("patch"),
70989
- kind: RecordKindNameSchema,
70990
- id: RecordIdSchema,
70991
- data: RecordBodySchema,
70992
- at: number().int().nullable().optional(),
70993
- expiresAt: number().int().nullable().optional(),
70994
- ifRev: number().int().min(1).optional()
70995
- }),
70996
- object({
70997
- op: literal("delete"),
70998
- kind: RecordKindNameSchema,
70999
- id: RecordIdSchema
71000
- })
71001
- ]);
71002
- var RecordSecretRefsSchema = record(string(), record(string(), string()));
71003
- method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
71004
- kind: "mutation",
71005
- auth: "admin"
71006
- }), method(object({
71007
- ...KindShape,
71008
- id: RecordIdSchema
71009
- }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
71010
- ...KindShape,
71011
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
71012
- }), array(RecordViewSchema), { auth: "admin" }), method(object({
71013
- ...KindShape,
71014
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
71015
- }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
71016
- ...KindShape,
71017
- record: RecordInputSchema,
71018
- /** Compare-and-set. `0` means "the row must not exist". */
71019
- ifRev: number().int().min(0).optional()
71020
- }), object({
71021
- rev: number().int(),
71022
- releasedRefs: SecretRefsList
71023
- }), {
71024
- kind: "mutation",
71025
- auth: "admin"
71026
- }), method(object({
71027
- ...KindShape,
71028
- records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
71029
- }), object({
71030
- count: number().int(),
71031
- releasedRefs: SecretRefsList
71032
- }), {
71033
- kind: "mutation",
71034
- auth: "admin"
71035
- }), method(object({
71036
- ...KindShape,
71037
- id: RecordIdSchema,
71038
- data: RecordBodySchema,
71039
- at: number().int().nullable().optional(),
71040
- expiresAt: number().int().nullable().optional(),
71041
- ifRev: number().int().min(1).optional()
71042
- }), object({
71043
- rev: number().int(),
71044
- releasedRefs: SecretRefsList
71045
- }), {
71046
- kind: "mutation",
71047
- auth: "admin"
71048
- }), method(object({
71049
- ...KindShape,
71050
- id: RecordIdSchema
71051
- }), object({
71052
- deleted: boolean(),
71053
- secretRefs: SecretRefsList
71054
- }), {
71055
- kind: "mutation",
71056
- auth: "admin"
71057
- }), method(object({
71058
- ...KindShape,
71059
- ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
71060
- }), object({
71061
- deleted: number().int(),
71062
- secretRefs: SecretRefsList
71063
- }), {
71064
- kind: "mutation",
71065
- auth: "admin"
71066
- }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
71067
- ...KindShape,
71068
- ...TimeWindowShape,
71069
- where: RecordWhereSchema.optional()
71070
- }), object({ count: number().int() }), { auth: "admin" }), method(object({
71071
- ...KindShape,
71072
- deviceId: number().int().optional(),
71073
- from: number(),
71074
- to: number(),
71075
- bucketMs: number().int().positive()
71076
- }), object({ buckets: array(object({
71077
- bucketStart: number(),
71078
- count: number().int()
71079
- })) }), { auth: "admin" }), method(object({
71080
- ...KindShape,
71081
- op: _enum([
71082
- "sum",
71083
- "min",
71084
- "max",
71085
- "count"
71086
- ]),
71087
- field: RecordFieldPathSchema.optional(),
71088
- groupBy: RecordFieldPathSchema.optional(),
71089
- where: RecordWhereSchema.optional()
71090
- }), object({ rows: array(object({
71091
- group: union([
71092
- string(),
71093
- number(),
71094
- _null()
71095
- ]),
71096
- value: number().nullable()
71097
- })) }), { auth: "admin" }), method(object({
71098
- ...KindShape,
71099
- deviceId: number().int().optional(),
71100
- atBefore: number().optional(),
71101
- where: RecordWhereSchema.optional()
71102
- }), object({
71103
- deleted: number().int(),
71104
- secretRefs: SecretRefsList
71105
- }), {
71106
- kind: "mutation",
71107
- auth: "admin"
71108
- }), method(object({ ops: array(RecordTransactOpSchema).min(1).max(RECORD_BATCH_MAX) }), object({
71109
- results: array(object({
71110
- rev: number().int().nullable(),
71111
- deleted: boolean()
71112
- })),
71113
- releasedRefs: SecretRefsList,
71114
- secretRefs: SecretRefsList
71115
- }), {
71116
- kind: "mutation",
71117
- auth: "admin"
71118
- }), method(object({
71119
- deviceId: number().int(),
71120
- kinds: array(RecordKindNameSchema).optional()
71121
- }), object({
71122
- deleted: record(string(), number().int()),
71123
- secretRefs: SecretRefsList
71124
- }), {
71125
- kind: "mutation",
71126
- auth: "admin"
71127
- }), method(object(KindShape), object({ id: number().int() }), {
71128
- kind: "mutation",
71129
- auth: "admin"
71130
- });
71131
- /**
71132
71404
  * record-entries - the ONE admin surface for every list of user-created entries
71133
71405
  * (D881): notification targets, brokers, LLM profiles, anything an addon
71134
71406
  * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
@@ -76476,7 +76748,7 @@ var TrainingProviderTypeSchema = object({
76476
76748
  label: string(),
76477
76749
  /** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
76478
76750
  iconAsset: string(),
76479
- /** Owning `training-provider` addon — collection selector for createEntry. */
76751
+ /** Owning `training-provider` addon. */
76480
76752
  addonId: string(),
76481
76753
  /**
76482
76754
  * Fields for one entry of this type (credentials + defaults). Absent on a
@@ -76521,36 +76793,6 @@ var TrainingProviderDescriptorSchema = object({
76521
76793
  */
76522
76794
  formValues: record(string(), unknown()).optional()
76523
76795
  });
76524
- /**
76525
- * Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
76526
- * An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
76527
- * `{ $secretClear: true }` clears it.
76528
- */
76529
- var TrainingProviderUpdateEntryInputSchema = object({
76530
- entryId: string().min(1),
76531
- name: string().min(1),
76532
- tokenId: string().optional(),
76533
- tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
76534
- environment: string().optional(),
76535
- gpuType: string().optional(),
76536
- region: string().optional(),
76537
- costCapUsd: number().nonnegative().optional(),
76538
- maxRuntimeSec: number().int().positive().optional(),
76539
- failedDatasetGraceHours: number().nonnegative().optional()
76540
- });
76541
- var TrainingCredentialCheckSchema = object({
76542
- ok: boolean(),
76543
- /** Workspace / account name, when the provider says. */
76544
- account: string().optional(),
76545
- reason: _enum([
76546
- "missing",
76547
- "invalid",
76548
- "forbidden",
76549
- "network",
76550
- "quota"
76551
- ]).optional(),
76552
- detail: string().optional()
76553
- });
76554
76796
  var ProviderJobStateSchema = _enum([
76555
76797
  "pending",
76556
76798
  "starting",
@@ -76598,22 +76840,6 @@ var TrainingLogLineSchema = object({
76598
76840
  text: string()
76599
76841
  });
76600
76842
  method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
76601
- typeId: string().min(1),
76602
- name: string().min(1)
76603
- }), object({ entryId: string() }), {
76604
- kind: "mutation",
76605
- auth: "admin"
76606
- }), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
76607
- kind: "mutation",
76608
- auth: "admin"
76609
- }), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
76610
- kind: "mutation",
76611
- auth: "admin"
76612
- }), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
76613
- kind: "mutation",
76614
- auth: "admin",
76615
- timeoutMs: 3e4
76616
- }), method(object({
76617
76843
  entryId: string().min(1),
76618
76844
  gpuType: string(),
76619
76845
  region: string(),
@@ -79765,20 +79991,6 @@ Object.freeze({
79765
79991
  access: "create",
79766
79992
  role: "viewer"
79767
79993
  },
79768
- "broker.add": {
79769
- capName: "broker",
79770
- capScope: "system",
79771
- addonId: null,
79772
- access: "create",
79773
- role: "admin"
79774
- },
79775
- "broker.get": {
79776
- capName: "broker",
79777
- capScope: "system",
79778
- addonId: null,
79779
- access: "view",
79780
- role: "admin"
79781
- },
79782
79994
  "broker.getBrokerConfig": {
79783
79995
  capName: "broker",
79784
79996
  capScope: "system",
@@ -79786,20 +79998,6 @@ Object.freeze({
79786
79998
  access: "view",
79787
79999
  role: "admin"
79788
80000
  },
79789
- "broker.getSettings": {
79790
- capName: "broker",
79791
- capScope: "system",
79792
- addonId: null,
79793
- access: "view",
79794
- role: "admin"
79795
- },
79796
- "broker.getSettingsSchema": {
79797
- capName: "broker",
79798
- capScope: "system",
79799
- addonId: null,
79800
- access: "view",
79801
- role: "admin"
79802
- },
79803
80001
  "broker.getState": {
79804
80002
  capName: "broker",
79805
80003
  capScope: "system",
@@ -79814,20 +80012,6 @@ Object.freeze({
79814
80012
  access: "view",
79815
80013
  role: "admin"
79816
80014
  },
79817
- "broker.list": {
79818
- capName: "broker",
79819
- capScope: "system",
79820
- addonId: null,
79821
- access: "view",
79822
- role: "admin"
79823
- },
79824
- "broker.listProviders": {
79825
- capName: "broker",
79826
- capScope: "system",
79827
- addonId: null,
79828
- access: "view",
79829
- role: "admin"
79830
- },
79831
80015
  "broker.publish": {
79832
80016
  capName: "broker",
79833
80017
  capScope: "system",
@@ -79835,20 +80019,6 @@ Object.freeze({
79835
80019
  access: "create",
79836
80020
  role: "admin"
79837
80021
  },
79838
- "broker.remove": {
79839
- capName: "broker",
79840
- capScope: "system",
79841
- addonId: null,
79842
- access: "delete",
79843
- role: "admin"
79844
- },
79845
- "broker.setSettings": {
79846
- capName: "broker",
79847
- capScope: "system",
79848
- addonId: null,
79849
- access: "create",
79850
- role: "admin"
79851
- },
79852
80022
  "broker.subscribe": {
79853
80023
  capName: "broker",
79854
80024
  capScope: "system",
@@ -79856,20 +80026,6 @@ Object.freeze({
79856
80026
  access: "create",
79857
80027
  role: "admin"
79858
80028
  },
79859
- "broker.testConnection": {
79860
- capName: "broker",
79861
- capScope: "system",
79862
- addonId: null,
79863
- access: "create",
79864
- role: "admin"
79865
- },
79866
- "broker.testSettings": {
79867
- capName: "broker",
79868
- capScope: "system",
79869
- addonId: null,
79870
- access: "create",
79871
- role: "admin"
79872
- },
79873
80029
  "broker.unsubscribe": {
79874
80030
  capName: "broker",
79875
80031
  capScope: "system",
@@ -80129,20 +80285,6 @@ Object.freeze({
80129
80285
  access: "view",
80130
80286
  role: "admin"
80131
80287
  },
80132
- "connectionTest.describeTest": {
80133
- capName: "connection-test",
80134
- capScope: "system",
80135
- addonId: null,
80136
- access: "view",
80137
- role: "admin"
80138
- },
80139
- "connectionTest.testSettings": {
80140
- capName: "connection-test",
80141
- capScope: "system",
80142
- addonId: null,
80143
- access: "create",
80144
- role: "admin"
80145
- },
80146
80288
  "connectivity.getStatus": {
80147
80289
  capName: "connectivity",
80148
80290
  capScope: "device",
@@ -82509,13 +82651,6 @@ Object.freeze({
82509
82651
  access: "view",
82510
82652
  role: "admin"
82511
82653
  },
82512
- "integrations.testConnection": {
82513
- capName: "integrations",
82514
- capScope: "system",
82515
- addonId: null,
82516
- access: "create",
82517
- role: "admin"
82518
- },
82519
82654
  "integrations.update": {
82520
82655
  capName: "integrations",
82521
82656
  capScope: "system",
@@ -83748,13 +83883,6 @@ Object.freeze({
83748
83883
  access: "create",
83749
83884
  role: "admin"
83750
83885
  },
83751
- "mqttBroker.testConnection": {
83752
- capName: "mqtt-broker",
83753
- capScope: "system",
83754
- addonId: null,
83755
- access: "create",
83756
- role: "admin"
83757
- },
83758
83886
  "nativeObjectDetection.getOptions": {
83759
83887
  capName: "native-object-detection",
83760
83888
  capScope: "device",
@@ -84630,13 +84758,6 @@ Object.freeze({
84630
84758
  access: "view",
84631
84759
  role: "viewer"
84632
84760
  },
84633
- "petFountain.resetDailyConsumption": {
84634
- capName: "pet-fountain",
84635
- capScope: "device",
84636
- addonId: null,
84637
- access: "delete",
84638
- role: "viewer"
84639
- },
84640
84761
  "petFountain.setPump": {
84641
84762
  capName: "pet-fountain",
84642
84763
  capScope: "device",
@@ -84833,6 +84954,13 @@ Object.freeze({
84833
84954
  access: "view",
84834
84955
  role: "viewer"
84835
84956
  },
84957
+ "pipelineAnalytics.getMediaLocationCensus": {
84958
+ capName: "pipeline-analytics",
84959
+ capScope: "device",
84960
+ addonId: null,
84961
+ access: "view",
84962
+ role: "admin"
84963
+ },
84836
84964
  "pipelineAnalytics.getMediaReclaimStatus": {
84837
84965
  capName: "pipeline-analytics",
84838
84966
  capScope: "device",
@@ -88585,20 +88713,6 @@ Object.freeze({
88585
88713
  access: "create",
88586
88714
  role: "admin"
88587
88715
  },
88588
- "trainingProvider.createEntry": {
88589
- capName: "training-provider",
88590
- capScope: "system",
88591
- addonId: null,
88592
- access: "create",
88593
- role: "admin"
88594
- },
88595
- "trainingProvider.deleteEntry": {
88596
- capName: "training-provider",
88597
- capScope: "system",
88598
- addonId: null,
88599
- access: "delete",
88600
- role: "admin"
88601
- },
88602
88716
  "trainingProvider.describe": {
88603
88717
  capName: "training-provider",
88604
88718
  capScope: "system",
@@ -88669,13 +88783,6 @@ Object.freeze({
88669
88783
  access: "create",
88670
88784
  role: "admin"
88671
88785
  },
88672
- "trainingProvider.updateEntry": {
88673
- capName: "training-provider",
88674
- capScope: "system",
88675
- addonId: null,
88676
- access: "create",
88677
- role: "admin"
88678
- },
88679
88786
  "trainingProvider.uploadDataset": {
88680
88787
  capName: "training-provider",
88681
88788
  capScope: "system",
@@ -88683,13 +88790,6 @@ Object.freeze({
88683
88790
  access: "create",
88684
88791
  role: "admin"
88685
88792
  },
88686
- "trainingProvider.validateCredentials": {
88687
- capName: "training-provider",
88688
- capScope: "system",
88689
- addonId: null,
88690
- access: "create",
88691
- role: "admin"
88692
- },
88693
88793
  "turnProvider.getTurnServers": {
88694
88794
  capName: "turn-provider",
88695
88795
  capScope: "system",
@@ -91054,11 +91154,6 @@ Object.freeze({
91054
91154
  form: "single",
91055
91155
  optional: false
91056
91156
  }],
91057
- "petFountain.resetDailyConsumption": [{
91058
- name: "deviceId",
91059
- form: "single",
91060
- optional: false
91061
- }],
91062
91157
  "petFountain.setPump": [{
91063
91158
  name: "deviceId",
91064
91159
  form: "single",