@camstack/addon-notifiers 1.2.135 → 1.2.602

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.mjs CHANGED
@@ -2,7 +2,7 @@ import { brotliCompressSync, deflateSync, gzipSync } from "node:zlib";
2
2
  import { readFileSync } from "node:fs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
- //#region ../types/dist/event-category-C4hVnRo8.mjs
5
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
6
6
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
7
7
  EventCategory["SystemBoot"] = "system.boot";
8
8
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -66,6 +66,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
66
66
  * consumes this category and maps it to the `addon-crash-loop` kind.
67
67
  */
68
68
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
69
+ /**
70
+ * A runner whose addon refused to start with a typed reason (D877) - parked
71
+ * in `refused`, never counted by the crash breaker, retried on operator
72
+ * action. One event per refusal.
73
+ */
74
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
75
+ /**
76
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
77
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
78
+ * runner is still pending) and the alert centre (close a recovered runner).
79
+ */
80
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
81
+ /**
82
+ * The node's one-shot runner boot check (D877): planned runners against the
83
+ * process service, `degraded` when any is failed, refused or missing. The
84
+ * alert centre turns it into one alert and a direct critical push.
85
+ */
86
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
69
87
  EventCategory["AddonError"] = "addon.error";
70
88
  EventCategory["AddonPageReady"] = "addon.page-ready";
71
89
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -4108,6 +4126,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4108
4126
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4109
4127
  json.type = "boolean";
4110
4128
  };
4129
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4130
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4131
+ };
4132
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4133
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4134
+ };
4111
4135
  var nullProcessor = (_schema, ctx, json, _params) => {
4112
4136
  if (ctx.target === "openapi-3.0") {
4113
4137
  json.type = "string";
@@ -4115,12 +4139,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4115
4139
  json.enum = [null];
4116
4140
  } else json.type = "null";
4117
4141
  };
4142
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4143
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4144
+ };
4118
4145
  var voidProcessor = (_schema, ctx, _json, _params) => {
4119
4146
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4120
4147
  };
4121
4148
  var neverProcessor = (_schema, _ctx, json, _params) => {
4122
4149
  json.not = {};
4123
4150
  };
4151
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4152
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4124
4153
  var dateProcessor = (_schema, ctx, _json, _params) => {
4125
4154
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4126
4155
  };
@@ -4152,12 +4181,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4152
4181
  json.enum = vals;
4153
4182
  }
4154
4183
  };
4184
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4185
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4186
+ };
4187
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4188
+ const _json = json;
4189
+ const pattern = schema._zod.pattern;
4190
+ if (!pattern) throw new Error("Pattern not found in template literal");
4191
+ _json.type = "string";
4192
+ _json.pattern = pattern.source;
4193
+ };
4194
+ var fileProcessor = (schema, _ctx, json, _params) => {
4195
+ const _json = json;
4196
+ const file = {
4197
+ type: "string",
4198
+ format: "binary",
4199
+ contentEncoding: "binary"
4200
+ };
4201
+ const { minimum, maximum, mime } = schema._zod.bag;
4202
+ if (minimum !== void 0) file.minLength = minimum;
4203
+ if (maximum !== void 0) file.maxLength = maximum;
4204
+ if (mime) if (mime.length === 1) {
4205
+ file.contentMediaType = mime[0];
4206
+ Object.assign(_json, file);
4207
+ } else {
4208
+ Object.assign(_json, file);
4209
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4210
+ }
4211
+ else Object.assign(_json, file);
4212
+ };
4213
+ var successProcessor = (_schema, _ctx, json, _params) => {
4214
+ json.type = "boolean";
4215
+ };
4155
4216
  var customProcessor = (_schema, ctx, _json, _params) => {
4156
4217
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4157
4218
  };
4219
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4220
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4221
+ };
4158
4222
  var transformProcessor = (_schema, ctx, _json, _params) => {
4159
4223
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4160
4224
  };
4225
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4226
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4227
+ };
4228
+ var setProcessor = (_schema, ctx, _json, _params) => {
4229
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4230
+ };
4161
4231
  var arrayProcessor = (schema, ctx, _json, params) => {
4162
4232
  const json = _json;
4163
4233
  const def = schema._zod.def;
@@ -4362,6 +4432,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4362
4432
  seen.ref = def.innerType;
4363
4433
  json.readOnly = true;
4364
4434
  };
4435
+ var promiseProcessor = (schema, ctx, _json, params) => {
4436
+ const def = schema._zod.def;
4437
+ process(def.innerType, ctx, params);
4438
+ const seen = ctx.seen.get(schema);
4439
+ seen.ref = def.innerType;
4440
+ };
4365
4441
  var optionalProcessor = (schema, ctx, _json, params) => {
4366
4442
  const def = schema._zod.def;
4367
4443
  process(def.innerType, ctx, params);
@@ -4374,6 +4450,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4374
4450
  const seen = ctx.seen.get(schema);
4375
4451
  seen.ref = innerType;
4376
4452
  };
4453
+ var allProcessors = {
4454
+ string: stringProcessor,
4455
+ number: numberProcessor,
4456
+ boolean: booleanProcessor,
4457
+ bigint: bigintProcessor,
4458
+ symbol: symbolProcessor,
4459
+ null: nullProcessor,
4460
+ undefined: undefinedProcessor,
4461
+ void: voidProcessor,
4462
+ never: neverProcessor,
4463
+ any: anyProcessor,
4464
+ unknown: unknownProcessor,
4465
+ date: dateProcessor,
4466
+ enum: enumProcessor,
4467
+ literal: literalProcessor,
4468
+ nan: nanProcessor,
4469
+ template_literal: templateLiteralProcessor,
4470
+ file: fileProcessor,
4471
+ success: successProcessor,
4472
+ custom: customProcessor,
4473
+ function: functionProcessor,
4474
+ transform: transformProcessor,
4475
+ map: mapProcessor,
4476
+ set: setProcessor,
4477
+ array: arrayProcessor,
4478
+ object: objectProcessor,
4479
+ union: unionProcessor,
4480
+ intersection: intersectionProcessor,
4481
+ tuple: tupleProcessor,
4482
+ record: recordProcessor,
4483
+ nullable: nullableProcessor,
4484
+ nonoptional: nonoptionalProcessor,
4485
+ default: defaultProcessor,
4486
+ prefault: prefaultProcessor,
4487
+ catch: catchProcessor,
4488
+ pipe: pipeProcessor,
4489
+ readonly: readonlyProcessor,
4490
+ promise: promiseProcessor,
4491
+ optional: optionalProcessor,
4492
+ lazy: lazyProcessor
4493
+ };
4494
+ function toJSONSchema(input, params) {
4495
+ if ("_idmap" in input) {
4496
+ const registry = input;
4497
+ const ctx = initializeContext({
4498
+ ...params,
4499
+ processors: allProcessors
4500
+ });
4501
+ const defs = {};
4502
+ for (const entry of registry._idmap.entries()) {
4503
+ const [_, schema] = entry;
4504
+ process(schema, ctx);
4505
+ }
4506
+ const schemas = {};
4507
+ ctx.external = {
4508
+ registry,
4509
+ uri: params?.uri,
4510
+ defs
4511
+ };
4512
+ for (const entry of registry._idmap.entries()) {
4513
+ const [key, schema] = entry;
4514
+ extractDefs(ctx, schema);
4515
+ schemas[key] = finalize(ctx, schema);
4516
+ }
4517
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4518
+ return { schemas };
4519
+ }
4520
+ const ctx = initializeContext({
4521
+ ...params,
4522
+ processors: allProcessors
4523
+ });
4524
+ process(input, ctx);
4525
+ extractDefs(ctx, input);
4526
+ return finalize(ctx, input);
4527
+ }
4377
4528
  //#endregion
4378
4529
  //#region ../../node_modules/zod/v4/classic/iso.js
4379
4530
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5390,7 +5541,7 @@ var ZodIssueCode = {
5390
5541
  var ZodFirstPartyTypeKind;
5391
5542
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5392
5543
  //#endregion
5393
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5544
+ //#region ../types/dist/sleep-BegKjwUu.mjs
5394
5545
  /**
5395
5546
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5396
5547
  * window to float samples (D455).
@@ -5507,7 +5658,7 @@ function isKeychainStoredField(field) {
5507
5658
  var SECRET_CLEAR = { $secretClear: true };
5508
5659
  /** The `'***'` token D634 redaction writes for non-admins. */
5509
5660
  var LEGACY_DEVICE_REDACTION = "***";
5510
- function isRecord$2(value) {
5661
+ function isRecord$5(value) {
5511
5662
  return typeof value === "object" && value !== null && !Array.isArray(value);
5512
5663
  }
5513
5664
  function makeSecretMarker(ref) {
@@ -5518,12 +5669,12 @@ function makeSecretMarker(ref) {
5518
5669
  }
5519
5670
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5520
5671
  function isSecretMarker(value) {
5521
- if (!isRecord$2(value)) return false;
5672
+ if (!isRecord$5(value)) return false;
5522
5673
  const ref = value["$secret"];
5523
5674
  return typeof ref === "string" && ref.length > 0;
5524
5675
  }
5525
5676
  function isSecretClear(value) {
5526
- return isRecord$2(value) && value["$secretClear"] === true;
5677
+ return isRecord$5(value) && value["$secretClear"] === true;
5527
5678
  }
5528
5679
  /**
5529
5680
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6133,7 +6284,7 @@ var KeychainWriteRefusedError = class extends Error {
6133
6284
  }
6134
6285
  };
6135
6286
  var KEEP = { kind: "keep" };
6136
- function isRecord$1(value) {
6287
+ function isRecord$4(value) {
6137
6288
  return typeof value === "object" && value !== null && !Array.isArray(value);
6138
6289
  }
6139
6290
  function defaultMintId() {
@@ -6146,7 +6297,7 @@ function collectSecretMarkerRefs(value, out = []) {
6146
6297
  return out;
6147
6298
  }
6148
6299
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6149
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6300
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6150
6301
  return out;
6151
6302
  }
6152
6303
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6201,7 +6352,7 @@ function rowId(row, idKey) {
6201
6352
  return null;
6202
6353
  }
6203
6354
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6204
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6355
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6205
6356
  if (!Array.isArray(incoming)) {
6206
6357
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6207
6358
  return {
@@ -6217,7 +6368,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6217
6368
  const kept = /* @__PURE__ */ new Set();
6218
6369
  const rows = [];
6219
6370
  for (const row of incoming) {
6220
- if (!isRecord$1(row)) {
6371
+ if (!isRecord$4(row)) {
6221
6372
  rows.push(row);
6222
6373
  continue;
6223
6374
  }
@@ -6242,7 +6393,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6242
6393
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6243
6394
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6244
6395
  case "object": {
6245
- if (!isRecord$1(incoming)) {
6396
+ if (!isRecord$4(incoming)) {
6246
6397
  if (incoming === void 0) return KEEP;
6247
6398
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6248
6399
  return {
@@ -6250,7 +6401,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6250
6401
  value: incoming
6251
6402
  };
6252
6403
  }
6253
- const storedObj = isRecord$1(stored) ? stored : {};
6404
+ const storedObj = isRecord$4(stored) ? stored : {};
6254
6405
  return {
6255
6406
  kind: "value",
6256
6407
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6373,7 +6524,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6373
6524
  value: items
6374
6525
  };
6375
6526
  }
6376
- if (isRecord$1(v)) {
6527
+ if (isRecord$4(v)) {
6377
6528
  const out = {};
6378
6529
  for (const [k, child] of Object.entries(v)) {
6379
6530
  const s = substitute(child);
@@ -6641,7 +6792,6 @@ function createHandle(raw, opts) {
6641
6792
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6642
6793
  const readAddonStoreResult = raw.readAddonStoreResult;
6643
6794
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6644
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6645
6795
  const overrides = {
6646
6796
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6647
6797
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6665,12 +6815,12 @@ function createHandle(raw, opts) {
6665
6815
  };
6666
6816
  } } : {},
6667
6817
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6668
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6669
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6818
+ readDeviceStoreBatch: async (deviceIds) => {
6819
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6670
6820
  const out = /* @__PURE__ */ new Map();
6671
6821
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6672
6822
  return out;
6673
- } } : {},
6823
+ },
6674
6824
  writeAddonStore: async (patch) => {
6675
6825
  await writeAddon(patch);
6676
6826
  },
@@ -7297,7 +7447,7 @@ var BaseAddon = class {
7297
7447
  if (!ctx) return;
7298
7448
  const addonId = ctx.id;
7299
7449
  setImmediate(() => {
7300
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7450
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7301
7451
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7302
7452
  }).catch((err) => {
7303
7453
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7497,7 +7647,7 @@ var BaseAddon = class {
7497
7647
  return this._addonSecretTree;
7498
7648
  }
7499
7649
  deviceSecretTree() {
7500
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7650
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7501
7651
  return this._deviceSecretTree;
7502
7652
  }
7503
7653
  /**
@@ -7573,42 +7723,135 @@ var BaseAddon = class {
7573
7723
  this[timerOf] = timer;
7574
7724
  }
7575
7725
  /**
7576
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7577
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7578
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7579
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7726
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7727
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7580
7728
  * addon permanently broken.
7581
7729
  *
7582
- * Retry only the two known infra fingerprints. Anything else propagates so
7583
- * real bugs surface immediately. After the budget expires we fall back to
7584
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7730
+ * Two kinds of outage, two budgets:
7731
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7732
+ * initialized`, `provider not available`): a short budget, then the addon
7733
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7734
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7735
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7736
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7737
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7738
+ * loop. A long, bounded budget; only after it the error propagates - the
7739
+ * addon never runs on defaults for a store it could not ask.
7740
+ * Anything else propagates immediately so real bugs surface.
7585
7741
  */
7586
7742
  async readAddonStoreWithRetry() {
7587
7743
  const settings = this.rawSettings();
7588
7744
  if (!settings) return {};
7589
- const delaysMs = [
7590
- 150,
7591
- 350,
7592
- 600,
7593
- 900
7594
- ];
7595
7745
  let lastErr;
7596
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7746
+ for (let attempt = 0;; attempt++) try {
7597
7747
  const stored = await settings.readAddonStore() ?? {};
7598
7748
  this.settingsStoreReady = true;
7599
7749
  return stored;
7600
7750
  } catch (err) {
7601
7751
  lastErr = err;
7602
- const msg = err instanceof Error ? err.message : String(err);
7603
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7604
- if (attempt === delaysMs.length) break;
7605
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7752
+ const kind = classifyStoreError(err);
7753
+ if (kind === "permanent") throw err;
7754
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7755
+ if (delay === void 0) {
7756
+ if (kind === "transport") throw err;
7757
+ break;
7758
+ }
7759
+ await new Promise((r) => setTimeout(r, delay));
7606
7760
  }
7607
7761
  this.settingsStoreReady = false;
7608
7762
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7609
7763
  return {};
7610
7764
  }
7611
7765
  };
7766
+ /** The settings store's own restart fingerprints. */
7767
+ var RESTART_RETRY_DELAYS_MS = [
7768
+ 150,
7769
+ 350,
7770
+ 600,
7771
+ 900
7772
+ ];
7773
+ /** A hub restarting under a booting runner: ~100 s in total. */
7774
+ var TRANSPORT_RETRY_DELAYS_MS = [
7775
+ 150,
7776
+ 350,
7777
+ 600,
7778
+ 900,
7779
+ 2e3,
7780
+ 5e3,
7781
+ 1e4,
7782
+ 2e4,
7783
+ 3e4,
7784
+ 3e4
7785
+ ];
7786
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7787
+ /** Node / socket error codes of a connection that did not happen or broke. */
7788
+ var TRANSPORT_CODES = new Set([
7789
+ "ECONNREFUSED",
7790
+ "ECONNRESET",
7791
+ "ETIMEDOUT",
7792
+ "EPIPE",
7793
+ "EHOSTUNREACH",
7794
+ "ENETUNREACH"
7795
+ ]);
7796
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7797
+ var UNAVAILABLE_TRPC_CODES = new Set([
7798
+ "TIMEOUT",
7799
+ "SERVICE_UNAVAILABLE",
7800
+ "BAD_GATEWAY",
7801
+ "GATEWAY_TIMEOUT"
7802
+ ]);
7803
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7804
+ var TRANSPORT_PHRASES = [
7805
+ "discovery deadline exceeded",
7806
+ "parent could not route child unowned cap call",
7807
+ "UDS request timed out after",
7808
+ "channel closed"
7809
+ ];
7810
+ /** Moleculer error `type`s of a call that could not be served right now. */
7811
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7812
+ "REQUEST_TIMEOUT",
7813
+ "SERVICE_NOT_FOUND",
7814
+ "SERVICE_NOT_AVAILABLE",
7815
+ "REQUEST_REJECTED",
7816
+ "BROKER_DISCONNECTED"
7817
+ ]);
7818
+ function stringProp(value, key) {
7819
+ if (typeof value !== "object" || value === null) return void 0;
7820
+ const found = Reflect.get(value, key);
7821
+ return typeof found === "string" ? found : void 0;
7822
+ }
7823
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7824
+ function errorCode(err) {
7825
+ const out = {};
7826
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7827
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7828
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7829
+ if (node !== void 0) out.node = node;
7830
+ const trpc = stringProp(data, "code");
7831
+ if (trpc !== void 0) out.trpc = trpc;
7832
+ return out;
7833
+ }
7834
+ /**
7835
+ * Is a settings read failure worth retrying, and with which budget? Only
7836
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7837
+ * one of the exact phrases our own transport raises. A message that merely
7838
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7839
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7840
+ */
7841
+ function classifyStoreError(err) {
7842
+ const message = err instanceof Error ? err.message : String(err);
7843
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7844
+ const code = errorCode(err);
7845
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7846
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7847
+ if (typeof err === "object" && err !== null) {
7848
+ if (Reflect.get(err, "retryable") === true) return "transport";
7849
+ const type = stringProp(err, "type");
7850
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7851
+ }
7852
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7853
+ return "permanent";
7854
+ }
7612
7855
  /**
7613
7856
  * Collect the keys of every field marked `perNode: true`, recursing into
7614
7857
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7698,6 +7941,303 @@ var PeerBytesTicketSchema = object({
7698
7941
  */
7699
7942
  declaredBytes: number().int().nonnegative().nullable()
7700
7943
  });
7944
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7945
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7946
+ var RECORD_DATABASES = ["settings", "events"];
7947
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7948
+ var RECORD_CLASSES = [
7949
+ "config",
7950
+ "ledger",
7951
+ "audit",
7952
+ "mirror",
7953
+ "ephemeral"
7954
+ ];
7955
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7956
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7957
+ var RECORD_BATCH_MAX = 1e3;
7958
+ var RECORD_QUERY_MAX = 1e3;
7959
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
7960
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
7961
+ var PREFIX = "records/";
7962
+ /** The base of every records failure. `detail` is the human part of the message. */
7963
+ var RecordsError = class extends Error {
7964
+ code;
7965
+ detail;
7966
+ constructor(code, detail) {
7967
+ super(`${PREFIX}${code}: ${detail}`);
7968
+ this.name = "RecordsError";
7969
+ this.code = code;
7970
+ this.detail = detail;
7971
+ }
7972
+ };
7973
+ var InvalidRecordError = class extends RecordsError {
7974
+ constructor(detail) {
7975
+ super("invalid-record", detail);
7976
+ this.name = "InvalidRecordError";
7977
+ }
7978
+ };
7979
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
7980
+ var DeclarationRefusedError = class extends RecordsError {
7981
+ constructor(detail) {
7982
+ super("declaration-refused", detail);
7983
+ this.name = "DeclarationRefusedError";
7984
+ }
7985
+ };
7986
+ function defOf(schema) {
7987
+ const zodBag = Reflect.get(schema, "_zod");
7988
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7989
+ const def = Reflect.get(zodBag, "def");
7990
+ if (typeof def !== "object" || def === null) return {};
7991
+ return def;
7992
+ }
7993
+ function declaredHere(schema) {
7994
+ return globalRegistry.get(schema)?.secret === true;
7995
+ }
7996
+ /** Wrapper kinds whose `innerType` is the field itself. */
7997
+ var WRAPPERS = new Set([
7998
+ "optional",
7999
+ "nullable",
8000
+ "default",
8001
+ "prefault",
8002
+ "catch",
8003
+ "readonly",
8004
+ "nonoptional"
8005
+ ]);
8006
+ /**
8007
+ * The schema layers that make up ONE field: the schema itself and every
8008
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8009
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8010
+ * `.transform` on `in`).
8011
+ */
8012
+ function layersOf(schema) {
8013
+ const out = [];
8014
+ const queue = [schema];
8015
+ while (queue.length > 0) {
8016
+ const s = queue.shift();
8017
+ if (!s || out.includes(s)) continue;
8018
+ out.push(s);
8019
+ const def = defOf(s);
8020
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8021
+ if (def.type === "pipe") {
8022
+ if (def.in) queue.push(def.in);
8023
+ if (def.out) queue.push(def.out);
8024
+ }
8025
+ }
8026
+ return out;
8027
+ }
8028
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8029
+ function isZodSecret(schema) {
8030
+ return layersOf(schema).some(declaredHere);
8031
+ }
8032
+ /**
8033
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8034
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8035
+ * object or array is reported as one path and not descended into — everything
8036
+ * under it is secret.
8037
+ */
8038
+ function collectZodSecretPaths(schema, prefix = "") {
8039
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8040
+ const paths = [];
8041
+ for (const layer of layersOf(schema)) {
8042
+ const def = defOf(layer);
8043
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8044
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8045
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8046
+ else if (def.type === "intersection") {
8047
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8048
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8049
+ }
8050
+ }
8051
+ return [...new Set(paths)];
8052
+ }
8053
+ /**
8054
+ * Secret fields of a record, addressed the way a Zod schema declares them
8055
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8056
+ * (`auth.accessToken`, `headers[].value`).
8057
+ *
8058
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8059
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8060
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8061
+ * leaf names its element: `headers[X-Api].value`.
8062
+ *
8063
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8064
+ */
8065
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8066
+ function parseSecretPath(path) {
8067
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8068
+ return path.split(".").map((raw) => {
8069
+ const each = raw.endsWith("[]");
8070
+ const key = each ? raw.slice(0, -2) : raw;
8071
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8072
+ return {
8073
+ key,
8074
+ each
8075
+ };
8076
+ });
8077
+ }
8078
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8079
+ function secretArrayPrefixes(path) {
8080
+ const segments = parseSecretPath(path);
8081
+ const prefixes = [];
8082
+ const walked = [];
8083
+ for (const segment of segments) {
8084
+ walked.push(segment.key);
8085
+ if (segment.each) prefixes.push(walked.join("."));
8086
+ }
8087
+ return prefixes;
8088
+ }
8089
+ /**
8090
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8091
+ * Zod row schema that describes it, and the helper that turns the two into the
8092
+ * JSON the engine stores.
8093
+ *
8094
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8095
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8096
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
8097
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
8098
+ * never a field name (D879).
8099
+ */
8100
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
8101
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
8102
+ var RecordIndexSchema = object({
8103
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
8104
+ fields: array(RecordFieldPathSchema).min(1).max(4),
8105
+ unique: boolean().optional()
8106
+ }).strict();
8107
+ var RecordRetentionSchema = union([
8108
+ object({
8109
+ ttlMs: number().int().positive(),
8110
+ from: _enum(["at", "write"])
8111
+ }).strict(),
8112
+ object({
8113
+ maxRows: number().int().positive().optional(),
8114
+ maxRowsPerDevice: number().int().positive().optional()
8115
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
8116
+ object({
8117
+ owner: string().min(1),
8118
+ reason: string().min(1)
8119
+ }).strict(),
8120
+ object({ none: string().min(1) }).strict()
8121
+ ]);
8122
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
8123
+ var EntryDescriptorSchema = object({
8124
+ title: string().min(1),
8125
+ /** The record body field shown as the entry's name. */
8126
+ nameField: string().min(1),
8127
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
8128
+ fields: record(string(), unknown())
8129
+ }).strict();
8130
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
8131
+ var RecordKindDeclarationSchema = object({
8132
+ database: _enum(RECORD_DATABASES).default("settings"),
8133
+ class: _enum(RECORD_CLASSES),
8134
+ writeTrigger: string().min(1),
8135
+ device: _enum([
8136
+ "required",
8137
+ "optional",
8138
+ "none"
8139
+ ]).default("none"),
8140
+ at: _enum(["required", "none"]).default("none"),
8141
+ indexes: array(RecordIndexSchema).max(8).default([]),
8142
+ retention: RecordRetentionSchema,
8143
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
8144
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
8145
+ /** Derived from the Zod schema; never written by hand. */
8146
+ secretPaths: array(string().min(1)).default([]),
8147
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
8148
+ secretArrayKeys: record(string(), string()).default({}),
8149
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
8150
+ adoptsFrom: string().min(1).optional(),
8151
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
8152
+ transactFamily: string().min(1).optional(),
8153
+ entry: EntryDescriptorSchema.optional()
8154
+ }).strict();
8155
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8156
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8157
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8158
+ function assertValidDeclaration(name, decl) {
8159
+ const refuse = (why) => {
8160
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8161
+ };
8162
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8163
+ const seen = /* @__PURE__ */ new Set();
8164
+ for (const index of decl.indexes) {
8165
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8166
+ seen.add(index.name);
8167
+ }
8168
+ const { retention } = decl;
8169
+ const hasSecrets = decl.secretPaths.length > 0;
8170
+ if ("ttlMs" in retention) {
8171
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8172
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8173
+ }
8174
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8175
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8176
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8177
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8178
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8179
+ if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
8180
+ }
8181
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8182
+ for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
8183
+ }
8184
+ function bodyFieldsOf(schema) {
8185
+ return { ...toJSONSchema(schema, {
8186
+ unrepresentable: "any",
8187
+ io: "input"
8188
+ }) };
8189
+ }
8190
+ function isRecordLike(value) {
8191
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8192
+ }
8193
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8194
+ function hasNameField(json, field) {
8195
+ const branches = json["oneOf"] ?? json["anyOf"];
8196
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8197
+ const properties = json["properties"];
8198
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8199
+ }
8200
+ /**
8201
+ * Declare the kinds of a package. The keys are the kind names. The result is
8202
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8203
+ * types its handle from.
8204
+ */
8205
+ function defineRecordKinds(specs) {
8206
+ const out = {};
8207
+ for (const [name, spec] of Object.entries(specs)) {
8208
+ const secretPaths = collectZodSecretPaths(spec.schema);
8209
+ const nameField = spec.entry?.nameField ?? "name";
8210
+ const fields = bodyFieldsOf(spec.schema);
8211
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8212
+ const parsed = RecordKindDeclarationSchema.parse({
8213
+ database: spec.database,
8214
+ class: spec.class,
8215
+ writeTrigger: spec.writeTrigger,
8216
+ device: spec.device,
8217
+ at: spec.at,
8218
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8219
+ retention: spec.retention,
8220
+ deviceRemoval: spec.deviceRemoval,
8221
+ maxDataBytes: spec.maxDataBytes,
8222
+ secretPaths: [...secretPaths],
8223
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8224
+ adoptsFrom: spec.adoptsFrom,
8225
+ transactFamily: spec.transactFamily,
8226
+ entry: spec.entry === void 0 ? void 0 : {
8227
+ title: spec.entry.title,
8228
+ nameField,
8229
+ fields
8230
+ }
8231
+ });
8232
+ assertValidDeclaration(name, parsed);
8233
+ out[name] = {
8234
+ name,
8235
+ schema: spec.schema,
8236
+ declaration: parsed
8237
+ };
8238
+ }
8239
+ return out;
8240
+ }
7701
8241
  /** Shared Zod schemas used across streaming capabilities. */
7702
8242
  var CamProfileSchema = _enum([
7703
8243
  "high",
@@ -8199,7 +8739,7 @@ function userError(code, params, englishFallback) {
8199
8739
  return new CamstackError(code, params, englishFallback);
8200
8740
  }
8201
8741
  //#endregion
8202
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8742
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8203
8743
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8204
8744
  DeviceType["Camera"] = "camera";
8205
8745
  DeviceType["Hub"] = "hub";
@@ -8291,6 +8831,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8291
8831
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8292
8832
  * integrations sharing the same food/desiccant/hopper surface. */
8293
8833
  DeviceType["PetFeeder"] = "pet-feeder";
8834
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8835
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8836
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8837
+ DeviceType["Dishwasher"] = "dishwasher";
8294
8838
  return DeviceType;
8295
8839
  }({});
8296
8840
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8468,6 +9012,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8468
9012
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8469
9013
  * real Switch device for UI rendering / export adapters. */
8470
9014
  DeviceRole["BinaryHelper"] = "binary-helper";
9015
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
9016
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
9017
+ DeviceRole["Outlet"] = "outlet";
8471
9018
  /** Generic motion / occupancy / moving event source. Distinct from
8472
9019
  * the camera accessory PirSensor role: that one is a camera child;
8473
9020
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8535,7 +9082,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8535
9082
  return DeviceRole;
8536
9083
  }({});
8537
9084
  //#endregion
8538
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
9085
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8539
9086
  /**
8540
9087
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8541
9088
  *
@@ -11856,11 +12403,10 @@ var ClipModelMetaSchema = object({
11856
12403
  /**
11857
12404
  * The `vector-store` index this model's vectors live in. ONE feature space
11858
12405
  * per index: two models share an index only when their vectors are ranked
11859
- * against each other, which for CLIP means never across families. MobileCLIP
11860
- * S1 and S2 share `object-clip` for history (separated by the row's
11861
- * `modelId`); any other model gets its own.
12406
+ * against each other, which for CLIP means never across families. Every
12407
+ * model gets its own.
11862
12408
  */
11863
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12409
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11864
12410
  /**
11865
12411
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11866
12412
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -13058,8 +13604,13 @@ var AlertSeveritySchema = _enum([
13058
13604
  "info",
13059
13605
  "success",
13060
13606
  "warning",
13061
- "error"
13607
+ "error",
13608
+ "critical"
13062
13609
  ]);
13610
+ var AlertActionSchema = object({
13611
+ label: string(),
13612
+ href: string().optional()
13613
+ });
13063
13614
  var AlertStatusSchema = _enum([
13064
13615
  "active",
13065
13616
  "in-progress",
@@ -13077,6 +13628,7 @@ var AlertSchema = object({
13077
13628
  severity: AlertSeveritySchema,
13078
13629
  title: string(),
13079
13630
  message: string(),
13631
+ action: AlertActionSchema.optional(),
13080
13632
  status: AlertStatusSchema,
13081
13633
  progress: number().optional(),
13082
13634
  read: boolean(),
@@ -15506,6 +16058,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15506
16058
  keyField: string()
15507
16059
  }).optional()
15508
16060
  })) });
16061
+ /**
16062
+ * The report of a one-shot "move this owner's plaintext secrets into the
16063
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16064
+ *
16065
+ * The owner runs it on its own rows, through its own write path; an operator
16066
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16067
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16068
+ */
16069
+ var RawSecretMigrationInputSchema = object({
16070
+ /** `false` (the default of the script) = report only. */
16071
+ apply: boolean() });
16072
+ var RawSecretMigrationReportSchema = object({
16073
+ apply: boolean(),
16074
+ /** Rows that can carry a secret (a profile, an enrolment). */
16075
+ rows: number().int(),
16076
+ /** Rows whose secret was plaintext when the run started. */
16077
+ raw: number().int(),
16078
+ /** Rows that already held a keychain marker when the run started. */
16079
+ markers: number().int(),
16080
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16081
+ migrated: number().int(),
16082
+ /** Plaintext rows left in place because the move or its read-back failed. */
16083
+ failed: number().int(),
16084
+ /** After the run: rows still holding plaintext. */
16085
+ remainingRaw: number().int(),
16086
+ /** After the run: markers the keychain could not resolve right now. */
16087
+ unresolvedMarkers: number().int(),
16088
+ /**
16089
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16090
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16091
+ */
16092
+ redundantCopies: number().int().optional(),
16093
+ /** True when nothing is raw and every marker resolves. */
16094
+ verified: boolean()
16095
+ });
15509
16096
  /** Where a block runs. The operator chooses — a block driving a device on an
15510
16097
  * agent is the reason placement is not fixed to the hub. */
15511
16098
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15732,6 +16319,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15732
16319
  }), SettingsUpdateResultSchema, {
15733
16320
  kind: "mutation",
15734
16321
  auth: "admin"
16322
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16323
+ kind: "mutation",
16324
+ auth: "admin"
15735
16325
  }), method(object({}), object({ libs: array(object({
15736
16326
  filePath: string(),
15737
16327
  content: string()
@@ -15995,6 +16585,347 @@ id: union([string(), number()]) }), {
15995
16585
  auth: "admin"
15996
16586
  });
15997
16587
  /**
16588
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16589
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16590
+ * (operator intent, D870) and device-history (numbers over time, D850).
16591
+ *
16592
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16593
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16594
+ * that with the addon id closed over). It is deliberately NOT in any input
16595
+ * schema, so a session can never supply it, and a call with no stamp is refused
16596
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16597
+ * addons go through the owner's capability.
16598
+ *
16599
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16600
+ * never `[]`. Secret fields are never on the wire: a read shows the
16601
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16602
+ * resolves itself, and a write may carry only a keychain marker bound to the
16603
+ * row's own ref.
16604
+ *
16605
+ * Internal: addons reach it through `ctx.records`, never directly.
16606
+ */
16607
+ var RecordIdSchema = string().min(1).max(256);
16608
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16609
+ var RecordBodySchema = record(string(), unknown());
16610
+ var RecordInputSchema = object({
16611
+ id: RecordIdSchema,
16612
+ /** The device this row belongs to (D865 removal, per-device reads). */
16613
+ deviceId: number().int().optional(),
16614
+ /** The domain clock, ms: observed / created / opened. */
16615
+ at: number().int().optional(),
16616
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16617
+ expiresAt: number().int().optional(),
16618
+ data: RecordBodySchema
16619
+ });
16620
+ var RecordViewSchema = object({
16621
+ id: string(),
16622
+ deviceId: number().int().nullable(),
16623
+ at: number().nullable(),
16624
+ expiresAt: number().nullable(),
16625
+ rev: number().int(),
16626
+ updatedAt: number(),
16627
+ data: RecordBodySchema
16628
+ });
16629
+ /** Declared index fields only. Anything else does not compile, by design. */
16630
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16631
+ string(),
16632
+ number(),
16633
+ boolean(),
16634
+ object({ in: array(union([
16635
+ string(),
16636
+ number(),
16637
+ boolean()
16638
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16639
+ object({
16640
+ gt: union([string(), number()]).optional(),
16641
+ gte: union([string(), number()]).optional(),
16642
+ lt: union([string(), number()]).optional(),
16643
+ lte: union([string(), number()]).optional()
16644
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16645
+ ]));
16646
+ var KindShape = { kind: RecordKindNameSchema };
16647
+ var TimeWindowShape = {
16648
+ deviceId: number().int().optional(),
16649
+ atFrom: number().optional(),
16650
+ atTo: number().optional()
16651
+ };
16652
+ var RecordQueryInputSchema = object({
16653
+ ...KindShape,
16654
+ ...TimeWindowShape,
16655
+ where: RecordWhereSchema.optional(),
16656
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16657
+ order: _enum(["at", "id"]).optional(),
16658
+ desc: boolean().optional(),
16659
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16660
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16661
+ cursor: string().min(1).optional()
16662
+ });
16663
+ var RecordQueryResultSchema = object({
16664
+ records: array(RecordViewSchema),
16665
+ nextCursor: string().nullable()
16666
+ });
16667
+ var RecordKindStateSchema = _enum([
16668
+ "created",
16669
+ "unchanged",
16670
+ "updated"
16671
+ ]);
16672
+ var DeclareKindResultSchema = object({
16673
+ kindId: number().int(),
16674
+ state: RecordKindStateSchema,
16675
+ createdIndexes: array(string()),
16676
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16677
+ adoptionPending: object({
16678
+ legacyTable: string(),
16679
+ legacyRows: number().int()
16680
+ }).nullable()
16681
+ });
16682
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16683
+ var SecretRefsList = array(string());
16684
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16685
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16686
+ kind: "mutation",
16687
+ auth: "admin"
16688
+ }), method(object({
16689
+ ...KindShape,
16690
+ id: RecordIdSchema
16691
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16692
+ ...KindShape,
16693
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16694
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16695
+ ...KindShape,
16696
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16697
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16698
+ ...KindShape,
16699
+ record: RecordInputSchema,
16700
+ /** Compare-and-set. `0` means "the row must not exist". */
16701
+ ifRev: number().int().min(0).optional()
16702
+ }), object({
16703
+ rev: number().int(),
16704
+ releasedRefs: SecretRefsList
16705
+ }), {
16706
+ kind: "mutation",
16707
+ auth: "admin"
16708
+ }), method(object({
16709
+ ...KindShape,
16710
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16711
+ }), object({
16712
+ count: number().int(),
16713
+ releasedRefs: SecretRefsList
16714
+ }), {
16715
+ kind: "mutation",
16716
+ auth: "admin"
16717
+ }), method(object({
16718
+ ...KindShape,
16719
+ id: RecordIdSchema,
16720
+ data: RecordBodySchema,
16721
+ at: number().int().nullable().optional(),
16722
+ expiresAt: number().int().nullable().optional(),
16723
+ ifRev: number().int().min(1).optional()
16724
+ }), object({
16725
+ rev: number().int(),
16726
+ releasedRefs: SecretRefsList
16727
+ }), {
16728
+ kind: "mutation",
16729
+ auth: "admin"
16730
+ }), method(object({
16731
+ ...KindShape,
16732
+ id: RecordIdSchema
16733
+ }), object({
16734
+ deleted: boolean(),
16735
+ secretRefs: SecretRefsList
16736
+ }), {
16737
+ kind: "mutation",
16738
+ auth: "admin"
16739
+ }), method(object({
16740
+ ...KindShape,
16741
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16742
+ }), object({
16743
+ deleted: number().int(),
16744
+ secretRefs: SecretRefsList
16745
+ }), {
16746
+ kind: "mutation",
16747
+ auth: "admin"
16748
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16749
+ ...KindShape,
16750
+ ...TimeWindowShape,
16751
+ where: RecordWhereSchema.optional()
16752
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16753
+ ...KindShape,
16754
+ deviceId: number().int().optional(),
16755
+ from: number(),
16756
+ to: number(),
16757
+ bucketMs: number().int().positive()
16758
+ }), object({ buckets: array(object({
16759
+ bucketStart: number(),
16760
+ count: number().int()
16761
+ })) }), { auth: "admin" }), method(object({
16762
+ ...KindShape,
16763
+ op: _enum([
16764
+ "sum",
16765
+ "min",
16766
+ "max",
16767
+ "count"
16768
+ ]),
16769
+ field: RecordFieldPathSchema.optional(),
16770
+ groupBy: RecordFieldPathSchema.optional(),
16771
+ where: RecordWhereSchema.optional()
16772
+ }), object({ rows: array(object({
16773
+ group: union([
16774
+ string(),
16775
+ number(),
16776
+ _null()
16777
+ ]),
16778
+ value: number().nullable()
16779
+ })) }), { auth: "admin" }), method(object({
16780
+ ...KindShape,
16781
+ deviceId: number().int().optional(),
16782
+ atBefore: number().optional(),
16783
+ where: RecordWhereSchema.optional()
16784
+ }), object({
16785
+ deleted: number().int(),
16786
+ secretRefs: SecretRefsList
16787
+ }), {
16788
+ kind: "mutation",
16789
+ auth: "admin"
16790
+ }), method(object({
16791
+ deviceId: number().int(),
16792
+ kinds: array(RecordKindNameSchema).optional()
16793
+ }), object({
16794
+ deleted: record(string(), number().int()),
16795
+ secretRefs: SecretRefsList
16796
+ }), {
16797
+ kind: "mutation",
16798
+ auth: "admin"
16799
+ }), method(object(KindShape), object({ id: number().int() }), {
16800
+ kind: "mutation",
16801
+ auth: "admin"
16802
+ });
16803
+ /** One table of the settings database. */
16804
+ var StorageTableSchema = object({
16805
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16806
+ name: string(),
16807
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16808
+ owner: string().nullable(),
16809
+ rows: number().int().nonnegative(),
16810
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16811
+ bytes: number().int().nonnegative().nullable(),
16812
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16813
+ declaredThisBoot: boolean()
16814
+ });
16815
+ /** One declared record kind (D881) as System -> Data shows it. */
16816
+ var StorageKindSchema = object({
16817
+ owner: string(),
16818
+ kind: string(),
16819
+ database: _enum(["settings", "events"]),
16820
+ class: string(),
16821
+ state: _enum([
16822
+ "declared",
16823
+ "orphaned",
16824
+ "dropped"
16825
+ ]),
16826
+ /** `null` when the caller asked for no counts (`counts: false`). */
16827
+ rows: number().int().nonnegative().nullable(),
16828
+ /** Rows x the average size of a sample; null for an empty kind. */
16829
+ bytesEstimate: number().int().nonnegative().nullable(),
16830
+ writeTrigger: string(),
16831
+ retention: RecordRetentionSchema,
16832
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16833
+ entry: boolean(),
16834
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16835
+ declaration: RecordKindDeclarationSchema
16836
+ });
16837
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16838
+ collection: string().min(1),
16839
+ expectRows: number().int().nonnegative()
16840
+ }), object({
16841
+ dropped: literal(true),
16842
+ rows: number().int().nonnegative()
16843
+ }), {
16844
+ kind: "mutation",
16845
+ auth: "admin"
16846
+ }), method(object({
16847
+ owner: string().min(1).optional(),
16848
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16849
+ counts: boolean().optional()
16850
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16851
+ owner: string().min(1),
16852
+ kind: RecordKindNameSchema
16853
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16854
+ owner: string().min(1),
16855
+ kind: RecordKindNameSchema,
16856
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16857
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16858
+ complete: boolean().optional()
16859
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16860
+ kind: "mutation",
16861
+ auth: "admin"
16862
+ }), method(object({
16863
+ collection: string().min(1),
16864
+ cursor: string().optional(),
16865
+ limit: number().int().min(1).max(1e3).optional()
16866
+ }), object({
16867
+ rows: array(object({
16868
+ id: string(),
16869
+ data: record(string(), unknown())
16870
+ })),
16871
+ nextCursor: string().nullable()
16872
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16873
+ /**
16874
+ * record-entries - the ONE admin surface for every list of user-created entries
16875
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16876
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16877
+ *
16878
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16879
+ * the entry body with `secret: true` on every credential field, so a password
16880
+ * field is derived from the schema and never from a name. `putEntry` takes the
16881
+ * redaction token for an untouched secret (the stored value is kept), a string
16882
+ * for a new one, and the clear instruction to remove one. A read never carries
16883
+ * a secret value, and a locked keychain refuses the write with
16884
+ * `records/secret-unavailable` instead of storing plaintext.
16885
+ *
16886
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16887
+ */
16888
+ var EntryKindInfoSchema = object({
16889
+ owner: string(),
16890
+ kind: RecordKindNameSchema,
16891
+ title: string(),
16892
+ nameField: string(),
16893
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16894
+ fields: record(string(), unknown()),
16895
+ secretPaths: array(string()),
16896
+ rows: number().int().nonnegative()
16897
+ });
16898
+ var EntryViewSchema = object({
16899
+ id: RecordIdSchema,
16900
+ name: string(),
16901
+ rev: number().int(),
16902
+ updatedAt: number(),
16903
+ /** Secret fields hold the redaction token. */
16904
+ data: RecordBodySchema
16905
+ });
16906
+ var EntryAddress = {
16907
+ owner: string().min(1),
16908
+ kind: RecordKindNameSchema
16909
+ };
16910
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16911
+ ...EntryAddress,
16912
+ id: RecordIdSchema.optional(),
16913
+ data: RecordBodySchema,
16914
+ ifRev: number().int().min(1).optional()
16915
+ }), object({
16916
+ id: string(),
16917
+ rev: number().int()
16918
+ }), {
16919
+ kind: "mutation",
16920
+ auth: "admin"
16921
+ }), method(object({
16922
+ ...EntryAddress,
16923
+ id: RecordIdSchema
16924
+ }), object({ deleted: boolean() }), {
16925
+ kind: "mutation",
16926
+ auth: "admin"
16927
+ });
16928
+ /**
15998
16929
  * `keychain` — the hub's encrypted store of secret values (D787).
15999
16930
  *
16000
16931
  * Settings blobs never hold a secret: they hold a marker
@@ -16535,6 +17466,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16535
17466
  kind: "mutation",
16536
17467
  auth: "admin",
16537
17468
  caller: "required"
17469
+ }), method(object({
17470
+ ref: string().min(1),
17471
+ value: string().min(1)
17472
+ }), object({
17473
+ ref: string(),
17474
+ version: number().int()
17475
+ }), {
17476
+ kind: "mutation",
17477
+ auth: "admin",
17478
+ caller: "required"
16538
17479
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16539
17480
  deleted: array(string()).readonly(),
16540
17481
  kept: array(object({
@@ -16832,7 +17773,11 @@ DeviceType.Hub, DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number().int
16832
17773
  });
16833
17774
  /**
16834
17775
  * `device-adoption` — generic discovery + adoption surface,
16835
- * system-scoped singleton. The de-HA-ified successor to `ha-discovery`:
17776
+ * system-scoped collection (one provider per integration addon), routed
17777
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
17778
+ * pin model as `connection-test`. The admin UI keeps using
17779
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
17780
+ * successor to `ha-discovery`:
16836
17781
  * keyed by `integrationId` (the addon resolves integrationId → broker
16837
17782
  * internally) rather than a connection-specific `brokerId`, and it
16838
17783
  * REUSES the shared `DiscoveredChildDevice` candidate type from
@@ -39004,6 +39949,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39004
39949
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39005
39950
  kind: "mutation",
39006
39951
  auth: "admin"
39952
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
39953
+ kind: "mutation",
39954
+ auth: "admin"
39007
39955
  }), method(ProfileRefInputSchema, _void(), {
39008
39956
  kind: "mutation",
39009
39957
  auth: "admin"
@@ -49449,6 +50397,41 @@ var ServerRollbackInfoSchema = object({
49449
50397
  atMs: number(),
49450
50398
  reason: string()
49451
50399
  });
50400
+ /**
50401
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50402
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50403
+ * service holds, because only the hub plans) against the states the process
50404
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50405
+ * every boot, served on `getServerPackageStatus`.
50406
+ *
50407
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50408
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50409
+ * planned runner the process service has no entry for.
50410
+ */
50411
+ var RunnerRefusalSchema = object({
50412
+ runnerId: string(),
50413
+ addonIds: array(string()),
50414
+ reason: string()
50415
+ });
50416
+ var RunnerBootCheckSchema = object({
50417
+ checkedAtMs: number(),
50418
+ /** Runners planned for this node. */
50419
+ expected: number(),
50420
+ /** Planned runners whose process is `running`. */
50421
+ running: number(),
50422
+ failed: array(string()),
50423
+ refused: array(RunnerRefusalSchema),
50424
+ missing: array(string()),
50425
+ /**
50426
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50427
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50428
+ * pushed and the verdict is re-evaluated on the next runner state change.
50429
+ * Optional for version skew (absent = settled).
50430
+ */
50431
+ pending: array(string()).optional(),
50432
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50433
+ planKnown: boolean()
50434
+ });
49452
50435
  var ServerPackageStatusSchema = object({
49453
50436
  /** Root package name (`@camstack/server` on the hub). */
49454
50437
  packageName: string(),
@@ -49511,7 +50494,14 @@ var ServerPackageStatusSchema = object({
49511
50494
  * for version skew: an older provider's payload simply omits it, and an
49512
50495
  * absent wrapper is unknown — never `native`.
49513
50496
  */
49514
- wrapper: WrapperIdentitySchema.optional()
50497
+ wrapper: WrapperIdentitySchema.optional(),
50498
+ /**
50499
+ * What this node PLANNED to run against what its process service reports
50500
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50501
+ * on a provider that predates it. Absent is "not checked yet", never "all
50502
+ * well": a consumer that needs the answer treats it as pending.
50503
+ */
50504
+ runners: RunnerBootCheckSchema.optional()
49515
50505
  });
49516
50506
  var ServerUpdateCheckResultSchema = object({
49517
50507
  packageName: string(),
@@ -49562,6 +50552,13 @@ var ServerUpdateOutcomeSchema = _enum([
49562
50552
  "refused",
49563
50553
  "failed"
49564
50554
  ]);
50555
+ /** One addon the pre-flight found the target version would refuse (D877). */
50556
+ var UpdateBlockerSchema = object({
50557
+ addonId: string(),
50558
+ reason: string(),
50559
+ /** What the operator does about it. */
50560
+ remedy: string()
50561
+ });
49565
50562
  var ServerUpdateActionResultSchema = object({
49566
50563
  accepted: boolean(),
49567
50564
  targetVersion: string().nullable(),
@@ -49579,14 +50576,27 @@ var ServerUpdateActionResultSchema = object({
49579
50576
  * The failure itself, verbatim enough to act on (the npm output for a
49580
50577
  * staging install). Non-null only for `failed`.
49581
50578
  */
49582
- error: string().nullable().optional()
50579
+ error: string().nullable().optional(),
50580
+ /**
50581
+ * The addons the target version would refuse to start on this node's live
50582
+ * store (D877), present when the pre-flight refused the update
50583
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50584
+ */
50585
+ blockers: array(UpdateBlockerSchema).optional()
49583
50586
  });
49584
50587
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49585
50588
  kind: "mutation",
49586
50589
  auth: "admin"
49587
- }), method(object({
49588
- /** Explicit target version; omitted = latest from the registry. */
49589
- version: string().optional() }), ServerUpdateActionResultSchema, {
50590
+ }), method(object({
50591
+ /** Explicit target version; omitted = latest from the registry. */
50592
+ version: string().optional(),
50593
+ /**
50594
+ * Apply even though the pre-flight (D877) found addons the target would
50595
+ * refuse to start. Off by default: those addons stay down until the
50596
+ * remedy is run, which is the incident this gate exists to prevent.
50597
+ */
50598
+ acknowledgeRefusals: boolean().optional()
50599
+ }), ServerUpdateActionResultSchema, {
49590
50600
  kind: "mutation",
49591
50601
  auth: "admin",
49592
50602
  timeoutMs: 16 * 6e4
@@ -51999,7 +53009,9 @@ var ManifestShapeSchema = object({
51999
53009
  var AddonProcessSchema = object({
52000
53010
  pid: number().optional(),
52001
53011
  mode: string(),
52002
- state: string()
53012
+ state: string(),
53013
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53014
+ reason: string().optional()
52003
53015
  });
52004
53016
  /**
52005
53017
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -52577,7 +53589,7 @@ var BatteryStatusSchema = object({
52577
53589
  */
52578
53590
  binary: boolean().optional()
52579
53591
  });
52580
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, method(object({
53592
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, method(object({
52581
53593
  deviceId: number(),
52582
53594
  /** Bound on the wait. Sensible range 3000–10000ms. */
52583
53595
  timeoutMs: number().int().min(500).max(3e4).default(8e3)
@@ -53002,6 +54014,12 @@ object({
53002
54014
  /** Horizontal louver swing on/off. Null when the device has no
53003
54015
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53004
54016
  swingHorizontal: boolean().nullable(),
54017
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54018
+ minTemp: number().nullable().optional(),
54019
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54020
+ maxTemp: number().nullable().optional(),
54021
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54022
+ tempStep: number().positive().nullable().optional(),
53005
54023
  /** Ms epoch when the slice was last updated (push or command). */
53006
54024
  lastFetchedAt: number()
53007
54025
  });
@@ -53447,6 +54465,130 @@ object({
53447
54465
  deviceId: number(),
53448
54466
  status: DeviceStatusSchema
53449
54467
  });
54468
+ /**
54469
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
54470
+ * consumable levels (salt, rinse aid) and common program options.
54471
+ *
54472
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
54473
+ * by any integration that exposes the same program / option surface.
54474
+ *
54475
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
54476
+ * provider refreshes the slice on an interval and eagerly after commands.
54477
+ */
54478
+ var DishwasherStateSchema = _enum([
54479
+ "idle",
54480
+ "running",
54481
+ "paused",
54482
+ "finished",
54483
+ "error",
54484
+ "unavailable"
54485
+ ]);
54486
+ var DishwasherConsumableLevelSchema = _enum([
54487
+ "ok",
54488
+ "low",
54489
+ "empty"
54490
+ ]);
54491
+ object({
54492
+ state: DishwasherStateSchema,
54493
+ /** Active program id/name, or null when none selected / unknown. */
54494
+ program: string().nullable(),
54495
+ /** Program tokens the hardware accepts — drives the UI selector. */
54496
+ availablePrograms: array(string()),
54497
+ /** Minutes remaining on the active cycle, or null when not running. */
54498
+ remainingMinutes: number().int().nonnegative().nullable(),
54499
+ /** Cycle completion 0..100, or null when not applicable. */
54500
+ progressPercent: number().min(0).max(100).nullable(),
54501
+ /** True when the door is reported open. */
54502
+ doorOpen: boolean(),
54503
+ /** True when remote start is allowed (door closed, power on, etc.). */
54504
+ remoteStartAllowed: boolean(),
54505
+ /** Main power / switched-on state. */
54506
+ powerOn: boolean(),
54507
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
54508
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
54509
+ halfLoad: boolean(),
54510
+ hygienePlus: boolean(),
54511
+ /** Extra dry option when the appliance exposes it. */
54512
+ extraDry: boolean(),
54513
+ /** Intensive zone (lower basket) when the appliance exposes it. */
54514
+ intensiveZone: boolean(),
54515
+ /** VarioSpeed / VarioSpeed+ when the appliance exposes it. */
54516
+ varioSpeedPlus: boolean(),
54517
+ /** Child lock (controls disabled on the appliance). */
54518
+ childLock: boolean(),
54519
+ errorCode: number().nullable(),
54520
+ errorLabel: string().nullable(),
54521
+ lastFetchedAt: number()
54522
+ });
54523
+ DeviceType.Dishwasher, method(object({ deviceId: number().int().nonnegative() }), _void(), {
54524
+ kind: "mutation",
54525
+ auth: "protected"
54526
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
54527
+ kind: "mutation",
54528
+ auth: "protected"
54529
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
54530
+ kind: "mutation",
54531
+ auth: "protected"
54532
+ }), method(object({
54533
+ deviceId: number().int().nonnegative(),
54534
+ program: string().min(1)
54535
+ }), _void(), {
54536
+ kind: "mutation",
54537
+ auth: "protected"
54538
+ }), method(object({
54539
+ deviceId: number().int().nonnegative(),
54540
+ on: boolean()
54541
+ }), _void(), {
54542
+ kind: "mutation",
54543
+ auth: "protected"
54544
+ }), method(object({
54545
+ deviceId: number().int().nonnegative(),
54546
+ on: boolean()
54547
+ }), _void(), {
54548
+ kind: "mutation",
54549
+ auth: "protected"
54550
+ }), method(object({
54551
+ deviceId: number().int().nonnegative(),
54552
+ on: boolean()
54553
+ }), _void(), {
54554
+ kind: "mutation",
54555
+ auth: "protected"
54556
+ }), method(object({
54557
+ deviceId: number().int().nonnegative(),
54558
+ on: boolean()
54559
+ }), _void(), {
54560
+ kind: "mutation",
54561
+ auth: "protected"
54562
+ }), method(object({
54563
+ deviceId: number().int().nonnegative(),
54564
+ on: boolean()
54565
+ }), _void(), {
54566
+ kind: "mutation",
54567
+ auth: "protected"
54568
+ }), method(object({
54569
+ deviceId: number().int().nonnegative(),
54570
+ on: boolean()
54571
+ }), _void(), {
54572
+ kind: "mutation",
54573
+ auth: "protected"
54574
+ }), method(object({
54575
+ deviceId: number().int().nonnegative(),
54576
+ on: boolean()
54577
+ }), _void(), {
54578
+ kind: "mutation",
54579
+ auth: "protected"
54580
+ }), method(object({
54581
+ deviceId: number().int().nonnegative(),
54582
+ key: string().min(1),
54583
+ value: union([
54584
+ boolean(),
54585
+ string(),
54586
+ number()
54587
+ ])
54588
+ }), _void(), {
54589
+ kind: "mutation",
54590
+ auth: "protected"
54591
+ });
53450
54592
  object({
53451
54593
  /** Ms epoch of the last press. null = never observed since this provider started. */
53452
54594
  lastPressedAt: number().nullable(),
@@ -54012,6 +55154,13 @@ object({
54012
55154
  lastChangedAt: number()
54013
55155
  });
54014
55156
  DeviceType.Sensor;
55157
+ object({
55158
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
55159
+ position: number().min(0).max(100).nullable(),
55160
+ /** Ms epoch when the slice was last updated (push or poll). */
55161
+ lastFetchedAt: number()
55162
+ });
55163
+ DeviceType.Thermostat;
54015
55164
  object({
54016
55165
  /** Whether the humidifier is currently on. */
54017
55166
  on: boolean(),
@@ -54822,7 +55971,19 @@ var TlsStatusSchema = object({
54822
55971
  sans: array(string()),
54823
55972
  caCertPem: string().nullable(),
54824
55973
  reissueError: string().nullable(),
54825
- restartRequired: boolean()
55974
+ restartRequired: boolean(),
55975
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
55976
+ caMissing: boolean(),
55977
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
55978
+ localCaConstrained: boolean().nullable(),
55979
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
55980
+ caReplacedAt: string().nullable(),
55981
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
55982
+ storedUpload: object({
55983
+ leafFingerprintSha256: string(),
55984
+ validTo: string(),
55985
+ hasCa: boolean()
55986
+ }).nullable()
54826
55987
  });
54827
55988
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
54828
55989
  /**
@@ -54878,6 +56039,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
54878
56039
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
54879
56040
  kind: "mutation",
54880
56041
  auth: "admin"
56042
+ }), method(_void(), TlsStatusSchema, {
56043
+ kind: "mutation",
56044
+ auth: "admin"
54881
56045
  });
54882
56046
  object({
54883
56047
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -60007,7 +61171,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
60007
61171
  kind: "mutation",
60008
61172
  auth: "admin",
60009
61173
  access: "delete"
60010
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
61174
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
61175
+ kind: "mutation",
61176
+ auth: "admin",
61177
+ access: "create"
61178
+ }), method(object({
60011
61179
  userId: string(),
60012
61180
  code: string()
60013
61181
  }), object({ valid: boolean() }), {
@@ -61059,7 +62227,7 @@ var AccessoryKind = {
61059
62227
  PrivacyMask: DeviceRole.PrivacyMask
61060
62228
  };
61061
62229
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
61062
- DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
62230
+ DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
61063
62231
  new Set(Object.values(DeviceType));
61064
62232
  Object.freeze({
61065
62233
  "accessories.getStatus": {
@@ -62208,6 +63376,12 @@ Object.freeze({
62208
63376
  addonId: null,
62209
63377
  access: "view"
62210
63378
  },
63379
+ "coreBlocks.migrateRawSecrets": {
63380
+ capName: "core-blocks",
63381
+ capScope: "system",
63382
+ addonId: null,
63383
+ access: "create"
63384
+ },
62211
63385
  "coreBlocks.restart": {
62212
63386
  capName: "core-blocks",
62213
63387
  capScope: "system",
@@ -63474,6 +64648,84 @@ Object.freeze({
63474
64648
  addonId: null,
63475
64649
  access: "view"
63476
64650
  },
64651
+ "dishwasher.getStatus": {
64652
+ capName: "dishwasher",
64653
+ capScope: "device",
64654
+ addonId: null,
64655
+ access: "view"
64656
+ },
64657
+ "dishwasher.pause": {
64658
+ capName: "dishwasher",
64659
+ capScope: "device",
64660
+ addonId: null,
64661
+ access: "create"
64662
+ },
64663
+ "dishwasher.setChildLock": {
64664
+ capName: "dishwasher",
64665
+ capScope: "device",
64666
+ addonId: null,
64667
+ access: "create"
64668
+ },
64669
+ "dishwasher.setExtraDry": {
64670
+ capName: "dishwasher",
64671
+ capScope: "device",
64672
+ addonId: null,
64673
+ access: "create"
64674
+ },
64675
+ "dishwasher.setHalfLoad": {
64676
+ capName: "dishwasher",
64677
+ capScope: "device",
64678
+ addonId: null,
64679
+ access: "create"
64680
+ },
64681
+ "dishwasher.setHygienePlus": {
64682
+ capName: "dishwasher",
64683
+ capScope: "device",
64684
+ addonId: null,
64685
+ access: "create"
64686
+ },
64687
+ "dishwasher.setIntensiveZone": {
64688
+ capName: "dishwasher",
64689
+ capScope: "device",
64690
+ addonId: null,
64691
+ access: "create"
64692
+ },
64693
+ "dishwasher.setOption": {
64694
+ capName: "dishwasher",
64695
+ capScope: "device",
64696
+ addonId: null,
64697
+ access: "create"
64698
+ },
64699
+ "dishwasher.setPower": {
64700
+ capName: "dishwasher",
64701
+ capScope: "device",
64702
+ addonId: null,
64703
+ access: "create"
64704
+ },
64705
+ "dishwasher.setProgram": {
64706
+ capName: "dishwasher",
64707
+ capScope: "device",
64708
+ addonId: null,
64709
+ access: "create"
64710
+ },
64711
+ "dishwasher.setVarioSpeedPlus": {
64712
+ capName: "dishwasher",
64713
+ capScope: "device",
64714
+ addonId: null,
64715
+ access: "create"
64716
+ },
64717
+ "dishwasher.start": {
64718
+ capName: "dishwasher",
64719
+ capScope: "device",
64720
+ addonId: null,
64721
+ access: "create"
64722
+ },
64723
+ "dishwasher.stop": {
64724
+ capName: "dishwasher",
64725
+ capScope: "device",
64726
+ addonId: null,
64727
+ access: "create"
64728
+ },
63477
64729
  "doorbell.getStatus": {
63478
64730
  capName: "doorbell",
63479
64731
  capScope: "device",
@@ -63684,6 +64936,12 @@ Object.freeze({
63684
64936
  addonId: null,
63685
64937
  access: "view"
63686
64938
  },
64939
+ "heatingValve.getStatus": {
64940
+ capName: "heating-valve",
64941
+ capScope: "device",
64942
+ addonId: null,
64943
+ access: "view"
64944
+ },
63687
64945
  "humidifier.getStatus": {
63688
64946
  capName: "humidifier",
63689
64947
  capScope: "device",
@@ -63894,6 +65152,12 @@ Object.freeze({
63894
65152
  addonId: null,
63895
65153
  access: "create"
63896
65154
  },
65155
+ "keychainAdmin.importSecret": {
65156
+ capName: "keychain-admin",
65157
+ capScope: "system",
65158
+ addonId: null,
65159
+ access: "create"
65160
+ },
63897
65161
  "keychainAdmin.listAudit": {
63898
65162
  capName: "keychain-admin",
63899
65163
  capScope: "system",
@@ -64062,6 +65326,12 @@ Object.freeze({
64062
65326
  addonId: null,
64063
65327
  access: "view"
64064
65328
  },
65329
+ "llm.migrateRawSecrets": {
65330
+ capName: "llm",
65331
+ capScope: "system",
65332
+ addonId: null,
65333
+ access: "create"
65334
+ },
64065
65335
  "llm.resolveModelRef": {
64066
65336
  capName: "llm",
64067
65337
  capScope: "system",
@@ -64290,6 +65560,12 @@ Object.freeze({
64290
65560
  addonId: null,
64291
65561
  access: "create"
64292
65562
  },
65563
+ "localNetwork.useStoredUploadedCertificate": {
65564
+ capName: "local-network",
65565
+ capScope: "system",
65566
+ addonId: null,
65567
+ access: "create"
65568
+ },
64293
65569
  "lockControl.getStatus": {
64294
65570
  capName: "lock-control",
64295
65571
  capScope: "device",
@@ -66942,6 +68218,30 @@ Object.freeze({
66942
68218
  addonId: null,
66943
68219
  access: "create"
66944
68220
  },
68221
+ "recordEntries.deleteEntry": {
68222
+ capName: "record-entries",
68223
+ capScope: "system",
68224
+ addonId: null,
68225
+ access: "delete"
68226
+ },
68227
+ "recordEntries.listEntries": {
68228
+ capName: "record-entries",
68229
+ capScope: "system",
68230
+ addonId: null,
68231
+ access: "view"
68232
+ },
68233
+ "recordEntries.listEntryKinds": {
68234
+ capName: "record-entries",
68235
+ capScope: "system",
68236
+ addonId: null,
68237
+ access: "view"
68238
+ },
68239
+ "recordEntries.putEntry": {
68240
+ capName: "record-entries",
68241
+ capScope: "system",
68242
+ addonId: null,
68243
+ access: "create"
68244
+ },
66945
68245
  "recording.getAvailability": {
66946
68246
  capName: "recording",
66947
68247
  capScope: "device",
@@ -67242,6 +68542,102 @@ Object.freeze({
67242
68542
  addonId: null,
67243
68543
  access: "view"
67244
68544
  },
68545
+ "records.aggregate": {
68546
+ capName: "records",
68547
+ capScope: "system",
68548
+ addonId: null,
68549
+ access: "view"
68550
+ },
68551
+ "records.allocateId": {
68552
+ capName: "records",
68553
+ capScope: "system",
68554
+ addonId: null,
68555
+ access: "create"
68556
+ },
68557
+ "records.count": {
68558
+ capName: "records",
68559
+ capScope: "system",
68560
+ addonId: null,
68561
+ access: "view"
68562
+ },
68563
+ "records.declareKinds": {
68564
+ capName: "records",
68565
+ capScope: "system",
68566
+ addonId: null,
68567
+ access: "create"
68568
+ },
68569
+ "records.delete": {
68570
+ capName: "records",
68571
+ capScope: "system",
68572
+ addonId: null,
68573
+ access: "delete"
68574
+ },
68575
+ "records.deleteDevice": {
68576
+ capName: "records",
68577
+ capScope: "system",
68578
+ addonId: null,
68579
+ access: "delete"
68580
+ },
68581
+ "records.deleteMany": {
68582
+ capName: "records",
68583
+ capScope: "system",
68584
+ addonId: null,
68585
+ access: "delete"
68586
+ },
68587
+ "records.deleteWhere": {
68588
+ capName: "records",
68589
+ capScope: "system",
68590
+ addonId: null,
68591
+ access: "delete"
68592
+ },
68593
+ "records.get": {
68594
+ capName: "records",
68595
+ capScope: "system",
68596
+ addonId: null,
68597
+ access: "view"
68598
+ },
68599
+ "records.getMany": {
68600
+ capName: "records",
68601
+ capScope: "system",
68602
+ addonId: null,
68603
+ access: "view"
68604
+ },
68605
+ "records.histogram": {
68606
+ capName: "records",
68607
+ capScope: "system",
68608
+ addonId: null,
68609
+ access: "view"
68610
+ },
68611
+ "records.patch": {
68612
+ capName: "records",
68613
+ capScope: "system",
68614
+ addonId: null,
68615
+ access: "create"
68616
+ },
68617
+ "records.put": {
68618
+ capName: "records",
68619
+ capScope: "system",
68620
+ addonId: null,
68621
+ access: "create"
68622
+ },
68623
+ "records.putMany": {
68624
+ capName: "records",
68625
+ capScope: "system",
68626
+ addonId: null,
68627
+ access: "create"
68628
+ },
68629
+ "records.query": {
68630
+ capName: "records",
68631
+ capScope: "system",
68632
+ addonId: null,
68633
+ access: "view"
68634
+ },
68635
+ "records.secretRefs": {
68636
+ capName: "records",
68637
+ capScope: "system",
68638
+ addonId: null,
68639
+ access: "view"
68640
+ },
67245
68641
  "sceneMonitor.captureReference": {
67246
68642
  capName: "scene-monitor",
67247
68643
  capScope: "device",
@@ -67674,6 +69070,48 @@ Object.freeze({
67674
69070
  addonId: null,
67675
69071
  access: "create"
67676
69072
  },
69073
+ "storageAdmin.adoptRecords": {
69074
+ capName: "storage-admin",
69075
+ capScope: "system",
69076
+ addonId: null,
69077
+ access: "create"
69078
+ },
69079
+ "storageAdmin.dropCollection": {
69080
+ capName: "storage-admin",
69081
+ capScope: "system",
69082
+ addonId: null,
69083
+ access: "delete"
69084
+ },
69085
+ "storageAdmin.isAdoptedLegacyTable": {
69086
+ capName: "storage-admin",
69087
+ capScope: "system",
69088
+ addonId: null,
69089
+ access: "view"
69090
+ },
69091
+ "storageAdmin.listKinds": {
69092
+ capName: "storage-admin",
69093
+ capScope: "system",
69094
+ addonId: null,
69095
+ access: "view"
69096
+ },
69097
+ "storageAdmin.listTables": {
69098
+ capName: "storage-admin",
69099
+ capScope: "system",
69100
+ addonId: null,
69101
+ access: "view"
69102
+ },
69103
+ "storageAdmin.readLegacyCollection": {
69104
+ capName: "storage-admin",
69105
+ capScope: "system",
69106
+ addonId: null,
69107
+ access: "view"
69108
+ },
69109
+ "storageAdmin.readRecords": {
69110
+ capName: "storage-admin",
69111
+ capScope: "system",
69112
+ addonId: null,
69113
+ access: "view"
69114
+ },
67677
69115
  "storageEvictable.evict": {
67678
69116
  capName: "storage-evictable",
67679
69117
  capScope: "system",
@@ -68586,6 +70024,12 @@ Object.freeze({
68586
70024
  addonId: null,
68587
70025
  access: "view"
68588
70026
  },
70027
+ "userManagement.migrateRawSecrets": {
70028
+ capName: "user-management",
70029
+ capScope: "system",
70030
+ addonId: null,
70031
+ access: "create"
70032
+ },
68589
70033
  "userManagement.oauthExchangeCode": {
68590
70034
  capName: "user-management",
68591
70035
  capScope: "system",
@@ -69085,7 +70529,7 @@ Object.freeze({
69085
70529
  access: "create"
69086
70530
  }
69087
70531
  });
69088
- DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder;
70532
+ DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher;
69089
70533
  DeviceFeature.BatteryOperated;
69090
70534
  Object.freeze({
69091
70535
  "accessories.getStatus": [{
@@ -69909,6 +71353,71 @@ Object.freeze({
69909
71353
  form: "single",
69910
71354
  optional: false
69911
71355
  }],
71356
+ "dishwasher.getStatus": [{
71357
+ name: "deviceId",
71358
+ form: "single",
71359
+ optional: false
71360
+ }],
71361
+ "dishwasher.pause": [{
71362
+ name: "deviceId",
71363
+ form: "single",
71364
+ optional: false
71365
+ }],
71366
+ "dishwasher.setChildLock": [{
71367
+ name: "deviceId",
71368
+ form: "single",
71369
+ optional: false
71370
+ }],
71371
+ "dishwasher.setExtraDry": [{
71372
+ name: "deviceId",
71373
+ form: "single",
71374
+ optional: false
71375
+ }],
71376
+ "dishwasher.setHalfLoad": [{
71377
+ name: "deviceId",
71378
+ form: "single",
71379
+ optional: false
71380
+ }],
71381
+ "dishwasher.setHygienePlus": [{
71382
+ name: "deviceId",
71383
+ form: "single",
71384
+ optional: false
71385
+ }],
71386
+ "dishwasher.setIntensiveZone": [{
71387
+ name: "deviceId",
71388
+ form: "single",
71389
+ optional: false
71390
+ }],
71391
+ "dishwasher.setOption": [{
71392
+ name: "deviceId",
71393
+ form: "single",
71394
+ optional: false
71395
+ }],
71396
+ "dishwasher.setPower": [{
71397
+ name: "deviceId",
71398
+ form: "single",
71399
+ optional: false
71400
+ }],
71401
+ "dishwasher.setProgram": [{
71402
+ name: "deviceId",
71403
+ form: "single",
71404
+ optional: false
71405
+ }],
71406
+ "dishwasher.setVarioSpeedPlus": [{
71407
+ name: "deviceId",
71408
+ form: "single",
71409
+ optional: false
71410
+ }],
71411
+ "dishwasher.start": [{
71412
+ name: "deviceId",
71413
+ form: "single",
71414
+ optional: false
71415
+ }],
71416
+ "dishwasher.stop": [{
71417
+ name: "deviceId",
71418
+ form: "single",
71419
+ optional: false
71420
+ }],
69912
71421
  "doorbell.getStatus": [{
69913
71422
  name: "deviceId",
69914
71423
  form: "single",
@@ -69978,6 +71487,11 @@ Object.freeze({
69978
71487
  form: "single",
69979
71488
  optional: false
69980
71489
  }],
71490
+ "heatingValve.getStatus": [{
71491
+ name: "deviceId",
71492
+ form: "single",
71493
+ optional: false
71494
+ }],
69981
71495
  "humidifier.getStatus": [{
69982
71496
  name: "deviceId",
69983
71497
  form: "single",
@@ -71262,6 +72776,37 @@ Object.freeze({
71262
72776
  form: "single",
71263
72777
  optional: false
71264
72778
  }],
72779
+ "records.count": [{
72780
+ name: "deviceId",
72781
+ form: "single",
72782
+ optional: true
72783
+ }],
72784
+ "records.deleteDevice": [{
72785
+ name: "deviceId",
72786
+ form: "single",
72787
+ optional: false
72788
+ }],
72789
+ "records.deleteWhere": [{
72790
+ name: "deviceId",
72791
+ form: "single",
72792
+ optional: true
72793
+ }],
72794
+ "records.histogram": [{
72795
+ name: "deviceId",
72796
+ form: "single",
72797
+ optional: true
72798
+ }],
72799
+ "records.putMany": [{
72800
+ name: "records",
72801
+ form: "object-array",
72802
+ optional: false,
72803
+ itemField: "deviceId"
72804
+ }],
72805
+ "records.query": [{
72806
+ name: "deviceId",
72807
+ form: "single",
72808
+ optional: true
72809
+ }],
71265
72810
  "sceneMonitor.captureReference": [{
71266
72811
  name: "deviceId",
71267
72812
  form: "single",
@@ -71378,6 +72923,17 @@ Object.freeze({
71378
72923
  form: "single",
71379
72924
  optional: false
71380
72925
  }],
72926
+ "storageAdmin.adoptRecords": [{
72927
+ name: "records",
72928
+ form: "object-array",
72929
+ optional: false,
72930
+ itemField: "deviceId"
72931
+ }],
72932
+ "storageAdmin.readRecords": [{
72933
+ name: "deviceId",
72934
+ form: "single",
72935
+ optional: true
72936
+ }],
71381
72937
  "streamBroker.acquireEgressTranscode": [{
71382
72938
  name: "deviceId",
71383
72939
  form: "single",
@@ -76667,163 +78223,81 @@ function createNotificationOutputProvider(deps) {
76667
78223
  }
76668
78224
  };
76669
78225
  }
76670
- //#endregion
76671
- //#region src/settings-store-port.ts
76672
- function createApiSettingsStorePort(api) {
76673
- return {
76674
- query: async (collection) => {
76675
- return (await api.settingsStore.query.query({ collection })).map((r) => ({
76676
- id: r.id,
76677
- data: r.data
76678
- }));
76679
- },
76680
- insert: async (collection, record) => {
76681
- await api.settingsStore.insert.mutate({
76682
- collection,
76683
- record: {
76684
- id: record.id,
76685
- data: { ...record.data }
76686
- }
76687
- });
76688
- },
76689
- update: async (collection, id, data) => {
76690
- await api.settingsStore.update.mutate({
76691
- collection,
76692
- id,
76693
- data
76694
- });
76695
- },
76696
- remove: async (collection, id) => {
76697
- await api.settingsStore.delete.mutate({
76698
- collection,
76699
- key: id
76700
- });
76701
- },
76702
- declareCollection: async (collection, columns) => {
76703
- await api.settingsStore.declareCollection.mutate({
76704
- collection,
76705
- columns: columns.map((c) => ({ ...c }))
76706
- });
76707
- }
76708
- };
76709
- }
76710
- /** In-memory port — a resilient fallback when no `api` is available. */
76711
- function createMemorySettingsStorePort() {
76712
- const collections = /* @__PURE__ */ new Map();
76713
- const bucket = (collection) => {
76714
- let map = collections.get(collection);
76715
- if (!map) {
76716
- map = /* @__PURE__ */ new Map();
76717
- collections.set(collection, map);
76718
- }
76719
- return map;
76720
- };
76721
- return {
76722
- query: async (collection) => [...bucket(collection).values()],
76723
- insert: async (collection, record) => {
76724
- bucket(collection).set(record.id, {
76725
- id: record.id,
76726
- data: { ...record.data }
76727
- });
76728
- },
76729
- update: async (collection, id, data) => {
76730
- bucket(collection).set(id, {
76731
- id,
76732
- data: { ...data }
76733
- });
76734
- },
76735
- remove: async (collection, id) => {
76736
- bucket(collection).delete(id);
76737
- },
76738
- declareCollection: async (collection) => {
76739
- bucket(collection);
76740
- }
76741
- };
76742
- }
78226
+ var notifiersRecordKinds = defineRecordKinds({ "notification-targets": {
78227
+ schema: TargetSchema.omit({ id: true }),
78228
+ class: "config",
78229
+ writeTrigger: "an operator creates, updates, enables/disables or deletes a notification target",
78230
+ device: "none",
78231
+ at: "none",
78232
+ retention: { none: "a row goes only on an explicit operator delete; bounded by the number of notification targets the operator configures" },
78233
+ adoptsFrom: "notifiers:notification-targets",
78234
+ entry: { title: "Notification targets" }
78235
+ } });
76743
78236
  //#endregion
76744
78237
  //#region src/target-store.ts
76745
78238
  /**
76746
- * Persistence for notification targets over the `settings-store` cap.
78239
+ * Persistence for notification targets over the `notification-targets` record
78240
+ * kind (records plan phase 2, step 17).
76747
78241
  *
76748
- * The store is addressed through a narrow `SettingsStorePort` (query / insert /
76749
- * update / remove) so the class is trivially fakeable in unit tests and never
76750
- * depends on the tRPC-shaped `AddonApi`. Rows live in the addonId-namespaced
76751
- * `notification-targets` collection (the `settings-store` cap prefixes the
76752
- * calling addon's id automatically — the store-isolation fix).
78242
+ * The store is addressed through a `RecordKindHandle<TargetBody>` — the
78243
+ * records facade handles all transport, boot-guard, and index concerns. No
78244
+ * `init()` or `declareCollection` call: kinds are declared at addon boot via
78245
+ * `ctx.records.declare(notifiersRecordKinds)` before this store is constructed.
76753
78246
  *
76754
- * A row is `{ id, data:{ name, kind, addonId, enabled, config } }`. Secrets are
76755
- * inside `config`; redaction/merge is the provider's concern (`secrets.ts`) —
76756
- * the store persists whatever it is handed verbatim.
78247
+ * A row body is `{ name, kind, addonId, enabled, config }` (the record id IS
78248
+ * the target id). Secrets inside `config` are handled at the provider level by
78249
+ * `secrets.ts` (redact on read, merge on write); the records layer stores
78250
+ * the blob verbatim.
76757
78251
  */
76758
- /** The default collection name (see `settings-store` addonId-prefix note). */
78252
+ /** Legacy collection name — kept for the adoption mapper and docs. */
76759
78253
  var TARGETS_COLLECTION = "notifiers:notification-targets";
76760
- /** KV JSON-blob shape — a single `data` column routes the row through the
76761
- * settings backend's canonical key/value path (id TEXT PK, data TEXT). */
76762
- var KV_BLOB_COLUMNS = [{
76763
- name: "data",
76764
- type: "TEXT",
76765
- notNull: true
76766
- }];
76767
- function rowToTarget(row) {
76768
- const candidate = {
76769
- id: row.id,
76770
- ...row.data
76771
- };
76772
- const parsed = TargetSchema.safeParse(candidate);
78254
+ function rowToTarget(id, data) {
78255
+ const parsed = TargetSchema.safeParse({
78256
+ id,
78257
+ ...data
78258
+ });
76773
78259
  return parsed.success ? parsed.data : null;
76774
78260
  }
76775
- function targetToData(target) {
76776
- return {
76777
- name: target.name,
76778
- kind: target.kind,
76779
- addonId: target.addonId,
76780
- enabled: target.enabled,
76781
- config: target.config
76782
- };
76783
- }
76784
- var TargetStore = class {
76785
- store;
76786
- collection;
76787
- constructor(store, collection = TARGETS_COLLECTION) {
76788
- this.store = store;
76789
- this.collection = collection;
78261
+ var TargetStore = class TargetStore {
78262
+ kind;
78263
+ constructor(kind) {
78264
+ this.kind = kind;
76790
78265
  }
76791
- /** Declare the backing collection before any read/write. The SQLite settings
76792
- * backend rejects undeclared collections (fail-fast), so this MUST run before
76793
- * `list`/`getById`/`upsert`/`delete` — mirrors addon-ai's ProfileStore.init. */
76794
- async init() {
76795
- await this.store.declareCollection(this.collection, KV_BLOB_COLUMNS);
78266
+ /** Factory: build from a declared `RecordsAccess` (after `ctx.records.declare`). */
78267
+ static of(records) {
78268
+ return new TargetStore(records.kind(notifiersRecordKinds["notification-targets"]));
76796
78269
  }
76797
78270
  async list() {
76798
- const rows = await this.store.query(this.collection);
76799
- const targets = [];
76800
- for (const row of rows) {
76801
- const target = rowToTarget(row);
76802
- if (target) targets.push(target);
78271
+ const page = await this.kind.query({ limit: 1e3 });
78272
+ const out = [];
78273
+ for (const record of page.records) {
78274
+ const target = rowToTarget(record.id, record.data);
78275
+ if (target !== null) out.push(target);
76803
78276
  }
76804
- return targets;
78277
+ return out;
76805
78278
  }
76806
78279
  async getById(id) {
76807
- const row = (await this.store.query(this.collection)).find((r) => r.id === id);
76808
- return row ? rowToTarget(row) : null;
78280
+ const row = await this.kind.get(id);
78281
+ if (row === null) return null;
78282
+ return rowToTarget(row.id, row.data);
76809
78283
  }
76810
- /** Upsert by id — inserts a new row or updates the existing one. */
78284
+ /** Upsert by id — inserts a new row or replaces the existing one. */
76811
78285
  async upsert(target) {
76812
- const exists = (await this.store.query(this.collection)).some((r) => r.id === target.id);
76813
- const data = targetToData(target);
76814
- if (exists) await this.store.update(this.collection, target.id, data);
76815
- else await this.store.insert(this.collection, {
76816
- id: target.id,
76817
- data
78286
+ const { id, ...rest } = target;
78287
+ const parsed = notifiersRecordKinds["notification-targets"].schema.safeParse(rest);
78288
+ if (!parsed.success) throw new Error(`invalid target '${id}': ${parsed.error.message}`);
78289
+ await this.kind.put({
78290
+ id,
78291
+ data: parsed.data
76818
78292
  });
76819
78293
  }
76820
78294
  async delete(id) {
76821
- await this.store.remove(this.collection, id);
78295
+ await this.kind.delete(id);
76822
78296
  }
76823
78297
  /** Flip `enabled` on an existing target. Returns the updated target, or null if absent. */
76824
78298
  async setEnabled(id, enabled) {
76825
78299
  const target = await this.getById(id);
76826
- if (!target) return null;
78300
+ if (target === null) return null;
76827
78301
  const next = {
76828
78302
  ...target,
76829
78303
  enabled
@@ -76851,10 +78325,10 @@ var NotifiersAddon = class extends BaseAddon {
76851
78325
  }
76852
78326
  async onInitialize() {
76853
78327
  const api = this.ctx.api;
76854
- const port = api ? createApiSettingsStorePort(api) : createMemorySettingsStorePort();
76855
- if (!api) this.ctx.logger.warn("notifiers: no ctx.api — targets persist in-memory only");
76856
- const store = new TargetStore(port);
76857
- await store.init();
78328
+ const records = this.ctx.records;
78329
+ if (records === void 0) throw new Error("notifiers (hub) needs ctx.records — check execution.placement");
78330
+ await records.declare(notifiersRecordKinds);
78331
+ const store = TargetStore.of(records);
76858
78332
  const listProviders = async () => {
76859
78333
  if (api === void 0) return [];
76860
78334
  const [providers, addons] = await Promise.all([api.addons.listCapabilityProviders.query({ capName: "smtp-provider" }), api.addons.list.query()]);
@@ -76935,4 +78409,4 @@ var NotifiersAddon = class extends BaseAddon {
76935
78409
  }
76936
78410
  };
76937
78411
  //#endregion
76938
- export { NotifiersAddon, NotifiersAddon as default, sendHttpPlan as _, NOTIFIERS_ADDON_ID as a, mergeSecrets as c, makeNcTargetHandlers as d, ncTargetActions as f, fetchWithTimeout as g, fetchAttachmentBytes as h, createMemorySettingsStorePort as i, passwordFieldKeys as l, DEFAULT_OUTPUT_TIMEOUT_MS as m, TargetStore as n, createNotificationOutputProvider as o, DEFAULT_MAX_ATTACHMENT_BYTES as p, createApiSettingsStorePort as r, REDACTED_MARKER as s, TARGETS_COLLECTION as t, redactForRead as u };
78412
+ export { NotifiersAddon, NotifiersAddon as default, REDACTED_MARKER as a, redactForRead as c, DEFAULT_MAX_ATTACHMENT_BYTES as d, DEFAULT_OUTPUT_TIMEOUT_MS as f, sendHttpPlan as h, createNotificationOutputProvider as i, makeNcTargetHandlers as l, fetchWithTimeout as m, TargetStore as n, mergeSecrets as o, fetchAttachmentBytes as p, NOTIFIERS_ADDON_ID as r, passwordFieldKeys as s, TARGETS_COLLECTION as t, ncTargetActions as u };