@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.js CHANGED
@@ -29,7 +29,7 @@ let node_fs = require("node:fs");
29
29
  let node_path = require("node:path");
30
30
  node_path = __toESM(node_path);
31
31
  let node_url = require("node:url");
32
- //#region ../types/dist/event-category-C4hVnRo8.mjs
32
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
33
33
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
34
34
  EventCategory["SystemBoot"] = "system.boot";
35
35
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -93,6 +93,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
93
93
  * consumes this category and maps it to the `addon-crash-loop` kind.
94
94
  */
95
95
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
96
+ /**
97
+ * A runner whose addon refused to start with a typed reason (D877) - parked
98
+ * in `refused`, never counted by the crash breaker, retried on operator
99
+ * action. One event per refusal.
100
+ */
101
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
102
+ /**
103
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
104
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
105
+ * runner is still pending) and the alert centre (close a recovered runner).
106
+ */
107
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
108
+ /**
109
+ * The node's one-shot runner boot check (D877): planned runners against the
110
+ * process service, `degraded` when any is failed, refused or missing. The
111
+ * alert centre turns it into one alert and a direct critical push.
112
+ */
113
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
96
114
  EventCategory["AddonError"] = "addon.error";
97
115
  EventCategory["AddonPageReady"] = "addon.page-ready";
98
116
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -4135,6 +4153,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4135
4153
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4136
4154
  json.type = "boolean";
4137
4155
  };
4156
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4157
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4158
+ };
4159
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4160
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4161
+ };
4138
4162
  var nullProcessor = (_schema, ctx, json, _params) => {
4139
4163
  if (ctx.target === "openapi-3.0") {
4140
4164
  json.type = "string";
@@ -4142,12 +4166,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4142
4166
  json.enum = [null];
4143
4167
  } else json.type = "null";
4144
4168
  };
4169
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4170
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4171
+ };
4145
4172
  var voidProcessor = (_schema, ctx, _json, _params) => {
4146
4173
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4147
4174
  };
4148
4175
  var neverProcessor = (_schema, _ctx, json, _params) => {
4149
4176
  json.not = {};
4150
4177
  };
4178
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4179
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4151
4180
  var dateProcessor = (_schema, ctx, _json, _params) => {
4152
4181
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4153
4182
  };
@@ -4179,12 +4208,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4179
4208
  json.enum = vals;
4180
4209
  }
4181
4210
  };
4211
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4212
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4213
+ };
4214
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4215
+ const _json = json;
4216
+ const pattern = schema._zod.pattern;
4217
+ if (!pattern) throw new Error("Pattern not found in template literal");
4218
+ _json.type = "string";
4219
+ _json.pattern = pattern.source;
4220
+ };
4221
+ var fileProcessor = (schema, _ctx, json, _params) => {
4222
+ const _json = json;
4223
+ const file = {
4224
+ type: "string",
4225
+ format: "binary",
4226
+ contentEncoding: "binary"
4227
+ };
4228
+ const { minimum, maximum, mime } = schema._zod.bag;
4229
+ if (minimum !== void 0) file.minLength = minimum;
4230
+ if (maximum !== void 0) file.maxLength = maximum;
4231
+ if (mime) if (mime.length === 1) {
4232
+ file.contentMediaType = mime[0];
4233
+ Object.assign(_json, file);
4234
+ } else {
4235
+ Object.assign(_json, file);
4236
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4237
+ }
4238
+ else Object.assign(_json, file);
4239
+ };
4240
+ var successProcessor = (_schema, _ctx, json, _params) => {
4241
+ json.type = "boolean";
4242
+ };
4182
4243
  var customProcessor = (_schema, ctx, _json, _params) => {
4183
4244
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4184
4245
  };
4246
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4247
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4248
+ };
4185
4249
  var transformProcessor = (_schema, ctx, _json, _params) => {
4186
4250
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4187
4251
  };
4252
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4253
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4254
+ };
4255
+ var setProcessor = (_schema, ctx, _json, _params) => {
4256
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4257
+ };
4188
4258
  var arrayProcessor = (schema, ctx, _json, params) => {
4189
4259
  const json = _json;
4190
4260
  const def = schema._zod.def;
@@ -4389,6 +4459,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4389
4459
  seen.ref = def.innerType;
4390
4460
  json.readOnly = true;
4391
4461
  };
4462
+ var promiseProcessor = (schema, ctx, _json, params) => {
4463
+ const def = schema._zod.def;
4464
+ process(def.innerType, ctx, params);
4465
+ const seen = ctx.seen.get(schema);
4466
+ seen.ref = def.innerType;
4467
+ };
4392
4468
  var optionalProcessor = (schema, ctx, _json, params) => {
4393
4469
  const def = schema._zod.def;
4394
4470
  process(def.innerType, ctx, params);
@@ -4401,6 +4477,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4401
4477
  const seen = ctx.seen.get(schema);
4402
4478
  seen.ref = innerType;
4403
4479
  };
4480
+ var allProcessors = {
4481
+ string: stringProcessor,
4482
+ number: numberProcessor,
4483
+ boolean: booleanProcessor,
4484
+ bigint: bigintProcessor,
4485
+ symbol: symbolProcessor,
4486
+ null: nullProcessor,
4487
+ undefined: undefinedProcessor,
4488
+ void: voidProcessor,
4489
+ never: neverProcessor,
4490
+ any: anyProcessor,
4491
+ unknown: unknownProcessor,
4492
+ date: dateProcessor,
4493
+ enum: enumProcessor,
4494
+ literal: literalProcessor,
4495
+ nan: nanProcessor,
4496
+ template_literal: templateLiteralProcessor,
4497
+ file: fileProcessor,
4498
+ success: successProcessor,
4499
+ custom: customProcessor,
4500
+ function: functionProcessor,
4501
+ transform: transformProcessor,
4502
+ map: mapProcessor,
4503
+ set: setProcessor,
4504
+ array: arrayProcessor,
4505
+ object: objectProcessor,
4506
+ union: unionProcessor,
4507
+ intersection: intersectionProcessor,
4508
+ tuple: tupleProcessor,
4509
+ record: recordProcessor,
4510
+ nullable: nullableProcessor,
4511
+ nonoptional: nonoptionalProcessor,
4512
+ default: defaultProcessor,
4513
+ prefault: prefaultProcessor,
4514
+ catch: catchProcessor,
4515
+ pipe: pipeProcessor,
4516
+ readonly: readonlyProcessor,
4517
+ promise: promiseProcessor,
4518
+ optional: optionalProcessor,
4519
+ lazy: lazyProcessor
4520
+ };
4521
+ function toJSONSchema(input, params) {
4522
+ if ("_idmap" in input) {
4523
+ const registry = input;
4524
+ const ctx = initializeContext({
4525
+ ...params,
4526
+ processors: allProcessors
4527
+ });
4528
+ const defs = {};
4529
+ for (const entry of registry._idmap.entries()) {
4530
+ const [_, schema] = entry;
4531
+ process(schema, ctx);
4532
+ }
4533
+ const schemas = {};
4534
+ ctx.external = {
4535
+ registry,
4536
+ uri: params?.uri,
4537
+ defs
4538
+ };
4539
+ for (const entry of registry._idmap.entries()) {
4540
+ const [key, schema] = entry;
4541
+ extractDefs(ctx, schema);
4542
+ schemas[key] = finalize(ctx, schema);
4543
+ }
4544
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4545
+ return { schemas };
4546
+ }
4547
+ const ctx = initializeContext({
4548
+ ...params,
4549
+ processors: allProcessors
4550
+ });
4551
+ process(input, ctx);
4552
+ extractDefs(ctx, input);
4553
+ return finalize(ctx, input);
4554
+ }
4404
4555
  //#endregion
4405
4556
  //#region ../../node_modules/zod/v4/classic/iso.js
4406
4557
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5417,7 +5568,7 @@ var ZodIssueCode = {
5417
5568
  var ZodFirstPartyTypeKind;
5418
5569
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5419
5570
  //#endregion
5420
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5571
+ //#region ../types/dist/sleep-BegKjwUu.mjs
5421
5572
  /**
5422
5573
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5423
5574
  * window to float samples (D455).
@@ -5534,7 +5685,7 @@ function isKeychainStoredField(field) {
5534
5685
  var SECRET_CLEAR = { $secretClear: true };
5535
5686
  /** The `'***'` token D634 redaction writes for non-admins. */
5536
5687
  var LEGACY_DEVICE_REDACTION = "***";
5537
- function isRecord$2(value) {
5688
+ function isRecord$5(value) {
5538
5689
  return typeof value === "object" && value !== null && !Array.isArray(value);
5539
5690
  }
5540
5691
  function makeSecretMarker(ref) {
@@ -5545,12 +5696,12 @@ function makeSecretMarker(ref) {
5545
5696
  }
5546
5697
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5547
5698
  function isSecretMarker(value) {
5548
- if (!isRecord$2(value)) return false;
5699
+ if (!isRecord$5(value)) return false;
5549
5700
  const ref = value["$secret"];
5550
5701
  return typeof ref === "string" && ref.length > 0;
5551
5702
  }
5552
5703
  function isSecretClear(value) {
5553
- return isRecord$2(value) && value["$secretClear"] === true;
5704
+ return isRecord$5(value) && value["$secretClear"] === true;
5554
5705
  }
5555
5706
  /**
5556
5707
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6160,7 +6311,7 @@ var KeychainWriteRefusedError = class extends Error {
6160
6311
  }
6161
6312
  };
6162
6313
  var KEEP = { kind: "keep" };
6163
- function isRecord$1(value) {
6314
+ function isRecord$4(value) {
6164
6315
  return typeof value === "object" && value !== null && !Array.isArray(value);
6165
6316
  }
6166
6317
  function defaultMintId() {
@@ -6173,7 +6324,7 @@ function collectSecretMarkerRefs(value, out = []) {
6173
6324
  return out;
6174
6325
  }
6175
6326
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6176
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6327
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6177
6328
  return out;
6178
6329
  }
6179
6330
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6228,7 +6379,7 @@ function rowId(row, idKey) {
6228
6379
  return null;
6229
6380
  }
6230
6381
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6231
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6382
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6232
6383
  if (!Array.isArray(incoming)) {
6233
6384
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6234
6385
  return {
@@ -6244,7 +6395,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6244
6395
  const kept = /* @__PURE__ */ new Set();
6245
6396
  const rows = [];
6246
6397
  for (const row of incoming) {
6247
- if (!isRecord$1(row)) {
6398
+ if (!isRecord$4(row)) {
6248
6399
  rows.push(row);
6249
6400
  continue;
6250
6401
  }
@@ -6269,7 +6420,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6269
6420
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6270
6421
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6271
6422
  case "object": {
6272
- if (!isRecord$1(incoming)) {
6423
+ if (!isRecord$4(incoming)) {
6273
6424
  if (incoming === void 0) return KEEP;
6274
6425
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6275
6426
  return {
@@ -6277,7 +6428,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6277
6428
  value: incoming
6278
6429
  };
6279
6430
  }
6280
- const storedObj = isRecord$1(stored) ? stored : {};
6431
+ const storedObj = isRecord$4(stored) ? stored : {};
6281
6432
  return {
6282
6433
  kind: "value",
6283
6434
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6400,7 +6551,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6400
6551
  value: items
6401
6552
  };
6402
6553
  }
6403
- if (isRecord$1(v)) {
6554
+ if (isRecord$4(v)) {
6404
6555
  const out = {};
6405
6556
  for (const [k, child] of Object.entries(v)) {
6406
6557
  const s = substitute(child);
@@ -6668,7 +6819,6 @@ function createHandle(raw, opts) {
6668
6819
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6669
6820
  const readAddonStoreResult = raw.readAddonStoreResult;
6670
6821
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6671
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6672
6822
  const overrides = {
6673
6823
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6674
6824
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6692,12 +6842,12 @@ function createHandle(raw, opts) {
6692
6842
  };
6693
6843
  } } : {},
6694
6844
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6695
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6696
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6845
+ readDeviceStoreBatch: async (deviceIds) => {
6846
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6697
6847
  const out = /* @__PURE__ */ new Map();
6698
6848
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6699
6849
  return out;
6700
- } } : {},
6850
+ },
6701
6851
  writeAddonStore: async (patch) => {
6702
6852
  await writeAddon(patch);
6703
6853
  },
@@ -7324,7 +7474,7 @@ var BaseAddon = class {
7324
7474
  if (!ctx) return;
7325
7475
  const addonId = ctx.id;
7326
7476
  setImmediate(() => {
7327
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7477
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7328
7478
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7329
7479
  }).catch((err) => {
7330
7480
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7524,7 +7674,7 @@ var BaseAddon = class {
7524
7674
  return this._addonSecretTree;
7525
7675
  }
7526
7676
  deviceSecretTree() {
7527
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7677
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7528
7678
  return this._deviceSecretTree;
7529
7679
  }
7530
7680
  /**
@@ -7600,42 +7750,135 @@ var BaseAddon = class {
7600
7750
  this[timerOf] = timer;
7601
7751
  }
7602
7752
  /**
7603
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7604
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7605
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7606
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7753
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7754
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7607
7755
  * addon permanently broken.
7608
7756
  *
7609
- * Retry only the two known infra fingerprints. Anything else propagates so
7610
- * real bugs surface immediately. After the budget expires we fall back to
7611
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7757
+ * Two kinds of outage, two budgets:
7758
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7759
+ * initialized`, `provider not available`): a short budget, then the addon
7760
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7761
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7762
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7763
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7764
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7765
+ * loop. A long, bounded budget; only after it the error propagates - the
7766
+ * addon never runs on defaults for a store it could not ask.
7767
+ * Anything else propagates immediately so real bugs surface.
7612
7768
  */
7613
7769
  async readAddonStoreWithRetry() {
7614
7770
  const settings = this.rawSettings();
7615
7771
  if (!settings) return {};
7616
- const delaysMs = [
7617
- 150,
7618
- 350,
7619
- 600,
7620
- 900
7621
- ];
7622
7772
  let lastErr;
7623
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7773
+ for (let attempt = 0;; attempt++) try {
7624
7774
  const stored = await settings.readAddonStore() ?? {};
7625
7775
  this.settingsStoreReady = true;
7626
7776
  return stored;
7627
7777
  } catch (err) {
7628
7778
  lastErr = err;
7629
- const msg = err instanceof Error ? err.message : String(err);
7630
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7631
- if (attempt === delaysMs.length) break;
7632
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7779
+ const kind = classifyStoreError(err);
7780
+ if (kind === "permanent") throw err;
7781
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7782
+ if (delay === void 0) {
7783
+ if (kind === "transport") throw err;
7784
+ break;
7785
+ }
7786
+ await new Promise((r) => setTimeout(r, delay));
7633
7787
  }
7634
7788
  this.settingsStoreReady = false;
7635
7789
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7636
7790
  return {};
7637
7791
  }
7638
7792
  };
7793
+ /** The settings store's own restart fingerprints. */
7794
+ var RESTART_RETRY_DELAYS_MS = [
7795
+ 150,
7796
+ 350,
7797
+ 600,
7798
+ 900
7799
+ ];
7800
+ /** A hub restarting under a booting runner: ~100 s in total. */
7801
+ var TRANSPORT_RETRY_DELAYS_MS = [
7802
+ 150,
7803
+ 350,
7804
+ 600,
7805
+ 900,
7806
+ 2e3,
7807
+ 5e3,
7808
+ 1e4,
7809
+ 2e4,
7810
+ 3e4,
7811
+ 3e4
7812
+ ];
7813
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7814
+ /** Node / socket error codes of a connection that did not happen or broke. */
7815
+ var TRANSPORT_CODES = new Set([
7816
+ "ECONNREFUSED",
7817
+ "ECONNRESET",
7818
+ "ETIMEDOUT",
7819
+ "EPIPE",
7820
+ "EHOSTUNREACH",
7821
+ "ENETUNREACH"
7822
+ ]);
7823
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7824
+ var UNAVAILABLE_TRPC_CODES = new Set([
7825
+ "TIMEOUT",
7826
+ "SERVICE_UNAVAILABLE",
7827
+ "BAD_GATEWAY",
7828
+ "GATEWAY_TIMEOUT"
7829
+ ]);
7830
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7831
+ var TRANSPORT_PHRASES = [
7832
+ "discovery deadline exceeded",
7833
+ "parent could not route child unowned cap call",
7834
+ "UDS request timed out after",
7835
+ "channel closed"
7836
+ ];
7837
+ /** Moleculer error `type`s of a call that could not be served right now. */
7838
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7839
+ "REQUEST_TIMEOUT",
7840
+ "SERVICE_NOT_FOUND",
7841
+ "SERVICE_NOT_AVAILABLE",
7842
+ "REQUEST_REJECTED",
7843
+ "BROKER_DISCONNECTED"
7844
+ ]);
7845
+ function stringProp(value, key) {
7846
+ if (typeof value !== "object" || value === null) return void 0;
7847
+ const found = Reflect.get(value, key);
7848
+ return typeof found === "string" ? found : void 0;
7849
+ }
7850
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7851
+ function errorCode(err) {
7852
+ const out = {};
7853
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7854
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7855
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7856
+ if (node !== void 0) out.node = node;
7857
+ const trpc = stringProp(data, "code");
7858
+ if (trpc !== void 0) out.trpc = trpc;
7859
+ return out;
7860
+ }
7861
+ /**
7862
+ * Is a settings read failure worth retrying, and with which budget? Only
7863
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7864
+ * one of the exact phrases our own transport raises. A message that merely
7865
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7866
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7867
+ */
7868
+ function classifyStoreError(err) {
7869
+ const message = err instanceof Error ? err.message : String(err);
7870
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7871
+ const code = errorCode(err);
7872
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7873
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7874
+ if (typeof err === "object" && err !== null) {
7875
+ if (Reflect.get(err, "retryable") === true) return "transport";
7876
+ const type = stringProp(err, "type");
7877
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7878
+ }
7879
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7880
+ return "permanent";
7881
+ }
7639
7882
  /**
7640
7883
  * Collect the keys of every field marked `perNode: true`, recursing into
7641
7884
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7725,6 +7968,303 @@ var PeerBytesTicketSchema = object({
7725
7968
  */
7726
7969
  declaredBytes: number().int().nonnegative().nullable()
7727
7970
  });
7971
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7972
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7973
+ var RECORD_DATABASES = ["settings", "events"];
7974
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7975
+ var RECORD_CLASSES = [
7976
+ "config",
7977
+ "ledger",
7978
+ "audit",
7979
+ "mirror",
7980
+ "ephemeral"
7981
+ ];
7982
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7983
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7984
+ var RECORD_BATCH_MAX = 1e3;
7985
+ var RECORD_QUERY_MAX = 1e3;
7986
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
7987
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
7988
+ var PREFIX = "records/";
7989
+ /** The base of every records failure. `detail` is the human part of the message. */
7990
+ var RecordsError = class extends Error {
7991
+ code;
7992
+ detail;
7993
+ constructor(code, detail) {
7994
+ super(`${PREFIX}${code}: ${detail}`);
7995
+ this.name = "RecordsError";
7996
+ this.code = code;
7997
+ this.detail = detail;
7998
+ }
7999
+ };
8000
+ var InvalidRecordError = class extends RecordsError {
8001
+ constructor(detail) {
8002
+ super("invalid-record", detail);
8003
+ this.name = "InvalidRecordError";
8004
+ }
8005
+ };
8006
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
8007
+ var DeclarationRefusedError = class extends RecordsError {
8008
+ constructor(detail) {
8009
+ super("declaration-refused", detail);
8010
+ this.name = "DeclarationRefusedError";
8011
+ }
8012
+ };
8013
+ function defOf(schema) {
8014
+ const zodBag = Reflect.get(schema, "_zod");
8015
+ if (typeof zodBag !== "object" || zodBag === null) return {};
8016
+ const def = Reflect.get(zodBag, "def");
8017
+ if (typeof def !== "object" || def === null) return {};
8018
+ return def;
8019
+ }
8020
+ function declaredHere(schema) {
8021
+ return globalRegistry.get(schema)?.secret === true;
8022
+ }
8023
+ /** Wrapper kinds whose `innerType` is the field itself. */
8024
+ var WRAPPERS = new Set([
8025
+ "optional",
8026
+ "nullable",
8027
+ "default",
8028
+ "prefault",
8029
+ "catch",
8030
+ "readonly",
8031
+ "nonoptional"
8032
+ ]);
8033
+ /**
8034
+ * The schema layers that make up ONE field: the schema itself and every
8035
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8036
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8037
+ * `.transform` on `in`).
8038
+ */
8039
+ function layersOf(schema) {
8040
+ const out = [];
8041
+ const queue = [schema];
8042
+ while (queue.length > 0) {
8043
+ const s = queue.shift();
8044
+ if (!s || out.includes(s)) continue;
8045
+ out.push(s);
8046
+ const def = defOf(s);
8047
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8048
+ if (def.type === "pipe") {
8049
+ if (def.in) queue.push(def.in);
8050
+ if (def.out) queue.push(def.out);
8051
+ }
8052
+ }
8053
+ return out;
8054
+ }
8055
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8056
+ function isZodSecret(schema) {
8057
+ return layersOf(schema).some(declaredHere);
8058
+ }
8059
+ /**
8060
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8061
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8062
+ * object or array is reported as one path and not descended into — everything
8063
+ * under it is secret.
8064
+ */
8065
+ function collectZodSecretPaths(schema, prefix = "") {
8066
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8067
+ const paths = [];
8068
+ for (const layer of layersOf(schema)) {
8069
+ const def = defOf(layer);
8070
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8071
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8072
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8073
+ else if (def.type === "intersection") {
8074
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8075
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8076
+ }
8077
+ }
8078
+ return [...new Set(paths)];
8079
+ }
8080
+ /**
8081
+ * Secret fields of a record, addressed the way a Zod schema declares them
8082
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8083
+ * (`auth.accessToken`, `headers[].value`).
8084
+ *
8085
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8086
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8087
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8088
+ * leaf names its element: `headers[X-Api].value`.
8089
+ *
8090
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8091
+ */
8092
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8093
+ function parseSecretPath(path) {
8094
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8095
+ return path.split(".").map((raw) => {
8096
+ const each = raw.endsWith("[]");
8097
+ const key = each ? raw.slice(0, -2) : raw;
8098
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8099
+ return {
8100
+ key,
8101
+ each
8102
+ };
8103
+ });
8104
+ }
8105
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8106
+ function secretArrayPrefixes(path) {
8107
+ const segments = parseSecretPath(path);
8108
+ const prefixes = [];
8109
+ const walked = [];
8110
+ for (const segment of segments) {
8111
+ walked.push(segment.key);
8112
+ if (segment.each) prefixes.push(walked.join("."));
8113
+ }
8114
+ return prefixes;
8115
+ }
8116
+ /**
8117
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8118
+ * Zod row schema that describes it, and the helper that turns the two into the
8119
+ * JSON the engine stores.
8120
+ *
8121
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8122
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8123
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
8124
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
8125
+ * never a field name (D879).
8126
+ */
8127
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
8128
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
8129
+ var RecordIndexSchema = object({
8130
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
8131
+ fields: array(RecordFieldPathSchema).min(1).max(4),
8132
+ unique: boolean().optional()
8133
+ }).strict();
8134
+ var RecordRetentionSchema = union([
8135
+ object({
8136
+ ttlMs: number().int().positive(),
8137
+ from: _enum(["at", "write"])
8138
+ }).strict(),
8139
+ object({
8140
+ maxRows: number().int().positive().optional(),
8141
+ maxRowsPerDevice: number().int().positive().optional()
8142
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
8143
+ object({
8144
+ owner: string().min(1),
8145
+ reason: string().min(1)
8146
+ }).strict(),
8147
+ object({ none: string().min(1) }).strict()
8148
+ ]);
8149
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
8150
+ var EntryDescriptorSchema = object({
8151
+ title: string().min(1),
8152
+ /** The record body field shown as the entry's name. */
8153
+ nameField: string().min(1),
8154
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
8155
+ fields: record(string(), unknown())
8156
+ }).strict();
8157
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
8158
+ var RecordKindDeclarationSchema = object({
8159
+ database: _enum(RECORD_DATABASES).default("settings"),
8160
+ class: _enum(RECORD_CLASSES),
8161
+ writeTrigger: string().min(1),
8162
+ device: _enum([
8163
+ "required",
8164
+ "optional",
8165
+ "none"
8166
+ ]).default("none"),
8167
+ at: _enum(["required", "none"]).default("none"),
8168
+ indexes: array(RecordIndexSchema).max(8).default([]),
8169
+ retention: RecordRetentionSchema,
8170
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
8171
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
8172
+ /** Derived from the Zod schema; never written by hand. */
8173
+ secretPaths: array(string().min(1)).default([]),
8174
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
8175
+ secretArrayKeys: record(string(), string()).default({}),
8176
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
8177
+ adoptsFrom: string().min(1).optional(),
8178
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
8179
+ transactFamily: string().min(1).optional(),
8180
+ entry: EntryDescriptorSchema.optional()
8181
+ }).strict();
8182
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8183
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8184
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8185
+ function assertValidDeclaration(name, decl) {
8186
+ const refuse = (why) => {
8187
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8188
+ };
8189
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8190
+ const seen = /* @__PURE__ */ new Set();
8191
+ for (const index of decl.indexes) {
8192
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8193
+ seen.add(index.name);
8194
+ }
8195
+ const { retention } = decl;
8196
+ const hasSecrets = decl.secretPaths.length > 0;
8197
+ if ("ttlMs" in retention) {
8198
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8199
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8200
+ }
8201
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8202
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8203
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8204
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8205
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8206
+ 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)`);
8207
+ }
8208
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8209
+ 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`);
8210
+ }
8211
+ function bodyFieldsOf(schema) {
8212
+ return { ...toJSONSchema(schema, {
8213
+ unrepresentable: "any",
8214
+ io: "input"
8215
+ }) };
8216
+ }
8217
+ function isRecordLike(value) {
8218
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8219
+ }
8220
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8221
+ function hasNameField(json, field) {
8222
+ const branches = json["oneOf"] ?? json["anyOf"];
8223
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8224
+ const properties = json["properties"];
8225
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8226
+ }
8227
+ /**
8228
+ * Declare the kinds of a package. The keys are the kind names. The result is
8229
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8230
+ * types its handle from.
8231
+ */
8232
+ function defineRecordKinds(specs) {
8233
+ const out = {};
8234
+ for (const [name, spec] of Object.entries(specs)) {
8235
+ const secretPaths = collectZodSecretPaths(spec.schema);
8236
+ const nameField = spec.entry?.nameField ?? "name";
8237
+ const fields = bodyFieldsOf(spec.schema);
8238
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8239
+ const parsed = RecordKindDeclarationSchema.parse({
8240
+ database: spec.database,
8241
+ class: spec.class,
8242
+ writeTrigger: spec.writeTrigger,
8243
+ device: spec.device,
8244
+ at: spec.at,
8245
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8246
+ retention: spec.retention,
8247
+ deviceRemoval: spec.deviceRemoval,
8248
+ maxDataBytes: spec.maxDataBytes,
8249
+ secretPaths: [...secretPaths],
8250
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8251
+ adoptsFrom: spec.adoptsFrom,
8252
+ transactFamily: spec.transactFamily,
8253
+ entry: spec.entry === void 0 ? void 0 : {
8254
+ title: spec.entry.title,
8255
+ nameField,
8256
+ fields
8257
+ }
8258
+ });
8259
+ assertValidDeclaration(name, parsed);
8260
+ out[name] = {
8261
+ name,
8262
+ schema: spec.schema,
8263
+ declaration: parsed
8264
+ };
8265
+ }
8266
+ return out;
8267
+ }
7728
8268
  /** Shared Zod schemas used across streaming capabilities. */
7729
8269
  var CamProfileSchema = _enum([
7730
8270
  "high",
@@ -8226,7 +8766,7 @@ function userError(code, params, englishFallback) {
8226
8766
  return new CamstackError(code, params, englishFallback);
8227
8767
  }
8228
8768
  //#endregion
8229
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8769
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8230
8770
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8231
8771
  DeviceType["Camera"] = "camera";
8232
8772
  DeviceType["Hub"] = "hub";
@@ -8318,6 +8858,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8318
8858
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8319
8859
  * integrations sharing the same food/desiccant/hopper surface. */
8320
8860
  DeviceType["PetFeeder"] = "pet-feeder";
8861
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8862
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8863
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8864
+ DeviceType["Dishwasher"] = "dishwasher";
8321
8865
  return DeviceType;
8322
8866
  }({});
8323
8867
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8495,6 +9039,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8495
9039
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8496
9040
  * real Switch device for UI rendering / export adapters. */
8497
9041
  DeviceRole["BinaryHelper"] = "binary-helper";
9042
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
9043
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
9044
+ DeviceRole["Outlet"] = "outlet";
8498
9045
  /** Generic motion / occupancy / moving event source. Distinct from
8499
9046
  * the camera accessory PirSensor role: that one is a camera child;
8500
9047
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8562,7 +9109,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8562
9109
  return DeviceRole;
8563
9110
  }({});
8564
9111
  //#endregion
8565
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
9112
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8566
9113
  /**
8567
9114
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8568
9115
  *
@@ -11883,11 +12430,10 @@ var ClipModelMetaSchema = object({
11883
12430
  /**
11884
12431
  * The `vector-store` index this model's vectors live in. ONE feature space
11885
12432
  * per index: two models share an index only when their vectors are ranked
11886
- * against each other, which for CLIP means never across families. MobileCLIP
11887
- * S1 and S2 share `object-clip` for history (separated by the row's
11888
- * `modelId`); any other model gets its own.
12433
+ * against each other, which for CLIP means never across families. Every
12434
+ * model gets its own.
11889
12435
  */
11890
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12436
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11891
12437
  /**
11892
12438
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11893
12439
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -13085,8 +13631,13 @@ var AlertSeveritySchema = _enum([
13085
13631
  "info",
13086
13632
  "success",
13087
13633
  "warning",
13088
- "error"
13634
+ "error",
13635
+ "critical"
13089
13636
  ]);
13637
+ var AlertActionSchema = object({
13638
+ label: string(),
13639
+ href: string().optional()
13640
+ });
13090
13641
  var AlertStatusSchema = _enum([
13091
13642
  "active",
13092
13643
  "in-progress",
@@ -13104,6 +13655,7 @@ var AlertSchema = object({
13104
13655
  severity: AlertSeveritySchema,
13105
13656
  title: string(),
13106
13657
  message: string(),
13658
+ action: AlertActionSchema.optional(),
13107
13659
  status: AlertStatusSchema,
13108
13660
  progress: number().optional(),
13109
13661
  read: boolean(),
@@ -15533,6 +16085,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15533
16085
  keyField: string()
15534
16086
  }).optional()
15535
16087
  })) });
16088
+ /**
16089
+ * The report of a one-shot "move this owner's plaintext secrets into the
16090
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16091
+ *
16092
+ * The owner runs it on its own rows, through its own write path; an operator
16093
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16094
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16095
+ */
16096
+ var RawSecretMigrationInputSchema = object({
16097
+ /** `false` (the default of the script) = report only. */
16098
+ apply: boolean() });
16099
+ var RawSecretMigrationReportSchema = object({
16100
+ apply: boolean(),
16101
+ /** Rows that can carry a secret (a profile, an enrolment). */
16102
+ rows: number().int(),
16103
+ /** Rows whose secret was plaintext when the run started. */
16104
+ raw: number().int(),
16105
+ /** Rows that already held a keychain marker when the run started. */
16106
+ markers: number().int(),
16107
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16108
+ migrated: number().int(),
16109
+ /** Plaintext rows left in place because the move or its read-back failed. */
16110
+ failed: number().int(),
16111
+ /** After the run: rows still holding plaintext. */
16112
+ remainingRaw: number().int(),
16113
+ /** After the run: markers the keychain could not resolve right now. */
16114
+ unresolvedMarkers: number().int(),
16115
+ /**
16116
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16117
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16118
+ */
16119
+ redundantCopies: number().int().optional(),
16120
+ /** True when nothing is raw and every marker resolves. */
16121
+ verified: boolean()
16122
+ });
15536
16123
  /** Where a block runs. The operator chooses — a block driving a device on an
15537
16124
  * agent is the reason placement is not fixed to the hub. */
15538
16125
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15759,6 +16346,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15759
16346
  }), SettingsUpdateResultSchema, {
15760
16347
  kind: "mutation",
15761
16348
  auth: "admin"
16349
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16350
+ kind: "mutation",
16351
+ auth: "admin"
15762
16352
  }), method(object({}), object({ libs: array(object({
15763
16353
  filePath: string(),
15764
16354
  content: string()
@@ -16022,6 +16612,347 @@ id: union([string(), number()]) }), {
16022
16612
  auth: "admin"
16023
16613
  });
16024
16614
  /**
16615
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16616
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16617
+ * (operator intent, D870) and device-history (numbers over time, D850).
16618
+ *
16619
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16620
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16621
+ * that with the addon id closed over). It is deliberately NOT in any input
16622
+ * schema, so a session can never supply it, and a call with no stamp is refused
16623
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16624
+ * addons go through the owner's capability.
16625
+ *
16626
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16627
+ * never `[]`. Secret fields are never on the wire: a read shows the
16628
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16629
+ * resolves itself, and a write may carry only a keychain marker bound to the
16630
+ * row's own ref.
16631
+ *
16632
+ * Internal: addons reach it through `ctx.records`, never directly.
16633
+ */
16634
+ var RecordIdSchema = string().min(1).max(256);
16635
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16636
+ var RecordBodySchema = record(string(), unknown());
16637
+ var RecordInputSchema = object({
16638
+ id: RecordIdSchema,
16639
+ /** The device this row belongs to (D865 removal, per-device reads). */
16640
+ deviceId: number().int().optional(),
16641
+ /** The domain clock, ms: observed / created / opened. */
16642
+ at: number().int().optional(),
16643
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16644
+ expiresAt: number().int().optional(),
16645
+ data: RecordBodySchema
16646
+ });
16647
+ var RecordViewSchema = object({
16648
+ id: string(),
16649
+ deviceId: number().int().nullable(),
16650
+ at: number().nullable(),
16651
+ expiresAt: number().nullable(),
16652
+ rev: number().int(),
16653
+ updatedAt: number(),
16654
+ data: RecordBodySchema
16655
+ });
16656
+ /** Declared index fields only. Anything else does not compile, by design. */
16657
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16658
+ string(),
16659
+ number(),
16660
+ boolean(),
16661
+ object({ in: array(union([
16662
+ string(),
16663
+ number(),
16664
+ boolean()
16665
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16666
+ object({
16667
+ gt: union([string(), number()]).optional(),
16668
+ gte: union([string(), number()]).optional(),
16669
+ lt: union([string(), number()]).optional(),
16670
+ lte: union([string(), number()]).optional()
16671
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16672
+ ]));
16673
+ var KindShape = { kind: RecordKindNameSchema };
16674
+ var TimeWindowShape = {
16675
+ deviceId: number().int().optional(),
16676
+ atFrom: number().optional(),
16677
+ atTo: number().optional()
16678
+ };
16679
+ var RecordQueryInputSchema = object({
16680
+ ...KindShape,
16681
+ ...TimeWindowShape,
16682
+ where: RecordWhereSchema.optional(),
16683
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16684
+ order: _enum(["at", "id"]).optional(),
16685
+ desc: boolean().optional(),
16686
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16687
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16688
+ cursor: string().min(1).optional()
16689
+ });
16690
+ var RecordQueryResultSchema = object({
16691
+ records: array(RecordViewSchema),
16692
+ nextCursor: string().nullable()
16693
+ });
16694
+ var RecordKindStateSchema = _enum([
16695
+ "created",
16696
+ "unchanged",
16697
+ "updated"
16698
+ ]);
16699
+ var DeclareKindResultSchema = object({
16700
+ kindId: number().int(),
16701
+ state: RecordKindStateSchema,
16702
+ createdIndexes: array(string()),
16703
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16704
+ adoptionPending: object({
16705
+ legacyTable: string(),
16706
+ legacyRows: number().int()
16707
+ }).nullable()
16708
+ });
16709
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16710
+ var SecretRefsList = array(string());
16711
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16712
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16713
+ kind: "mutation",
16714
+ auth: "admin"
16715
+ }), method(object({
16716
+ ...KindShape,
16717
+ id: RecordIdSchema
16718
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16719
+ ...KindShape,
16720
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16721
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16722
+ ...KindShape,
16723
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16724
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16725
+ ...KindShape,
16726
+ record: RecordInputSchema,
16727
+ /** Compare-and-set. `0` means "the row must not exist". */
16728
+ ifRev: number().int().min(0).optional()
16729
+ }), object({
16730
+ rev: number().int(),
16731
+ releasedRefs: SecretRefsList
16732
+ }), {
16733
+ kind: "mutation",
16734
+ auth: "admin"
16735
+ }), method(object({
16736
+ ...KindShape,
16737
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16738
+ }), object({
16739
+ count: number().int(),
16740
+ releasedRefs: SecretRefsList
16741
+ }), {
16742
+ kind: "mutation",
16743
+ auth: "admin"
16744
+ }), method(object({
16745
+ ...KindShape,
16746
+ id: RecordIdSchema,
16747
+ data: RecordBodySchema,
16748
+ at: number().int().nullable().optional(),
16749
+ expiresAt: number().int().nullable().optional(),
16750
+ ifRev: number().int().min(1).optional()
16751
+ }), object({
16752
+ rev: number().int(),
16753
+ releasedRefs: SecretRefsList
16754
+ }), {
16755
+ kind: "mutation",
16756
+ auth: "admin"
16757
+ }), method(object({
16758
+ ...KindShape,
16759
+ id: RecordIdSchema
16760
+ }), object({
16761
+ deleted: boolean(),
16762
+ secretRefs: SecretRefsList
16763
+ }), {
16764
+ kind: "mutation",
16765
+ auth: "admin"
16766
+ }), method(object({
16767
+ ...KindShape,
16768
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16769
+ }), object({
16770
+ deleted: number().int(),
16771
+ secretRefs: SecretRefsList
16772
+ }), {
16773
+ kind: "mutation",
16774
+ auth: "admin"
16775
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16776
+ ...KindShape,
16777
+ ...TimeWindowShape,
16778
+ where: RecordWhereSchema.optional()
16779
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16780
+ ...KindShape,
16781
+ deviceId: number().int().optional(),
16782
+ from: number(),
16783
+ to: number(),
16784
+ bucketMs: number().int().positive()
16785
+ }), object({ buckets: array(object({
16786
+ bucketStart: number(),
16787
+ count: number().int()
16788
+ })) }), { auth: "admin" }), method(object({
16789
+ ...KindShape,
16790
+ op: _enum([
16791
+ "sum",
16792
+ "min",
16793
+ "max",
16794
+ "count"
16795
+ ]),
16796
+ field: RecordFieldPathSchema.optional(),
16797
+ groupBy: RecordFieldPathSchema.optional(),
16798
+ where: RecordWhereSchema.optional()
16799
+ }), object({ rows: array(object({
16800
+ group: union([
16801
+ string(),
16802
+ number(),
16803
+ _null()
16804
+ ]),
16805
+ value: number().nullable()
16806
+ })) }), { auth: "admin" }), method(object({
16807
+ ...KindShape,
16808
+ deviceId: number().int().optional(),
16809
+ atBefore: number().optional(),
16810
+ where: RecordWhereSchema.optional()
16811
+ }), object({
16812
+ deleted: number().int(),
16813
+ secretRefs: SecretRefsList
16814
+ }), {
16815
+ kind: "mutation",
16816
+ auth: "admin"
16817
+ }), method(object({
16818
+ deviceId: number().int(),
16819
+ kinds: array(RecordKindNameSchema).optional()
16820
+ }), object({
16821
+ deleted: record(string(), number().int()),
16822
+ secretRefs: SecretRefsList
16823
+ }), {
16824
+ kind: "mutation",
16825
+ auth: "admin"
16826
+ }), method(object(KindShape), object({ id: number().int() }), {
16827
+ kind: "mutation",
16828
+ auth: "admin"
16829
+ });
16830
+ /** One table of the settings database. */
16831
+ var StorageTableSchema = object({
16832
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16833
+ name: string(),
16834
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16835
+ owner: string().nullable(),
16836
+ rows: number().int().nonnegative(),
16837
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16838
+ bytes: number().int().nonnegative().nullable(),
16839
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16840
+ declaredThisBoot: boolean()
16841
+ });
16842
+ /** One declared record kind (D881) as System -> Data shows it. */
16843
+ var StorageKindSchema = object({
16844
+ owner: string(),
16845
+ kind: string(),
16846
+ database: _enum(["settings", "events"]),
16847
+ class: string(),
16848
+ state: _enum([
16849
+ "declared",
16850
+ "orphaned",
16851
+ "dropped"
16852
+ ]),
16853
+ /** `null` when the caller asked for no counts (`counts: false`). */
16854
+ rows: number().int().nonnegative().nullable(),
16855
+ /** Rows x the average size of a sample; null for an empty kind. */
16856
+ bytesEstimate: number().int().nonnegative().nullable(),
16857
+ writeTrigger: string(),
16858
+ retention: RecordRetentionSchema,
16859
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16860
+ entry: boolean(),
16861
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16862
+ declaration: RecordKindDeclarationSchema
16863
+ });
16864
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16865
+ collection: string().min(1),
16866
+ expectRows: number().int().nonnegative()
16867
+ }), object({
16868
+ dropped: literal(true),
16869
+ rows: number().int().nonnegative()
16870
+ }), {
16871
+ kind: "mutation",
16872
+ auth: "admin"
16873
+ }), method(object({
16874
+ owner: string().min(1).optional(),
16875
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16876
+ counts: boolean().optional()
16877
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16878
+ owner: string().min(1),
16879
+ kind: RecordKindNameSchema
16880
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16881
+ owner: string().min(1),
16882
+ kind: RecordKindNameSchema,
16883
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16884
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16885
+ complete: boolean().optional()
16886
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16887
+ kind: "mutation",
16888
+ auth: "admin"
16889
+ }), method(object({
16890
+ collection: string().min(1),
16891
+ cursor: string().optional(),
16892
+ limit: number().int().min(1).max(1e3).optional()
16893
+ }), object({
16894
+ rows: array(object({
16895
+ id: string(),
16896
+ data: record(string(), unknown())
16897
+ })),
16898
+ nextCursor: string().nullable()
16899
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16900
+ /**
16901
+ * record-entries - the ONE admin surface for every list of user-created entries
16902
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16903
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16904
+ *
16905
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16906
+ * the entry body with `secret: true` on every credential field, so a password
16907
+ * field is derived from the schema and never from a name. `putEntry` takes the
16908
+ * redaction token for an untouched secret (the stored value is kept), a string
16909
+ * for a new one, and the clear instruction to remove one. A read never carries
16910
+ * a secret value, and a locked keychain refuses the write with
16911
+ * `records/secret-unavailable` instead of storing plaintext.
16912
+ *
16913
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16914
+ */
16915
+ var EntryKindInfoSchema = object({
16916
+ owner: string(),
16917
+ kind: RecordKindNameSchema,
16918
+ title: string(),
16919
+ nameField: string(),
16920
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16921
+ fields: record(string(), unknown()),
16922
+ secretPaths: array(string()),
16923
+ rows: number().int().nonnegative()
16924
+ });
16925
+ var EntryViewSchema = object({
16926
+ id: RecordIdSchema,
16927
+ name: string(),
16928
+ rev: number().int(),
16929
+ updatedAt: number(),
16930
+ /** Secret fields hold the redaction token. */
16931
+ data: RecordBodySchema
16932
+ });
16933
+ var EntryAddress = {
16934
+ owner: string().min(1),
16935
+ kind: RecordKindNameSchema
16936
+ };
16937
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16938
+ ...EntryAddress,
16939
+ id: RecordIdSchema.optional(),
16940
+ data: RecordBodySchema,
16941
+ ifRev: number().int().min(1).optional()
16942
+ }), object({
16943
+ id: string(),
16944
+ rev: number().int()
16945
+ }), {
16946
+ kind: "mutation",
16947
+ auth: "admin"
16948
+ }), method(object({
16949
+ ...EntryAddress,
16950
+ id: RecordIdSchema
16951
+ }), object({ deleted: boolean() }), {
16952
+ kind: "mutation",
16953
+ auth: "admin"
16954
+ });
16955
+ /**
16025
16956
  * `keychain` — the hub's encrypted store of secret values (D787).
16026
16957
  *
16027
16958
  * Settings blobs never hold a secret: they hold a marker
@@ -16562,6 +17493,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16562
17493
  kind: "mutation",
16563
17494
  auth: "admin",
16564
17495
  caller: "required"
17496
+ }), method(object({
17497
+ ref: string().min(1),
17498
+ value: string().min(1)
17499
+ }), object({
17500
+ ref: string(),
17501
+ version: number().int()
17502
+ }), {
17503
+ kind: "mutation",
17504
+ auth: "admin",
17505
+ caller: "required"
16565
17506
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16566
17507
  deleted: array(string()).readonly(),
16567
17508
  kept: array(object({
@@ -16859,7 +17800,11 @@ DeviceType.Hub, DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number().int
16859
17800
  });
16860
17801
  /**
16861
17802
  * `device-adoption` — generic discovery + adoption surface,
16862
- * system-scoped singleton. The de-HA-ified successor to `ha-discovery`:
17803
+ * system-scoped collection (one provider per integration addon), routed
17804
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
17805
+ * pin model as `connection-test`. The admin UI keeps using
17806
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
17807
+ * successor to `ha-discovery`:
16863
17808
  * keyed by `integrationId` (the addon resolves integrationId → broker
16864
17809
  * internally) rather than a connection-specific `brokerId`, and it
16865
17810
  * REUSES the shared `DiscoveredChildDevice` candidate type from
@@ -39031,6 +39976,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39031
39976
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39032
39977
  kind: "mutation",
39033
39978
  auth: "admin"
39979
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
39980
+ kind: "mutation",
39981
+ auth: "admin"
39034
39982
  }), method(ProfileRefInputSchema, _void(), {
39035
39983
  kind: "mutation",
39036
39984
  auth: "admin"
@@ -49476,6 +50424,41 @@ var ServerRollbackInfoSchema = object({
49476
50424
  atMs: number(),
49477
50425
  reason: string()
49478
50426
  });
50427
+ /**
50428
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50429
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50430
+ * service holds, because only the hub plans) against the states the process
50431
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50432
+ * every boot, served on `getServerPackageStatus`.
50433
+ *
50434
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50435
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50436
+ * planned runner the process service has no entry for.
50437
+ */
50438
+ var RunnerRefusalSchema = object({
50439
+ runnerId: string(),
50440
+ addonIds: array(string()),
50441
+ reason: string()
50442
+ });
50443
+ var RunnerBootCheckSchema = object({
50444
+ checkedAtMs: number(),
50445
+ /** Runners planned for this node. */
50446
+ expected: number(),
50447
+ /** Planned runners whose process is `running`. */
50448
+ running: number(),
50449
+ failed: array(string()),
50450
+ refused: array(RunnerRefusalSchema),
50451
+ missing: array(string()),
50452
+ /**
50453
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50454
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50455
+ * pushed and the verdict is re-evaluated on the next runner state change.
50456
+ * Optional for version skew (absent = settled).
50457
+ */
50458
+ pending: array(string()).optional(),
50459
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50460
+ planKnown: boolean()
50461
+ });
49479
50462
  var ServerPackageStatusSchema = object({
49480
50463
  /** Root package name (`@camstack/server` on the hub). */
49481
50464
  packageName: string(),
@@ -49538,7 +50521,14 @@ var ServerPackageStatusSchema = object({
49538
50521
  * for version skew: an older provider's payload simply omits it, and an
49539
50522
  * absent wrapper is unknown — never `native`.
49540
50523
  */
49541
- wrapper: WrapperIdentitySchema.optional()
50524
+ wrapper: WrapperIdentitySchema.optional(),
50525
+ /**
50526
+ * What this node PLANNED to run against what its process service reports
50527
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50528
+ * on a provider that predates it. Absent is "not checked yet", never "all
50529
+ * well": a consumer that needs the answer treats it as pending.
50530
+ */
50531
+ runners: RunnerBootCheckSchema.optional()
49542
50532
  });
49543
50533
  var ServerUpdateCheckResultSchema = object({
49544
50534
  packageName: string(),
@@ -49589,6 +50579,13 @@ var ServerUpdateOutcomeSchema = _enum([
49589
50579
  "refused",
49590
50580
  "failed"
49591
50581
  ]);
50582
+ /** One addon the pre-flight found the target version would refuse (D877). */
50583
+ var UpdateBlockerSchema = object({
50584
+ addonId: string(),
50585
+ reason: string(),
50586
+ /** What the operator does about it. */
50587
+ remedy: string()
50588
+ });
49592
50589
  var ServerUpdateActionResultSchema = object({
49593
50590
  accepted: boolean(),
49594
50591
  targetVersion: string().nullable(),
@@ -49606,14 +50603,27 @@ var ServerUpdateActionResultSchema = object({
49606
50603
  * The failure itself, verbatim enough to act on (the npm output for a
49607
50604
  * staging install). Non-null only for `failed`.
49608
50605
  */
49609
- error: string().nullable().optional()
50606
+ error: string().nullable().optional(),
50607
+ /**
50608
+ * The addons the target version would refuse to start on this node's live
50609
+ * store (D877), present when the pre-flight refused the update
50610
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50611
+ */
50612
+ blockers: array(UpdateBlockerSchema).optional()
49610
50613
  });
49611
50614
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49612
50615
  kind: "mutation",
49613
50616
  auth: "admin"
49614
- }), method(object({
49615
- /** Explicit target version; omitted = latest from the registry. */
49616
- version: string().optional() }), ServerUpdateActionResultSchema, {
50617
+ }), method(object({
50618
+ /** Explicit target version; omitted = latest from the registry. */
50619
+ version: string().optional(),
50620
+ /**
50621
+ * Apply even though the pre-flight (D877) found addons the target would
50622
+ * refuse to start. Off by default: those addons stay down until the
50623
+ * remedy is run, which is the incident this gate exists to prevent.
50624
+ */
50625
+ acknowledgeRefusals: boolean().optional()
50626
+ }), ServerUpdateActionResultSchema, {
49617
50627
  kind: "mutation",
49618
50628
  auth: "admin",
49619
50629
  timeoutMs: 16 * 6e4
@@ -52026,7 +53036,9 @@ var ManifestShapeSchema = object({
52026
53036
  var AddonProcessSchema = object({
52027
53037
  pid: number().optional(),
52028
53038
  mode: string(),
52029
- state: string()
53039
+ state: string(),
53040
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53041
+ reason: string().optional()
52030
53042
  });
52031
53043
  /**
52032
53044
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -52604,7 +53616,7 @@ var BatteryStatusSchema = object({
52604
53616
  */
52605
53617
  binary: boolean().optional()
52606
53618
  });
52607
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, method(object({
53619
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, method(object({
52608
53620
  deviceId: number(),
52609
53621
  /** Bound on the wait. Sensible range 3000–10000ms. */
52610
53622
  timeoutMs: number().int().min(500).max(3e4).default(8e3)
@@ -53029,6 +54041,12 @@ object({
53029
54041
  /** Horizontal louver swing on/off. Null when the device has no
53030
54042
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53031
54043
  swingHorizontal: boolean().nullable(),
54044
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54045
+ minTemp: number().nullable().optional(),
54046
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54047
+ maxTemp: number().nullable().optional(),
54048
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54049
+ tempStep: number().positive().nullable().optional(),
53032
54050
  /** Ms epoch when the slice was last updated (push or command). */
53033
54051
  lastFetchedAt: number()
53034
54052
  });
@@ -53474,6 +54492,130 @@ object({
53474
54492
  deviceId: number(),
53475
54493
  status: DeviceStatusSchema
53476
54494
  });
54495
+ /**
54496
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
54497
+ * consumable levels (salt, rinse aid) and common program options.
54498
+ *
54499
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
54500
+ * by any integration that exposes the same program / option surface.
54501
+ *
54502
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
54503
+ * provider refreshes the slice on an interval and eagerly after commands.
54504
+ */
54505
+ var DishwasherStateSchema = _enum([
54506
+ "idle",
54507
+ "running",
54508
+ "paused",
54509
+ "finished",
54510
+ "error",
54511
+ "unavailable"
54512
+ ]);
54513
+ var DishwasherConsumableLevelSchema = _enum([
54514
+ "ok",
54515
+ "low",
54516
+ "empty"
54517
+ ]);
54518
+ object({
54519
+ state: DishwasherStateSchema,
54520
+ /** Active program id/name, or null when none selected / unknown. */
54521
+ program: string().nullable(),
54522
+ /** Program tokens the hardware accepts — drives the UI selector. */
54523
+ availablePrograms: array(string()),
54524
+ /** Minutes remaining on the active cycle, or null when not running. */
54525
+ remainingMinutes: number().int().nonnegative().nullable(),
54526
+ /** Cycle completion 0..100, or null when not applicable. */
54527
+ progressPercent: number().min(0).max(100).nullable(),
54528
+ /** True when the door is reported open. */
54529
+ doorOpen: boolean(),
54530
+ /** True when remote start is allowed (door closed, power on, etc.). */
54531
+ remoteStartAllowed: boolean(),
54532
+ /** Main power / switched-on state. */
54533
+ powerOn: boolean(),
54534
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
54535
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
54536
+ halfLoad: boolean(),
54537
+ hygienePlus: boolean(),
54538
+ /** Extra dry option when the appliance exposes it. */
54539
+ extraDry: boolean(),
54540
+ /** Intensive zone (lower basket) when the appliance exposes it. */
54541
+ intensiveZone: boolean(),
54542
+ /** VarioSpeed / VarioSpeed+ when the appliance exposes it. */
54543
+ varioSpeedPlus: boolean(),
54544
+ /** Child lock (controls disabled on the appliance). */
54545
+ childLock: boolean(),
54546
+ errorCode: number().nullable(),
54547
+ errorLabel: string().nullable(),
54548
+ lastFetchedAt: number()
54549
+ });
54550
+ DeviceType.Dishwasher, method(object({ deviceId: number().int().nonnegative() }), _void(), {
54551
+ kind: "mutation",
54552
+ auth: "protected"
54553
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
54554
+ kind: "mutation",
54555
+ auth: "protected"
54556
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
54557
+ kind: "mutation",
54558
+ auth: "protected"
54559
+ }), method(object({
54560
+ deviceId: number().int().nonnegative(),
54561
+ program: string().min(1)
54562
+ }), _void(), {
54563
+ kind: "mutation",
54564
+ auth: "protected"
54565
+ }), method(object({
54566
+ deviceId: number().int().nonnegative(),
54567
+ on: boolean()
54568
+ }), _void(), {
54569
+ kind: "mutation",
54570
+ auth: "protected"
54571
+ }), method(object({
54572
+ deviceId: number().int().nonnegative(),
54573
+ on: boolean()
54574
+ }), _void(), {
54575
+ kind: "mutation",
54576
+ auth: "protected"
54577
+ }), method(object({
54578
+ deviceId: number().int().nonnegative(),
54579
+ on: boolean()
54580
+ }), _void(), {
54581
+ kind: "mutation",
54582
+ auth: "protected"
54583
+ }), method(object({
54584
+ deviceId: number().int().nonnegative(),
54585
+ on: boolean()
54586
+ }), _void(), {
54587
+ kind: "mutation",
54588
+ auth: "protected"
54589
+ }), method(object({
54590
+ deviceId: number().int().nonnegative(),
54591
+ on: boolean()
54592
+ }), _void(), {
54593
+ kind: "mutation",
54594
+ auth: "protected"
54595
+ }), method(object({
54596
+ deviceId: number().int().nonnegative(),
54597
+ on: boolean()
54598
+ }), _void(), {
54599
+ kind: "mutation",
54600
+ auth: "protected"
54601
+ }), method(object({
54602
+ deviceId: number().int().nonnegative(),
54603
+ on: boolean()
54604
+ }), _void(), {
54605
+ kind: "mutation",
54606
+ auth: "protected"
54607
+ }), method(object({
54608
+ deviceId: number().int().nonnegative(),
54609
+ key: string().min(1),
54610
+ value: union([
54611
+ boolean(),
54612
+ string(),
54613
+ number()
54614
+ ])
54615
+ }), _void(), {
54616
+ kind: "mutation",
54617
+ auth: "protected"
54618
+ });
53477
54619
  object({
53478
54620
  /** Ms epoch of the last press. null = never observed since this provider started. */
53479
54621
  lastPressedAt: number().nullable(),
@@ -54039,6 +55181,13 @@ object({
54039
55181
  lastChangedAt: number()
54040
55182
  });
54041
55183
  DeviceType.Sensor;
55184
+ object({
55185
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
55186
+ position: number().min(0).max(100).nullable(),
55187
+ /** Ms epoch when the slice was last updated (push or poll). */
55188
+ lastFetchedAt: number()
55189
+ });
55190
+ DeviceType.Thermostat;
54042
55191
  object({
54043
55192
  /** Whether the humidifier is currently on. */
54044
55193
  on: boolean(),
@@ -54849,7 +55998,19 @@ var TlsStatusSchema = object({
54849
55998
  sans: array(string()),
54850
55999
  caCertPem: string().nullable(),
54851
56000
  reissueError: string().nullable(),
54852
- restartRequired: boolean()
56001
+ restartRequired: boolean(),
56002
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
56003
+ caMissing: boolean(),
56004
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
56005
+ localCaConstrained: boolean().nullable(),
56006
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
56007
+ caReplacedAt: string().nullable(),
56008
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
56009
+ storedUpload: object({
56010
+ leafFingerprintSha256: string(),
56011
+ validTo: string(),
56012
+ hasCa: boolean()
56013
+ }).nullable()
54853
56014
  });
54854
56015
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
54855
56016
  /**
@@ -54905,6 +56066,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
54905
56066
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
54906
56067
  kind: "mutation",
54907
56068
  auth: "admin"
56069
+ }), method(_void(), TlsStatusSchema, {
56070
+ kind: "mutation",
56071
+ auth: "admin"
54908
56072
  });
54909
56073
  object({
54910
56074
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -60034,7 +61198,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
60034
61198
  kind: "mutation",
60035
61199
  auth: "admin",
60036
61200
  access: "delete"
60037
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
61201
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
61202
+ kind: "mutation",
61203
+ auth: "admin",
61204
+ access: "create"
61205
+ }), method(object({
60038
61206
  userId: string(),
60039
61207
  code: string()
60040
61208
  }), object({ valid: boolean() }), {
@@ -61086,7 +62254,7 @@ var AccessoryKind = {
61086
62254
  PrivacyMask: DeviceRole.PrivacyMask
61087
62255
  };
61088
62256
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
61089
- 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;
62257
+ 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;
61090
62258
  new Set(Object.values(DeviceType));
61091
62259
  Object.freeze({
61092
62260
  "accessories.getStatus": {
@@ -62235,6 +63403,12 @@ Object.freeze({
62235
63403
  addonId: null,
62236
63404
  access: "view"
62237
63405
  },
63406
+ "coreBlocks.migrateRawSecrets": {
63407
+ capName: "core-blocks",
63408
+ capScope: "system",
63409
+ addonId: null,
63410
+ access: "create"
63411
+ },
62238
63412
  "coreBlocks.restart": {
62239
63413
  capName: "core-blocks",
62240
63414
  capScope: "system",
@@ -63501,6 +64675,84 @@ Object.freeze({
63501
64675
  addonId: null,
63502
64676
  access: "view"
63503
64677
  },
64678
+ "dishwasher.getStatus": {
64679
+ capName: "dishwasher",
64680
+ capScope: "device",
64681
+ addonId: null,
64682
+ access: "view"
64683
+ },
64684
+ "dishwasher.pause": {
64685
+ capName: "dishwasher",
64686
+ capScope: "device",
64687
+ addonId: null,
64688
+ access: "create"
64689
+ },
64690
+ "dishwasher.setChildLock": {
64691
+ capName: "dishwasher",
64692
+ capScope: "device",
64693
+ addonId: null,
64694
+ access: "create"
64695
+ },
64696
+ "dishwasher.setExtraDry": {
64697
+ capName: "dishwasher",
64698
+ capScope: "device",
64699
+ addonId: null,
64700
+ access: "create"
64701
+ },
64702
+ "dishwasher.setHalfLoad": {
64703
+ capName: "dishwasher",
64704
+ capScope: "device",
64705
+ addonId: null,
64706
+ access: "create"
64707
+ },
64708
+ "dishwasher.setHygienePlus": {
64709
+ capName: "dishwasher",
64710
+ capScope: "device",
64711
+ addonId: null,
64712
+ access: "create"
64713
+ },
64714
+ "dishwasher.setIntensiveZone": {
64715
+ capName: "dishwasher",
64716
+ capScope: "device",
64717
+ addonId: null,
64718
+ access: "create"
64719
+ },
64720
+ "dishwasher.setOption": {
64721
+ capName: "dishwasher",
64722
+ capScope: "device",
64723
+ addonId: null,
64724
+ access: "create"
64725
+ },
64726
+ "dishwasher.setPower": {
64727
+ capName: "dishwasher",
64728
+ capScope: "device",
64729
+ addonId: null,
64730
+ access: "create"
64731
+ },
64732
+ "dishwasher.setProgram": {
64733
+ capName: "dishwasher",
64734
+ capScope: "device",
64735
+ addonId: null,
64736
+ access: "create"
64737
+ },
64738
+ "dishwasher.setVarioSpeedPlus": {
64739
+ capName: "dishwasher",
64740
+ capScope: "device",
64741
+ addonId: null,
64742
+ access: "create"
64743
+ },
64744
+ "dishwasher.start": {
64745
+ capName: "dishwasher",
64746
+ capScope: "device",
64747
+ addonId: null,
64748
+ access: "create"
64749
+ },
64750
+ "dishwasher.stop": {
64751
+ capName: "dishwasher",
64752
+ capScope: "device",
64753
+ addonId: null,
64754
+ access: "create"
64755
+ },
63504
64756
  "doorbell.getStatus": {
63505
64757
  capName: "doorbell",
63506
64758
  capScope: "device",
@@ -63711,6 +64963,12 @@ Object.freeze({
63711
64963
  addonId: null,
63712
64964
  access: "view"
63713
64965
  },
64966
+ "heatingValve.getStatus": {
64967
+ capName: "heating-valve",
64968
+ capScope: "device",
64969
+ addonId: null,
64970
+ access: "view"
64971
+ },
63714
64972
  "humidifier.getStatus": {
63715
64973
  capName: "humidifier",
63716
64974
  capScope: "device",
@@ -63921,6 +65179,12 @@ Object.freeze({
63921
65179
  addonId: null,
63922
65180
  access: "create"
63923
65181
  },
65182
+ "keychainAdmin.importSecret": {
65183
+ capName: "keychain-admin",
65184
+ capScope: "system",
65185
+ addonId: null,
65186
+ access: "create"
65187
+ },
63924
65188
  "keychainAdmin.listAudit": {
63925
65189
  capName: "keychain-admin",
63926
65190
  capScope: "system",
@@ -64089,6 +65353,12 @@ Object.freeze({
64089
65353
  addonId: null,
64090
65354
  access: "view"
64091
65355
  },
65356
+ "llm.migrateRawSecrets": {
65357
+ capName: "llm",
65358
+ capScope: "system",
65359
+ addonId: null,
65360
+ access: "create"
65361
+ },
64092
65362
  "llm.resolveModelRef": {
64093
65363
  capName: "llm",
64094
65364
  capScope: "system",
@@ -64317,6 +65587,12 @@ Object.freeze({
64317
65587
  addonId: null,
64318
65588
  access: "create"
64319
65589
  },
65590
+ "localNetwork.useStoredUploadedCertificate": {
65591
+ capName: "local-network",
65592
+ capScope: "system",
65593
+ addonId: null,
65594
+ access: "create"
65595
+ },
64320
65596
  "lockControl.getStatus": {
64321
65597
  capName: "lock-control",
64322
65598
  capScope: "device",
@@ -66969,6 +68245,30 @@ Object.freeze({
66969
68245
  addonId: null,
66970
68246
  access: "create"
66971
68247
  },
68248
+ "recordEntries.deleteEntry": {
68249
+ capName: "record-entries",
68250
+ capScope: "system",
68251
+ addonId: null,
68252
+ access: "delete"
68253
+ },
68254
+ "recordEntries.listEntries": {
68255
+ capName: "record-entries",
68256
+ capScope: "system",
68257
+ addonId: null,
68258
+ access: "view"
68259
+ },
68260
+ "recordEntries.listEntryKinds": {
68261
+ capName: "record-entries",
68262
+ capScope: "system",
68263
+ addonId: null,
68264
+ access: "view"
68265
+ },
68266
+ "recordEntries.putEntry": {
68267
+ capName: "record-entries",
68268
+ capScope: "system",
68269
+ addonId: null,
68270
+ access: "create"
68271
+ },
66972
68272
  "recording.getAvailability": {
66973
68273
  capName: "recording",
66974
68274
  capScope: "device",
@@ -67269,6 +68569,102 @@ Object.freeze({
67269
68569
  addonId: null,
67270
68570
  access: "view"
67271
68571
  },
68572
+ "records.aggregate": {
68573
+ capName: "records",
68574
+ capScope: "system",
68575
+ addonId: null,
68576
+ access: "view"
68577
+ },
68578
+ "records.allocateId": {
68579
+ capName: "records",
68580
+ capScope: "system",
68581
+ addonId: null,
68582
+ access: "create"
68583
+ },
68584
+ "records.count": {
68585
+ capName: "records",
68586
+ capScope: "system",
68587
+ addonId: null,
68588
+ access: "view"
68589
+ },
68590
+ "records.declareKinds": {
68591
+ capName: "records",
68592
+ capScope: "system",
68593
+ addonId: null,
68594
+ access: "create"
68595
+ },
68596
+ "records.delete": {
68597
+ capName: "records",
68598
+ capScope: "system",
68599
+ addonId: null,
68600
+ access: "delete"
68601
+ },
68602
+ "records.deleteDevice": {
68603
+ capName: "records",
68604
+ capScope: "system",
68605
+ addonId: null,
68606
+ access: "delete"
68607
+ },
68608
+ "records.deleteMany": {
68609
+ capName: "records",
68610
+ capScope: "system",
68611
+ addonId: null,
68612
+ access: "delete"
68613
+ },
68614
+ "records.deleteWhere": {
68615
+ capName: "records",
68616
+ capScope: "system",
68617
+ addonId: null,
68618
+ access: "delete"
68619
+ },
68620
+ "records.get": {
68621
+ capName: "records",
68622
+ capScope: "system",
68623
+ addonId: null,
68624
+ access: "view"
68625
+ },
68626
+ "records.getMany": {
68627
+ capName: "records",
68628
+ capScope: "system",
68629
+ addonId: null,
68630
+ access: "view"
68631
+ },
68632
+ "records.histogram": {
68633
+ capName: "records",
68634
+ capScope: "system",
68635
+ addonId: null,
68636
+ access: "view"
68637
+ },
68638
+ "records.patch": {
68639
+ capName: "records",
68640
+ capScope: "system",
68641
+ addonId: null,
68642
+ access: "create"
68643
+ },
68644
+ "records.put": {
68645
+ capName: "records",
68646
+ capScope: "system",
68647
+ addonId: null,
68648
+ access: "create"
68649
+ },
68650
+ "records.putMany": {
68651
+ capName: "records",
68652
+ capScope: "system",
68653
+ addonId: null,
68654
+ access: "create"
68655
+ },
68656
+ "records.query": {
68657
+ capName: "records",
68658
+ capScope: "system",
68659
+ addonId: null,
68660
+ access: "view"
68661
+ },
68662
+ "records.secretRefs": {
68663
+ capName: "records",
68664
+ capScope: "system",
68665
+ addonId: null,
68666
+ access: "view"
68667
+ },
67272
68668
  "sceneMonitor.captureReference": {
67273
68669
  capName: "scene-monitor",
67274
68670
  capScope: "device",
@@ -67701,6 +69097,48 @@ Object.freeze({
67701
69097
  addonId: null,
67702
69098
  access: "create"
67703
69099
  },
69100
+ "storageAdmin.adoptRecords": {
69101
+ capName: "storage-admin",
69102
+ capScope: "system",
69103
+ addonId: null,
69104
+ access: "create"
69105
+ },
69106
+ "storageAdmin.dropCollection": {
69107
+ capName: "storage-admin",
69108
+ capScope: "system",
69109
+ addonId: null,
69110
+ access: "delete"
69111
+ },
69112
+ "storageAdmin.isAdoptedLegacyTable": {
69113
+ capName: "storage-admin",
69114
+ capScope: "system",
69115
+ addonId: null,
69116
+ access: "view"
69117
+ },
69118
+ "storageAdmin.listKinds": {
69119
+ capName: "storage-admin",
69120
+ capScope: "system",
69121
+ addonId: null,
69122
+ access: "view"
69123
+ },
69124
+ "storageAdmin.listTables": {
69125
+ capName: "storage-admin",
69126
+ capScope: "system",
69127
+ addonId: null,
69128
+ access: "view"
69129
+ },
69130
+ "storageAdmin.readLegacyCollection": {
69131
+ capName: "storage-admin",
69132
+ capScope: "system",
69133
+ addonId: null,
69134
+ access: "view"
69135
+ },
69136
+ "storageAdmin.readRecords": {
69137
+ capName: "storage-admin",
69138
+ capScope: "system",
69139
+ addonId: null,
69140
+ access: "view"
69141
+ },
67704
69142
  "storageEvictable.evict": {
67705
69143
  capName: "storage-evictable",
67706
69144
  capScope: "system",
@@ -68613,6 +70051,12 @@ Object.freeze({
68613
70051
  addonId: null,
68614
70052
  access: "view"
68615
70053
  },
70054
+ "userManagement.migrateRawSecrets": {
70055
+ capName: "user-management",
70056
+ capScope: "system",
70057
+ addonId: null,
70058
+ access: "create"
70059
+ },
68616
70060
  "userManagement.oauthExchangeCode": {
68617
70061
  capName: "user-management",
68618
70062
  capScope: "system",
@@ -69112,7 +70556,7 @@ Object.freeze({
69112
70556
  access: "create"
69113
70557
  }
69114
70558
  });
69115
- 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;
70559
+ 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;
69116
70560
  DeviceFeature.BatteryOperated;
69117
70561
  Object.freeze({
69118
70562
  "accessories.getStatus": [{
@@ -69936,6 +71380,71 @@ Object.freeze({
69936
71380
  form: "single",
69937
71381
  optional: false
69938
71382
  }],
71383
+ "dishwasher.getStatus": [{
71384
+ name: "deviceId",
71385
+ form: "single",
71386
+ optional: false
71387
+ }],
71388
+ "dishwasher.pause": [{
71389
+ name: "deviceId",
71390
+ form: "single",
71391
+ optional: false
71392
+ }],
71393
+ "dishwasher.setChildLock": [{
71394
+ name: "deviceId",
71395
+ form: "single",
71396
+ optional: false
71397
+ }],
71398
+ "dishwasher.setExtraDry": [{
71399
+ name: "deviceId",
71400
+ form: "single",
71401
+ optional: false
71402
+ }],
71403
+ "dishwasher.setHalfLoad": [{
71404
+ name: "deviceId",
71405
+ form: "single",
71406
+ optional: false
71407
+ }],
71408
+ "dishwasher.setHygienePlus": [{
71409
+ name: "deviceId",
71410
+ form: "single",
71411
+ optional: false
71412
+ }],
71413
+ "dishwasher.setIntensiveZone": [{
71414
+ name: "deviceId",
71415
+ form: "single",
71416
+ optional: false
71417
+ }],
71418
+ "dishwasher.setOption": [{
71419
+ name: "deviceId",
71420
+ form: "single",
71421
+ optional: false
71422
+ }],
71423
+ "dishwasher.setPower": [{
71424
+ name: "deviceId",
71425
+ form: "single",
71426
+ optional: false
71427
+ }],
71428
+ "dishwasher.setProgram": [{
71429
+ name: "deviceId",
71430
+ form: "single",
71431
+ optional: false
71432
+ }],
71433
+ "dishwasher.setVarioSpeedPlus": [{
71434
+ name: "deviceId",
71435
+ form: "single",
71436
+ optional: false
71437
+ }],
71438
+ "dishwasher.start": [{
71439
+ name: "deviceId",
71440
+ form: "single",
71441
+ optional: false
71442
+ }],
71443
+ "dishwasher.stop": [{
71444
+ name: "deviceId",
71445
+ form: "single",
71446
+ optional: false
71447
+ }],
69939
71448
  "doorbell.getStatus": [{
69940
71449
  name: "deviceId",
69941
71450
  form: "single",
@@ -70005,6 +71514,11 @@ Object.freeze({
70005
71514
  form: "single",
70006
71515
  optional: false
70007
71516
  }],
71517
+ "heatingValve.getStatus": [{
71518
+ name: "deviceId",
71519
+ form: "single",
71520
+ optional: false
71521
+ }],
70008
71522
  "humidifier.getStatus": [{
70009
71523
  name: "deviceId",
70010
71524
  form: "single",
@@ -71289,6 +72803,37 @@ Object.freeze({
71289
72803
  form: "single",
71290
72804
  optional: false
71291
72805
  }],
72806
+ "records.count": [{
72807
+ name: "deviceId",
72808
+ form: "single",
72809
+ optional: true
72810
+ }],
72811
+ "records.deleteDevice": [{
72812
+ name: "deviceId",
72813
+ form: "single",
72814
+ optional: false
72815
+ }],
72816
+ "records.deleteWhere": [{
72817
+ name: "deviceId",
72818
+ form: "single",
72819
+ optional: true
72820
+ }],
72821
+ "records.histogram": [{
72822
+ name: "deviceId",
72823
+ form: "single",
72824
+ optional: true
72825
+ }],
72826
+ "records.putMany": [{
72827
+ name: "records",
72828
+ form: "object-array",
72829
+ optional: false,
72830
+ itemField: "deviceId"
72831
+ }],
72832
+ "records.query": [{
72833
+ name: "deviceId",
72834
+ form: "single",
72835
+ optional: true
72836
+ }],
71292
72837
  "sceneMonitor.captureReference": [{
71293
72838
  name: "deviceId",
71294
72839
  form: "single",
@@ -71405,6 +72950,17 @@ Object.freeze({
71405
72950
  form: "single",
71406
72951
  optional: false
71407
72952
  }],
72953
+ "storageAdmin.adoptRecords": [{
72954
+ name: "records",
72955
+ form: "object-array",
72956
+ optional: false,
72957
+ itemField: "deviceId"
72958
+ }],
72959
+ "storageAdmin.readRecords": [{
72960
+ name: "deviceId",
72961
+ form: "single",
72962
+ optional: true
72963
+ }],
71408
72964
  "streamBroker.acquireEgressTranscode": [{
71409
72965
  name: "deviceId",
71410
72966
  form: "single",
@@ -76694,163 +78250,81 @@ function createNotificationOutputProvider(deps) {
76694
78250
  }
76695
78251
  };
76696
78252
  }
76697
- //#endregion
76698
- //#region src/settings-store-port.ts
76699
- function createApiSettingsStorePort(api) {
76700
- return {
76701
- query: async (collection) => {
76702
- return (await api.settingsStore.query.query({ collection })).map((r) => ({
76703
- id: r.id,
76704
- data: r.data
76705
- }));
76706
- },
76707
- insert: async (collection, record) => {
76708
- await api.settingsStore.insert.mutate({
76709
- collection,
76710
- record: {
76711
- id: record.id,
76712
- data: { ...record.data }
76713
- }
76714
- });
76715
- },
76716
- update: async (collection, id, data) => {
76717
- await api.settingsStore.update.mutate({
76718
- collection,
76719
- id,
76720
- data
76721
- });
76722
- },
76723
- remove: async (collection, id) => {
76724
- await api.settingsStore.delete.mutate({
76725
- collection,
76726
- key: id
76727
- });
76728
- },
76729
- declareCollection: async (collection, columns) => {
76730
- await api.settingsStore.declareCollection.mutate({
76731
- collection,
76732
- columns: columns.map((c) => ({ ...c }))
76733
- });
76734
- }
76735
- };
76736
- }
76737
- /** In-memory port — a resilient fallback when no `api` is available. */
76738
- function createMemorySettingsStorePort() {
76739
- const collections = /* @__PURE__ */ new Map();
76740
- const bucket = (collection) => {
76741
- let map = collections.get(collection);
76742
- if (!map) {
76743
- map = /* @__PURE__ */ new Map();
76744
- collections.set(collection, map);
76745
- }
76746
- return map;
76747
- };
76748
- return {
76749
- query: async (collection) => [...bucket(collection).values()],
76750
- insert: async (collection, record) => {
76751
- bucket(collection).set(record.id, {
76752
- id: record.id,
76753
- data: { ...record.data }
76754
- });
76755
- },
76756
- update: async (collection, id, data) => {
76757
- bucket(collection).set(id, {
76758
- id,
76759
- data: { ...data }
76760
- });
76761
- },
76762
- remove: async (collection, id) => {
76763
- bucket(collection).delete(id);
76764
- },
76765
- declareCollection: async (collection) => {
76766
- bucket(collection);
76767
- }
76768
- };
76769
- }
78253
+ var notifiersRecordKinds = defineRecordKinds({ "notification-targets": {
78254
+ schema: TargetSchema.omit({ id: true }),
78255
+ class: "config",
78256
+ writeTrigger: "an operator creates, updates, enables/disables or deletes a notification target",
78257
+ device: "none",
78258
+ at: "none",
78259
+ retention: { none: "a row goes only on an explicit operator delete; bounded by the number of notification targets the operator configures" },
78260
+ adoptsFrom: "notifiers:notification-targets",
78261
+ entry: { title: "Notification targets" }
78262
+ } });
76770
78263
  //#endregion
76771
78264
  //#region src/target-store.ts
76772
78265
  /**
76773
- * Persistence for notification targets over the `settings-store` cap.
78266
+ * Persistence for notification targets over the `notification-targets` record
78267
+ * kind (records plan phase 2, step 17).
76774
78268
  *
76775
- * The store is addressed through a narrow `SettingsStorePort` (query / insert /
76776
- * update / remove) so the class is trivially fakeable in unit tests and never
76777
- * depends on the tRPC-shaped `AddonApi`. Rows live in the addonId-namespaced
76778
- * `notification-targets` collection (the `settings-store` cap prefixes the
76779
- * calling addon's id automatically — the store-isolation fix).
78269
+ * The store is addressed through a `RecordKindHandle<TargetBody>` — the
78270
+ * records facade handles all transport, boot-guard, and index concerns. No
78271
+ * `init()` or `declareCollection` call: kinds are declared at addon boot via
78272
+ * `ctx.records.declare(notifiersRecordKinds)` before this store is constructed.
76780
78273
  *
76781
- * A row is `{ id, data:{ name, kind, addonId, enabled, config } }`. Secrets are
76782
- * inside `config`; redaction/merge is the provider's concern (`secrets.ts`) —
76783
- * the store persists whatever it is handed verbatim.
78274
+ * A row body is `{ name, kind, addonId, enabled, config }` (the record id IS
78275
+ * the target id). Secrets inside `config` are handled at the provider level by
78276
+ * `secrets.ts` (redact on read, merge on write); the records layer stores
78277
+ * the blob verbatim.
76784
78278
  */
76785
- /** The default collection name (see `settings-store` addonId-prefix note). */
78279
+ /** Legacy collection name — kept for the adoption mapper and docs. */
76786
78280
  var TARGETS_COLLECTION = "notifiers:notification-targets";
76787
- /** KV JSON-blob shape — a single `data` column routes the row through the
76788
- * settings backend's canonical key/value path (id TEXT PK, data TEXT). */
76789
- var KV_BLOB_COLUMNS = [{
76790
- name: "data",
76791
- type: "TEXT",
76792
- notNull: true
76793
- }];
76794
- function rowToTarget(row) {
76795
- const candidate = {
76796
- id: row.id,
76797
- ...row.data
76798
- };
76799
- const parsed = TargetSchema.safeParse(candidate);
78281
+ function rowToTarget(id, data) {
78282
+ const parsed = TargetSchema.safeParse({
78283
+ id,
78284
+ ...data
78285
+ });
76800
78286
  return parsed.success ? parsed.data : null;
76801
78287
  }
76802
- function targetToData(target) {
76803
- return {
76804
- name: target.name,
76805
- kind: target.kind,
76806
- addonId: target.addonId,
76807
- enabled: target.enabled,
76808
- config: target.config
76809
- };
76810
- }
76811
- var TargetStore = class {
76812
- store;
76813
- collection;
76814
- constructor(store, collection = TARGETS_COLLECTION) {
76815
- this.store = store;
76816
- this.collection = collection;
78288
+ var TargetStore = class TargetStore {
78289
+ kind;
78290
+ constructor(kind) {
78291
+ this.kind = kind;
76817
78292
  }
76818
- /** Declare the backing collection before any read/write. The SQLite settings
76819
- * backend rejects undeclared collections (fail-fast), so this MUST run before
76820
- * `list`/`getById`/`upsert`/`delete` — mirrors addon-ai's ProfileStore.init. */
76821
- async init() {
76822
- await this.store.declareCollection(this.collection, KV_BLOB_COLUMNS);
78293
+ /** Factory: build from a declared `RecordsAccess` (after `ctx.records.declare`). */
78294
+ static of(records) {
78295
+ return new TargetStore(records.kind(notifiersRecordKinds["notification-targets"]));
76823
78296
  }
76824
78297
  async list() {
76825
- const rows = await this.store.query(this.collection);
76826
- const targets = [];
76827
- for (const row of rows) {
76828
- const target = rowToTarget(row);
76829
- if (target) targets.push(target);
78298
+ const page = await this.kind.query({ limit: 1e3 });
78299
+ const out = [];
78300
+ for (const record of page.records) {
78301
+ const target = rowToTarget(record.id, record.data);
78302
+ if (target !== null) out.push(target);
76830
78303
  }
76831
- return targets;
78304
+ return out;
76832
78305
  }
76833
78306
  async getById(id) {
76834
- const row = (await this.store.query(this.collection)).find((r) => r.id === id);
76835
- return row ? rowToTarget(row) : null;
78307
+ const row = await this.kind.get(id);
78308
+ if (row === null) return null;
78309
+ return rowToTarget(row.id, row.data);
76836
78310
  }
76837
- /** Upsert by id — inserts a new row or updates the existing one. */
78311
+ /** Upsert by id — inserts a new row or replaces the existing one. */
76838
78312
  async upsert(target) {
76839
- const exists = (await this.store.query(this.collection)).some((r) => r.id === target.id);
76840
- const data = targetToData(target);
76841
- if (exists) await this.store.update(this.collection, target.id, data);
76842
- else await this.store.insert(this.collection, {
76843
- id: target.id,
76844
- data
78313
+ const { id, ...rest } = target;
78314
+ const parsed = notifiersRecordKinds["notification-targets"].schema.safeParse(rest);
78315
+ if (!parsed.success) throw new Error(`invalid target '${id}': ${parsed.error.message}`);
78316
+ await this.kind.put({
78317
+ id,
78318
+ data: parsed.data
76845
78319
  });
76846
78320
  }
76847
78321
  async delete(id) {
76848
- await this.store.remove(this.collection, id);
78322
+ await this.kind.delete(id);
76849
78323
  }
76850
78324
  /** Flip `enabled` on an existing target. Returns the updated target, or null if absent. */
76851
78325
  async setEnabled(id, enabled) {
76852
78326
  const target = await this.getById(id);
76853
- if (!target) return null;
78327
+ if (target === null) return null;
76854
78328
  const next = {
76855
78329
  ...target,
76856
78330
  enabled
@@ -76878,10 +78352,10 @@ var NotifiersAddon = class extends BaseAddon {
76878
78352
  }
76879
78353
  async onInitialize() {
76880
78354
  const api = this.ctx.api;
76881
- const port = api ? createApiSettingsStorePort(api) : createMemorySettingsStorePort();
76882
- if (!api) this.ctx.logger.warn("notifiers: no ctx.api — targets persist in-memory only");
76883
- const store = new TargetStore(port);
76884
- await store.init();
78355
+ const records = this.ctx.records;
78356
+ if (records === void 0) throw new Error("notifiers (hub) needs ctx.records — check execution.placement");
78357
+ await records.declare(notifiersRecordKinds);
78358
+ const store = TargetStore.of(records);
76885
78359
  const listProviders = async () => {
76886
78360
  if (api === void 0) return [];
76887
78361
  const [providers, addons] = await Promise.all([api.addons.listCapabilityProviders.query({ capName: "smtp-provider" }), api.addons.list.query()]);
@@ -76970,8 +78444,6 @@ exports.default = NotifiersAddon;
76970
78444
  exports.REDACTED_MARKER = REDACTED_MARKER;
76971
78445
  exports.TARGETS_COLLECTION = TARGETS_COLLECTION;
76972
78446
  exports.TargetStore = TargetStore;
76973
- exports.createApiSettingsStorePort = createApiSettingsStorePort;
76974
- exports.createMemorySettingsStorePort = createMemorySettingsStorePort;
76975
78447
  exports.createNotificationOutputProvider = createNotificationOutputProvider;
76976
78448
  exports.fetchAttachmentBytes = fetchAttachmentBytes;
76977
78449
  exports.fetchWithTimeout = fetchWithTimeout;