@camstack/addon-waste-collections 0.1.7 → 0.1.9

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.
@@ -4126,6 +4126,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4126
4126
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4127
4127
  json.type = "boolean";
4128
4128
  };
4129
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4130
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4131
+ };
4132
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4133
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4134
+ };
4129
4135
  var nullProcessor = (_schema, ctx, json, _params) => {
4130
4136
  if (ctx.target === "openapi-3.0") {
4131
4137
  json.type = "string";
@@ -4133,12 +4139,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4133
4139
  json.enum = [null];
4134
4140
  } else json.type = "null";
4135
4141
  };
4142
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4143
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4144
+ };
4136
4145
  var voidProcessor = (_schema, ctx, _json, _params) => {
4137
4146
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4138
4147
  };
4139
4148
  var neverProcessor = (_schema, _ctx, json, _params) => {
4140
4149
  json.not = {};
4141
4150
  };
4151
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4152
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4142
4153
  var dateProcessor = (_schema, ctx, _json, _params) => {
4143
4154
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4144
4155
  };
@@ -4170,12 +4181,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4170
4181
  json.enum = vals;
4171
4182
  }
4172
4183
  };
4184
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4185
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4186
+ };
4187
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4188
+ const _json = json;
4189
+ const pattern = schema._zod.pattern;
4190
+ if (!pattern) throw new Error("Pattern not found in template literal");
4191
+ _json.type = "string";
4192
+ _json.pattern = pattern.source;
4193
+ };
4194
+ var fileProcessor = (schema, _ctx, json, _params) => {
4195
+ const _json = json;
4196
+ const file = {
4197
+ type: "string",
4198
+ format: "binary",
4199
+ contentEncoding: "binary"
4200
+ };
4201
+ const { minimum, maximum, mime } = schema._zod.bag;
4202
+ if (minimum !== void 0) file.minLength = minimum;
4203
+ if (maximum !== void 0) file.maxLength = maximum;
4204
+ if (mime) if (mime.length === 1) {
4205
+ file.contentMediaType = mime[0];
4206
+ Object.assign(_json, file);
4207
+ } else {
4208
+ Object.assign(_json, file);
4209
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4210
+ }
4211
+ else Object.assign(_json, file);
4212
+ };
4213
+ var successProcessor = (_schema, _ctx, json, _params) => {
4214
+ json.type = "boolean";
4215
+ };
4173
4216
  var customProcessor = (_schema, ctx, _json, _params) => {
4174
4217
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4175
4218
  };
4219
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4220
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4221
+ };
4176
4222
  var transformProcessor = (_schema, ctx, _json, _params) => {
4177
4223
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4178
4224
  };
4225
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4226
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4227
+ };
4228
+ var setProcessor = (_schema, ctx, _json, _params) => {
4229
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4230
+ };
4179
4231
  var arrayProcessor = (schema, ctx, _json, params) => {
4180
4232
  const json = _json;
4181
4233
  const def = schema._zod.def;
@@ -4380,6 +4432,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4380
4432
  seen.ref = def.innerType;
4381
4433
  json.readOnly = true;
4382
4434
  };
4435
+ var promiseProcessor = (schema, ctx, _json, params) => {
4436
+ const def = schema._zod.def;
4437
+ process(def.innerType, ctx, params);
4438
+ const seen = ctx.seen.get(schema);
4439
+ seen.ref = def.innerType;
4440
+ };
4383
4441
  var optionalProcessor = (schema, ctx, _json, params) => {
4384
4442
  const def = schema._zod.def;
4385
4443
  process(def.innerType, ctx, params);
@@ -4392,6 +4450,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4392
4450
  const seen = ctx.seen.get(schema);
4393
4451
  seen.ref = innerType;
4394
4452
  };
4453
+ var allProcessors = {
4454
+ string: stringProcessor,
4455
+ number: numberProcessor,
4456
+ boolean: booleanProcessor,
4457
+ bigint: bigintProcessor,
4458
+ symbol: symbolProcessor,
4459
+ null: nullProcessor,
4460
+ undefined: undefinedProcessor,
4461
+ void: voidProcessor,
4462
+ never: neverProcessor,
4463
+ any: anyProcessor,
4464
+ unknown: unknownProcessor,
4465
+ date: dateProcessor,
4466
+ enum: enumProcessor,
4467
+ literal: literalProcessor,
4468
+ nan: nanProcessor,
4469
+ template_literal: templateLiteralProcessor,
4470
+ file: fileProcessor,
4471
+ success: successProcessor,
4472
+ custom: customProcessor,
4473
+ function: functionProcessor,
4474
+ transform: transformProcessor,
4475
+ map: mapProcessor,
4476
+ set: setProcessor,
4477
+ array: arrayProcessor,
4478
+ object: objectProcessor,
4479
+ union: unionProcessor,
4480
+ intersection: intersectionProcessor,
4481
+ tuple: tupleProcessor,
4482
+ record: recordProcessor,
4483
+ nullable: nullableProcessor,
4484
+ nonoptional: nonoptionalProcessor,
4485
+ default: defaultProcessor,
4486
+ prefault: prefaultProcessor,
4487
+ catch: catchProcessor,
4488
+ pipe: pipeProcessor,
4489
+ readonly: readonlyProcessor,
4490
+ promise: promiseProcessor,
4491
+ optional: optionalProcessor,
4492
+ lazy: lazyProcessor
4493
+ };
4494
+ function toJSONSchema(input, params) {
4495
+ if ("_idmap" in input) {
4496
+ const registry = input;
4497
+ const ctx = initializeContext({
4498
+ ...params,
4499
+ processors: allProcessors
4500
+ });
4501
+ const defs = {};
4502
+ for (const entry of registry._idmap.entries()) {
4503
+ const [_, schema] = entry;
4504
+ process(schema, ctx);
4505
+ }
4506
+ const schemas = {};
4507
+ ctx.external = {
4508
+ registry,
4509
+ uri: params?.uri,
4510
+ defs
4511
+ };
4512
+ for (const entry of registry._idmap.entries()) {
4513
+ const [key, schema] = entry;
4514
+ extractDefs(ctx, schema);
4515
+ schemas[key] = finalize(ctx, schema);
4516
+ }
4517
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4518
+ return { schemas };
4519
+ }
4520
+ const ctx = initializeContext({
4521
+ ...params,
4522
+ processors: allProcessors
4523
+ });
4524
+ process(input, ctx);
4525
+ extractDefs(ctx, input);
4526
+ return finalize(ctx, input);
4527
+ }
4395
4528
  //#endregion
4396
4529
  //#region ../../node_modules/zod/v4/classic/iso.js
4397
4530
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5408,7 +5541,7 @@ var ZodIssueCode = {
5408
5541
  var ZodFirstPartyTypeKind;
5409
5542
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5410
5543
  //#endregion
5411
- //#region ../types/dist/sleep-D-Q2_Mcd.mjs
5544
+ //#region ../types/dist/sleep-BegKjwUu.mjs
5412
5545
  /**
5413
5546
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5414
5547
  * window to float samples (D455).
@@ -5535,7 +5668,7 @@ function isKeychainStoredField(field) {
5535
5668
  var SECRET_CLEAR = { $secretClear: true };
5536
5669
  /** The `'***'` token D634 redaction writes for non-admins. */
5537
5670
  var LEGACY_DEVICE_REDACTION = "***";
5538
- function isRecord$2(value) {
5671
+ function isRecord$5(value) {
5539
5672
  return typeof value === "object" && value !== null && !Array.isArray(value);
5540
5673
  }
5541
5674
  function makeSecretMarker(ref) {
@@ -5546,12 +5679,12 @@ function makeSecretMarker(ref) {
5546
5679
  }
5547
5680
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5548
5681
  function isSecretMarker(value) {
5549
- if (!isRecord$2(value)) return false;
5682
+ if (!isRecord$5(value)) return false;
5550
5683
  const ref = value["$secret"];
5551
5684
  return typeof ref === "string" && ref.length > 0;
5552
5685
  }
5553
5686
  function isSecretClear(value) {
5554
- return isRecord$2(value) && value["$secretClear"] === true;
5687
+ return isRecord$5(value) && value["$secretClear"] === true;
5555
5688
  }
5556
5689
  /**
5557
5690
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6161,7 +6294,7 @@ var KeychainWriteRefusedError = class extends Error {
6161
6294
  }
6162
6295
  };
6163
6296
  var KEEP = { kind: "keep" };
6164
- function isRecord$1(value) {
6297
+ function isRecord$4(value) {
6165
6298
  return typeof value === "object" && value !== null && !Array.isArray(value);
6166
6299
  }
6167
6300
  function defaultMintId() {
@@ -6174,7 +6307,7 @@ function collectSecretMarkerRefs(value, out = []) {
6174
6307
  return out;
6175
6308
  }
6176
6309
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6177
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6310
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6178
6311
  return out;
6179
6312
  }
6180
6313
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6229,7 +6362,7 @@ function rowId(row, idKey) {
6229
6362
  return null;
6230
6363
  }
6231
6364
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6232
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6365
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6233
6366
  if (!Array.isArray(incoming)) {
6234
6367
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6235
6368
  return {
@@ -6245,7 +6378,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6245
6378
  const kept = /* @__PURE__ */ new Set();
6246
6379
  const rows = [];
6247
6380
  for (const row of incoming) {
6248
- if (!isRecord$1(row)) {
6381
+ if (!isRecord$4(row)) {
6249
6382
  rows.push(row);
6250
6383
  continue;
6251
6384
  }
@@ -6270,7 +6403,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6270
6403
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6271
6404
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6272
6405
  case "object": {
6273
- if (!isRecord$1(incoming)) {
6406
+ if (!isRecord$4(incoming)) {
6274
6407
  if (incoming === void 0) return KEEP;
6275
6408
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6276
6409
  return {
@@ -6278,7 +6411,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6278
6411
  value: incoming
6279
6412
  };
6280
6413
  }
6281
- const storedObj = isRecord$1(stored) ? stored : {};
6414
+ const storedObj = isRecord$4(stored) ? stored : {};
6282
6415
  return {
6283
6416
  kind: "value",
6284
6417
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6401,7 +6534,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6401
6534
  value: items
6402
6535
  };
6403
6536
  }
6404
- if (isRecord$1(v)) {
6537
+ if (isRecord$4(v)) {
6405
6538
  const out = {};
6406
6539
  for (const [k, child] of Object.entries(v)) {
6407
6540
  const s = substitute(child);
@@ -6433,7 +6566,7 @@ var SecretOverwriteRefusedError = class extends Error {
6433
6566
  this.name = "SecretOverwriteRefusedError";
6434
6567
  }
6435
6568
  };
6436
- function isRecord(value) {
6569
+ function isRecord$3(value) {
6437
6570
  return typeof value === "object" && value !== null && !Array.isArray(value);
6438
6571
  }
6439
6572
  function resolvedValue(pass, marker) {
@@ -6462,7 +6595,7 @@ function inArray(pass, incoming, stored) {
6462
6595
  return incoming.map((item, index) => {
6463
6596
  const twin = stored[index];
6464
6597
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6465
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6598
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6466
6599
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6467
6600
  return item;
6468
6601
  });
@@ -6473,7 +6606,7 @@ function inArrayRow(pass, incoming, stored) {
6473
6606
  const twin = stored[key];
6474
6607
  if (isSecretMarker(twin)) {
6475
6608
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6476
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6609
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6477
6610
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6478
6611
  }
6479
6612
  return out;
@@ -6481,7 +6614,7 @@ function inArrayRow(pass, incoming, stored) {
6481
6614
  async function walk(pass, incoming, stored) {
6482
6615
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6483
6616
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6484
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6617
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6485
6618
  const out = { ...incoming };
6486
6619
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6487
6620
  return out;
@@ -6512,7 +6645,7 @@ async function restoreUnchangedSecrets(input) {
6512
6645
  function isJsonEqual(a, b) {
6513
6646
  if (Object.is(a, b)) return true;
6514
6647
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6515
- if (isRecord(a) && isRecord(b)) {
6648
+ if (isRecord$3(a) && isRecord$3(b)) {
6516
6649
  const keys = Object.keys(a);
6517
6650
  if (keys.length !== Object.keys(b).length) return false;
6518
6651
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6536,7 +6669,7 @@ function markerKeysOf(blob, owner) {
6536
6669
  }
6537
6670
  function nodeFromStored(value, owner) {
6538
6671
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6539
- if (!isRecord(value)) return null;
6672
+ if (!isRecord$3(value)) return null;
6540
6673
  const children = /* @__PURE__ */ new Map();
6541
6674
  for (const [key, child] of Object.entries(value)) {
6542
6675
  const node = nodeFromStored(child, owner);
@@ -7324,7 +7457,7 @@ var BaseAddon = class {
7324
7457
  if (!ctx) return;
7325
7458
  const addonId = ctx.id;
7326
7459
  setImmediate(() => {
7327
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7460
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7328
7461
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7329
7462
  }).catch((err) => {
7330
7463
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7818,6 +7951,355 @@ var PeerBytesTicketSchema = object({
7818
7951
  */
7819
7952
  declaredBytes: number().int().nonnegative().nullable()
7820
7953
  });
7954
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7955
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7956
+ var RECORD_DATABASES = ["settings", "events"];
7957
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7958
+ var RECORD_CLASSES = [
7959
+ "config",
7960
+ "ledger",
7961
+ "audit",
7962
+ "mirror",
7963
+ "ephemeral"
7964
+ ];
7965
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7966
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7967
+ var RECORD_BATCH_MAX = 1e3;
7968
+ var RECORD_QUERY_MAX = 1e3;
7969
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
7970
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
7971
+ var PREFIX = "records/";
7972
+ /** The base of every records failure. `detail` is the human part of the message. */
7973
+ var RecordsError = class extends Error {
7974
+ code;
7975
+ detail;
7976
+ constructor(code, detail) {
7977
+ super(`${PREFIX}${code}: ${detail}`);
7978
+ this.name = "RecordsError";
7979
+ this.code = code;
7980
+ this.detail = detail;
7981
+ }
7982
+ };
7983
+ /** The keychain could not store or serve a value: explicit, never an empty string. */
7984
+ var RecordSecretUnavailableError = class extends RecordsError {
7985
+ constructor(detail) {
7986
+ super("secret-unavailable", detail);
7987
+ this.name = "RecordSecretUnavailableError";
7988
+ }
7989
+ };
7990
+ var InvalidRecordError = class extends RecordsError {
7991
+ constructor(detail) {
7992
+ super("invalid-record", detail);
7993
+ this.name = "InvalidRecordError";
7994
+ }
7995
+ };
7996
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
7997
+ var DeclarationRefusedError = class extends RecordsError {
7998
+ constructor(detail) {
7999
+ super("declaration-refused", detail);
8000
+ this.name = "DeclarationRefusedError";
8001
+ }
8002
+ };
8003
+ function defOf(schema) {
8004
+ const zodBag = Reflect.get(schema, "_zod");
8005
+ if (typeof zodBag !== "object" || zodBag === null) return {};
8006
+ const def = Reflect.get(zodBag, "def");
8007
+ if (typeof def !== "object" || def === null) return {};
8008
+ return def;
8009
+ }
8010
+ function declaredHere(schema) {
8011
+ return globalRegistry.get(schema)?.secret === true;
8012
+ }
8013
+ /** Wrapper kinds whose `innerType` is the field itself. */
8014
+ var WRAPPERS = new Set([
8015
+ "optional",
8016
+ "nullable",
8017
+ "default",
8018
+ "prefault",
8019
+ "catch",
8020
+ "readonly",
8021
+ "nonoptional"
8022
+ ]);
8023
+ /**
8024
+ * The schema layers that make up ONE field: the schema itself and every
8025
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8026
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8027
+ * `.transform` on `in`).
8028
+ */
8029
+ function layersOf(schema) {
8030
+ const out = [];
8031
+ const queue = [schema];
8032
+ while (queue.length > 0) {
8033
+ const s = queue.shift();
8034
+ if (!s || out.includes(s)) continue;
8035
+ out.push(s);
8036
+ const def = defOf(s);
8037
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8038
+ if (def.type === "pipe") {
8039
+ if (def.in) queue.push(def.in);
8040
+ if (def.out) queue.push(def.out);
8041
+ }
8042
+ }
8043
+ return out;
8044
+ }
8045
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8046
+ function isZodSecret(schema) {
8047
+ return layersOf(schema).some(declaredHere);
8048
+ }
8049
+ /**
8050
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8051
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8052
+ * object or array is reported as one path and not descended into — everything
8053
+ * under it is secret.
8054
+ */
8055
+ function collectZodSecretPaths(schema, prefix = "") {
8056
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8057
+ const paths = [];
8058
+ for (const layer of layersOf(schema)) {
8059
+ const def = defOf(layer);
8060
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8061
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8062
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8063
+ else if (def.type === "intersection") {
8064
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8065
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8066
+ }
8067
+ }
8068
+ return [...new Set(paths)];
8069
+ }
8070
+ /**
8071
+ * Secret fields of a record, addressed the way a Zod schema declares them
8072
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8073
+ * (`auth.accessToken`, `headers[].value`).
8074
+ *
8075
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8076
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8077
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8078
+ * leaf names its element: `headers[X-Api].value`.
8079
+ *
8080
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8081
+ */
8082
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8083
+ function parseSecretPath(path) {
8084
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8085
+ return path.split(".").map((raw) => {
8086
+ const each = raw.endsWith("[]");
8087
+ const key = each ? raw.slice(0, -2) : raw;
8088
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8089
+ return {
8090
+ key,
8091
+ each
8092
+ };
8093
+ });
8094
+ }
8095
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8096
+ function secretArrayPrefixes(path) {
8097
+ const segments = parseSecretPath(path);
8098
+ const prefixes = [];
8099
+ const walked = [];
8100
+ for (const segment of segments) {
8101
+ walked.push(segment.key);
8102
+ if (segment.each) prefixes.push(walked.join("."));
8103
+ }
8104
+ return prefixes;
8105
+ }
8106
+ /**
8107
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8108
+ * Zod row schema that describes it, and the helper that turns the two into the
8109
+ * JSON the engine stores.
8110
+ *
8111
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8112
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8113
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
8114
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
8115
+ * never a field name (D879).
8116
+ */
8117
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
8118
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
8119
+ var RecordIndexSchema = object({
8120
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
8121
+ fields: array(RecordFieldPathSchema).min(1).max(4),
8122
+ unique: boolean().optional()
8123
+ }).strict();
8124
+ var RecordRetentionSchema = union([
8125
+ object({
8126
+ ttlMs: number().int().positive(),
8127
+ from: _enum(["at", "write"])
8128
+ }).strict(),
8129
+ object({
8130
+ maxRows: number().int().positive().optional(),
8131
+ maxRowsPerDevice: number().int().positive().optional()
8132
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
8133
+ object({
8134
+ owner: string().min(1),
8135
+ reason: string().min(1)
8136
+ }).strict(),
8137
+ object({ none: string().min(1) }).strict()
8138
+ ]);
8139
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
8140
+ var EntryDescriptorSchema = object({
8141
+ title: string().min(1),
8142
+ /** The record body field shown as the entry's name. */
8143
+ nameField: string().min(1),
8144
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
8145
+ fields: record(string(), unknown())
8146
+ }).strict();
8147
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
8148
+ var RecordKindDeclarationSchema = object({
8149
+ database: _enum(RECORD_DATABASES).default("settings"),
8150
+ class: _enum(RECORD_CLASSES),
8151
+ writeTrigger: string().min(1),
8152
+ device: _enum([
8153
+ "required",
8154
+ "optional",
8155
+ "none"
8156
+ ]).default("none"),
8157
+ at: _enum(["required", "none"]).default("none"),
8158
+ indexes: array(RecordIndexSchema).max(8).default([]),
8159
+ retention: RecordRetentionSchema,
8160
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
8161
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
8162
+ /** Derived from the Zod schema; never written by hand. */
8163
+ secretPaths: array(string().min(1)).default([]),
8164
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
8165
+ secretArrayKeys: record(string(), string()).default({}),
8166
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
8167
+ adoptsFrom: string().min(1).optional(),
8168
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
8169
+ transactFamily: string().min(1).optional(),
8170
+ entry: EntryDescriptorSchema.optional()
8171
+ }).strict();
8172
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8173
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8174
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8175
+ function assertValidDeclaration(name, decl) {
8176
+ const refuse = (why) => {
8177
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8178
+ };
8179
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8180
+ const seen = /* @__PURE__ */ new Set();
8181
+ for (const index of decl.indexes) {
8182
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8183
+ seen.add(index.name);
8184
+ }
8185
+ const { retention } = decl;
8186
+ const hasSecrets = decl.secretPaths.length > 0;
8187
+ if ("ttlMs" in retention) {
8188
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8189
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8190
+ }
8191
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8192
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8193
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8194
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8195
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8196
+ 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)`);
8197
+ }
8198
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8199
+ 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`);
8200
+ }
8201
+ function bodyFieldsOf(schema) {
8202
+ return { ...toJSONSchema(schema, {
8203
+ unrepresentable: "any",
8204
+ io: "input"
8205
+ }) };
8206
+ }
8207
+ function isRecordLike(value) {
8208
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8209
+ }
8210
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8211
+ function hasNameField(json, field) {
8212
+ const branches = json["oneOf"] ?? json["anyOf"];
8213
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8214
+ const properties = json["properties"];
8215
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8216
+ }
8217
+ /**
8218
+ * Declare the kinds of a package. The keys are the kind names. The result is
8219
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8220
+ * types its handle from.
8221
+ */
8222
+ function defineRecordKinds(specs) {
8223
+ const out = {};
8224
+ for (const [name, spec] of Object.entries(specs)) {
8225
+ const secretPaths = collectZodSecretPaths(spec.schema);
8226
+ const nameField = spec.entry?.nameField ?? "name";
8227
+ const fields = bodyFieldsOf(spec.schema);
8228
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8229
+ const parsed = RecordKindDeclarationSchema.parse({
8230
+ database: spec.database,
8231
+ class: spec.class,
8232
+ writeTrigger: spec.writeTrigger,
8233
+ device: spec.device,
8234
+ at: spec.at,
8235
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8236
+ retention: spec.retention,
8237
+ deviceRemoval: spec.deviceRemoval,
8238
+ maxDataBytes: spec.maxDataBytes,
8239
+ secretPaths: [...secretPaths],
8240
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8241
+ adoptsFrom: spec.adoptsFrom,
8242
+ transactFamily: spec.transactFamily,
8243
+ entry: spec.entry === void 0 ? void 0 : {
8244
+ title: spec.entry.title,
8245
+ nameField,
8246
+ fields
8247
+ }
8248
+ });
8249
+ assertValidDeclaration(name, parsed);
8250
+ out[name] = {
8251
+ name,
8252
+ schema: spec.schema,
8253
+ declaration: parsed
8254
+ };
8255
+ }
8256
+ return out;
8257
+ }
8258
+ /**
8259
+ * Entry kinds (D881): every list of user-created entries (notification
8260
+ * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
8261
+ * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
8262
+ * through the `record-entries` capability with password fields derived from
8263
+ * the schema (`.meta({ secret: true })`).
8264
+ */
8265
+ /** The body of a plain entry: a name and the fields the kind adds. */
8266
+ function entryBody(shape) {
8267
+ return object({
8268
+ name: string().min(1),
8269
+ ...shape
8270
+ });
8271
+ }
8272
+ /**
8273
+ * Declare one entry kind. An entry is configuration: never trimmed by the
8274
+ * engine, never aged, belonging to no device.
8275
+ */
8276
+ function defineEntryKind(name, spec) {
8277
+ const defined = defineRecordKinds({ [name]: {
8278
+ schema: spec.schema,
8279
+ class: "config",
8280
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
8281
+ retention: { none: "an entry goes only when the operator deletes it" },
8282
+ ...spec.database === void 0 ? {} : { database: spec.database },
8283
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
8284
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
8285
+ ...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
8286
+ entry: {
8287
+ title: spec.title,
8288
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
8289
+ }
8290
+ } })[name];
8291
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
8292
+ return defined;
8293
+ }
8294
+ /**
8295
+ * Legacy source for entry adoption (B3): a list stored under addon-settings
8296
+ * `<addonId>.<key>` until records-adopt copies rows into the entry kind.
8297
+ */
8298
+ var SETTINGS_ARRAY_ADOPTS_PREFIX = "@settings-array/";
8299
+ /** The `adoptsFrom` value for an addon-settings array field. */
8300
+ function settingsArrayAdoptsFrom(addonId, settingsKey) {
8301
+ return `${SETTINGS_ARRAY_ADOPTS_PREFIX}${addonId}/${settingsKey}`;
8302
+ }
7821
8303
  /** Shared Zod schemas used across streaming capabilities. */
7822
8304
  var CamProfileSchema = _enum([
7823
8305
  "high",
@@ -8305,7 +8787,7 @@ object({
8305
8787
  params: record(string(), union([string(), number()])).optional()
8306
8788
  });
8307
8789
  //#endregion
8308
- //#region ../types/dist/err-msg--2RrYiLO.mjs
8790
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8309
8791
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8310
8792
  DeviceType["Camera"] = "camera";
8311
8793
  DeviceType["Hub"] = "hub";
@@ -8397,6 +8879,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8397
8879
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8398
8880
  * integrations sharing the same food/desiccant/hopper surface. */
8399
8881
  DeviceType["PetFeeder"] = "pet-feeder";
8882
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8883
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8884
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8885
+ DeviceType["Dishwasher"] = "dishwasher";
8400
8886
  return DeviceType;
8401
8887
  }({});
8402
8888
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8644,7 +9130,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8644
9130
  return DeviceRole;
8645
9131
  }({});
8646
9132
  //#endregion
8647
- //#region ../types/dist/composition-DOwQB_Ua.mjs
9133
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8648
9134
  /**
8649
9135
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8650
9136
  *
@@ -13030,8 +13516,13 @@ var AlertSeveritySchema = _enum([
13030
13516
  "info",
13031
13517
  "success",
13032
13518
  "warning",
13033
- "error"
13519
+ "error",
13520
+ "critical"
13034
13521
  ]);
13522
+ var AlertActionSchema = object({
13523
+ label: string(),
13524
+ href: string().optional()
13525
+ });
13035
13526
  var AlertStatusSchema = _enum([
13036
13527
  "active",
13037
13528
  "in-progress",
@@ -13049,6 +13540,7 @@ var AlertSchema = object({
13049
13540
  severity: AlertSeveritySchema,
13050
13541
  title: string(),
13051
13542
  message: string(),
13543
+ action: AlertActionSchema.optional(),
13052
13544
  status: AlertStatusSchema,
13053
13545
  progress: number().optional(),
13054
13546
  read: boolean(),
@@ -16004,6 +16496,222 @@ id: union([string(), number()]) }), {
16004
16496
  kind: "mutation",
16005
16497
  auth: "admin"
16006
16498
  });
16499
+ /**
16500
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16501
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16502
+ * (operator intent, D870) and device-history (numbers over time, D850).
16503
+ *
16504
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16505
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16506
+ * that with the addon id closed over). It is deliberately NOT in any input
16507
+ * schema, so a session can never supply it, and a call with no stamp is refused
16508
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16509
+ * addons go through the owner's capability.
16510
+ *
16511
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16512
+ * never `[]`. Secret fields are never on the wire: a read shows the
16513
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16514
+ * resolves itself, and a write may carry only a keychain marker bound to the
16515
+ * row's own ref.
16516
+ *
16517
+ * Internal: addons reach it through `ctx.records`, never directly.
16518
+ */
16519
+ var RecordIdSchema = string().min(1).max(256);
16520
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16521
+ var RecordBodySchema = record(string(), unknown());
16522
+ var RecordInputSchema = object({
16523
+ id: RecordIdSchema,
16524
+ /** The device this row belongs to (D865 removal, per-device reads). */
16525
+ deviceId: number().int().optional(),
16526
+ /** The domain clock, ms: observed / created / opened. */
16527
+ at: number().int().optional(),
16528
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16529
+ expiresAt: number().int().optional(),
16530
+ data: RecordBodySchema
16531
+ });
16532
+ var RecordViewSchema = object({
16533
+ id: string(),
16534
+ deviceId: number().int().nullable(),
16535
+ at: number().nullable(),
16536
+ expiresAt: number().nullable(),
16537
+ rev: number().int(),
16538
+ updatedAt: number(),
16539
+ data: RecordBodySchema
16540
+ });
16541
+ /** Declared index fields only. Anything else does not compile, by design. */
16542
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16543
+ string(),
16544
+ number(),
16545
+ boolean(),
16546
+ object({ in: array(union([
16547
+ string(),
16548
+ number(),
16549
+ boolean()
16550
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16551
+ object({
16552
+ gt: union([string(), number()]).optional(),
16553
+ gte: union([string(), number()]).optional(),
16554
+ lt: union([string(), number()]).optional(),
16555
+ lte: union([string(), number()]).optional()
16556
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16557
+ ]));
16558
+ var KindShape = { kind: RecordKindNameSchema };
16559
+ var TimeWindowShape = {
16560
+ deviceId: number().int().optional(),
16561
+ atFrom: number().optional(),
16562
+ atTo: number().optional()
16563
+ };
16564
+ var RecordQueryInputSchema = object({
16565
+ ...KindShape,
16566
+ ...TimeWindowShape,
16567
+ where: RecordWhereSchema.optional(),
16568
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16569
+ order: _enum(["at", "id"]).optional(),
16570
+ desc: boolean().optional(),
16571
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16572
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16573
+ cursor: string().min(1).optional()
16574
+ });
16575
+ var RecordQueryResultSchema = object({
16576
+ records: array(RecordViewSchema),
16577
+ nextCursor: string().nullable()
16578
+ });
16579
+ var RecordKindStateSchema = _enum([
16580
+ "created",
16581
+ "unchanged",
16582
+ "updated"
16583
+ ]);
16584
+ var DeclareKindResultSchema = object({
16585
+ kindId: number().int(),
16586
+ state: RecordKindStateSchema,
16587
+ createdIndexes: array(string()),
16588
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16589
+ adoptionPending: object({
16590
+ legacyTable: string(),
16591
+ legacyRows: number().int()
16592
+ }).nullable()
16593
+ });
16594
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16595
+ var SecretRefsList = array(string());
16596
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16597
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16598
+ kind: "mutation",
16599
+ auth: "admin"
16600
+ }), method(object({
16601
+ ...KindShape,
16602
+ id: RecordIdSchema
16603
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16604
+ ...KindShape,
16605
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16606
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16607
+ ...KindShape,
16608
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16609
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16610
+ ...KindShape,
16611
+ record: RecordInputSchema,
16612
+ /** Compare-and-set. `0` means "the row must not exist". */
16613
+ ifRev: number().int().min(0).optional()
16614
+ }), object({
16615
+ rev: number().int(),
16616
+ releasedRefs: SecretRefsList
16617
+ }), {
16618
+ kind: "mutation",
16619
+ auth: "admin"
16620
+ }), method(object({
16621
+ ...KindShape,
16622
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16623
+ }), object({
16624
+ count: number().int(),
16625
+ releasedRefs: SecretRefsList
16626
+ }), {
16627
+ kind: "mutation",
16628
+ auth: "admin"
16629
+ }), method(object({
16630
+ ...KindShape,
16631
+ id: RecordIdSchema,
16632
+ data: RecordBodySchema,
16633
+ at: number().int().nullable().optional(),
16634
+ expiresAt: number().int().nullable().optional(),
16635
+ ifRev: number().int().min(1).optional()
16636
+ }), object({
16637
+ rev: number().int(),
16638
+ releasedRefs: SecretRefsList
16639
+ }), {
16640
+ kind: "mutation",
16641
+ auth: "admin"
16642
+ }), method(object({
16643
+ ...KindShape,
16644
+ id: RecordIdSchema
16645
+ }), object({
16646
+ deleted: boolean(),
16647
+ secretRefs: SecretRefsList
16648
+ }), {
16649
+ kind: "mutation",
16650
+ auth: "admin"
16651
+ }), method(object({
16652
+ ...KindShape,
16653
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16654
+ }), object({
16655
+ deleted: number().int(),
16656
+ secretRefs: SecretRefsList
16657
+ }), {
16658
+ kind: "mutation",
16659
+ auth: "admin"
16660
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16661
+ ...KindShape,
16662
+ ...TimeWindowShape,
16663
+ where: RecordWhereSchema.optional()
16664
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16665
+ ...KindShape,
16666
+ deviceId: number().int().optional(),
16667
+ from: number(),
16668
+ to: number(),
16669
+ bucketMs: number().int().positive()
16670
+ }), object({ buckets: array(object({
16671
+ bucketStart: number(),
16672
+ count: number().int()
16673
+ })) }), { auth: "admin" }), method(object({
16674
+ ...KindShape,
16675
+ op: _enum([
16676
+ "sum",
16677
+ "min",
16678
+ "max",
16679
+ "count"
16680
+ ]),
16681
+ field: RecordFieldPathSchema.optional(),
16682
+ groupBy: RecordFieldPathSchema.optional(),
16683
+ where: RecordWhereSchema.optional()
16684
+ }), object({ rows: array(object({
16685
+ group: union([
16686
+ string(),
16687
+ number(),
16688
+ _null()
16689
+ ]),
16690
+ value: number().nullable()
16691
+ })) }), { auth: "admin" }), method(object({
16692
+ ...KindShape,
16693
+ deviceId: number().int().optional(),
16694
+ atBefore: number().optional(),
16695
+ where: RecordWhereSchema.optional()
16696
+ }), object({
16697
+ deleted: number().int(),
16698
+ secretRefs: SecretRefsList
16699
+ }), {
16700
+ kind: "mutation",
16701
+ auth: "admin"
16702
+ }), method(object({
16703
+ deviceId: number().int(),
16704
+ kinds: array(RecordKindNameSchema).optional()
16705
+ }), object({
16706
+ deleted: record(string(), number().int()),
16707
+ secretRefs: SecretRefsList
16708
+ }), {
16709
+ kind: "mutation",
16710
+ auth: "admin"
16711
+ }), method(object(KindShape), object({ id: number().int() }), {
16712
+ kind: "mutation",
16713
+ auth: "admin"
16714
+ });
16007
16715
  /** One table of the settings database. */
16008
16716
  var StorageTableSchema = object({
16009
16717
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -16016,6 +16724,28 @@ var StorageTableSchema = object({
16016
16724
  /** Declared by an addon since this engine process started (a running addon claims it). */
16017
16725
  declaredThisBoot: boolean()
16018
16726
  });
16727
+ /** One declared record kind (D881) as System -> Data shows it. */
16728
+ var StorageKindSchema = object({
16729
+ owner: string(),
16730
+ kind: string(),
16731
+ database: _enum(["settings", "events"]),
16732
+ class: string(),
16733
+ state: _enum([
16734
+ "declared",
16735
+ "orphaned",
16736
+ "dropped"
16737
+ ]),
16738
+ /** `null` when the caller asked for no counts (`counts: false`). */
16739
+ rows: number().int().nonnegative().nullable(),
16740
+ /** Rows x the average size of a sample; null for an empty kind. */
16741
+ bytesEstimate: number().int().nonnegative().nullable(),
16742
+ writeTrigger: string(),
16743
+ retention: RecordRetentionSchema,
16744
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16745
+ entry: boolean(),
16746
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16747
+ declaration: RecordKindDeclarationSchema
16748
+ });
16019
16749
  method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16020
16750
  collection: string().min(1),
16021
16751
  expectRows: number().int().nonnegative()
@@ -16025,6 +16755,87 @@ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: arr
16025
16755
  }), {
16026
16756
  kind: "mutation",
16027
16757
  auth: "admin"
16758
+ }), method(object({
16759
+ owner: string().min(1).optional(),
16760
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16761
+ counts: boolean().optional()
16762
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16763
+ owner: string().min(1),
16764
+ kind: RecordKindNameSchema
16765
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16766
+ owner: string().min(1),
16767
+ kind: RecordKindNameSchema,
16768
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16769
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16770
+ complete: boolean().optional()
16771
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16772
+ kind: "mutation",
16773
+ auth: "admin"
16774
+ }), method(object({
16775
+ collection: string().min(1),
16776
+ cursor: string().optional(),
16777
+ limit: number().int().min(1).max(1e3).optional()
16778
+ }), object({
16779
+ rows: array(object({
16780
+ id: string(),
16781
+ data: record(string(), unknown())
16782
+ })),
16783
+ nextCursor: string().nullable()
16784
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16785
+ /**
16786
+ * record-entries - the ONE admin surface for every list of user-created entries
16787
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16788
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16789
+ *
16790
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16791
+ * the entry body with `secret: true` on every credential field, so a password
16792
+ * field is derived from the schema and never from a name. `putEntry` takes the
16793
+ * redaction token for an untouched secret (the stored value is kept), a string
16794
+ * for a new one, and the clear instruction to remove one. A read never carries
16795
+ * a secret value, and a locked keychain refuses the write with
16796
+ * `records/secret-unavailable` instead of storing plaintext.
16797
+ *
16798
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16799
+ */
16800
+ var EntryKindInfoSchema = object({
16801
+ owner: string(),
16802
+ kind: RecordKindNameSchema,
16803
+ title: string(),
16804
+ nameField: string(),
16805
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16806
+ fields: record(string(), unknown()),
16807
+ secretPaths: array(string()),
16808
+ rows: number().int().nonnegative()
16809
+ });
16810
+ var EntryViewSchema = object({
16811
+ id: RecordIdSchema,
16812
+ name: string(),
16813
+ rev: number().int(),
16814
+ updatedAt: number(),
16815
+ /** Secret fields hold the redaction token. */
16816
+ data: RecordBodySchema
16817
+ });
16818
+ var EntryAddress = {
16819
+ owner: string().min(1),
16820
+ kind: RecordKindNameSchema
16821
+ };
16822
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16823
+ ...EntryAddress,
16824
+ id: RecordIdSchema.optional(),
16825
+ data: RecordBodySchema,
16826
+ ifRev: number().int().min(1).optional()
16827
+ }), object({
16828
+ id: string(),
16829
+ rev: number().int()
16830
+ }), {
16831
+ kind: "mutation",
16832
+ auth: "admin"
16833
+ }), method(object({
16834
+ ...EntryAddress,
16835
+ id: RecordIdSchema
16836
+ }), object({ deleted: boolean() }), {
16837
+ kind: "mutation",
16838
+ auth: "admin"
16028
16839
  });
16029
16840
  /**
16030
16841
  * `keychain` — the hub's encrypted store of secret values (D787).
@@ -16874,7 +17685,11 @@ DeviceType.Hub, DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number().int
16874
17685
  });
16875
17686
  /**
16876
17687
  * `device-adoption` — generic discovery + adoption surface,
16877
- * system-scoped singleton. The de-HA-ified successor to `ha-discovery`:
17688
+ * system-scoped collection (one provider per integration addon), routed
17689
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
17690
+ * pin model as `connection-test`. The admin UI keeps using
17691
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
17692
+ * successor to `ha-discovery`:
16878
17693
  * keyed by `integrationId` (the addon resolves integrationId → broker
16879
17694
  * internally) rather than a connection-specific `brokerId`, and it
16880
17695
  * REUSES the shared `DiscoveredChildDevice` candidate type from
@@ -52664,7 +53479,7 @@ var BatteryStatusSchema = object({
52664
53479
  */
52665
53480
  binary: boolean().optional()
52666
53481
  });
52667
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, method(object({
53482
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, method(object({
52668
53483
  deviceId: number(),
52669
53484
  /** Bound on the wait. Sensible range 3000–10000ms. */
52670
53485
  timeoutMs: number().int().min(500).max(3e4).default(8e3)
@@ -53550,6 +54365,130 @@ object({
53550
54365
  deviceId: number(),
53551
54366
  status: DeviceStatusSchema
53552
54367
  });
54368
+ /**
54369
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
54370
+ * consumable levels (salt, rinse aid) and common program options.
54371
+ *
54372
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
54373
+ * by any integration that exposes the same program / option surface.
54374
+ *
54375
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
54376
+ * provider refreshes the slice on an interval and eagerly after commands.
54377
+ */
54378
+ var DishwasherStateSchema = _enum([
54379
+ "idle",
54380
+ "running",
54381
+ "paused",
54382
+ "finished",
54383
+ "error",
54384
+ "unavailable"
54385
+ ]);
54386
+ var DishwasherConsumableLevelSchema = _enum([
54387
+ "ok",
54388
+ "low",
54389
+ "empty"
54390
+ ]);
54391
+ object({
54392
+ state: DishwasherStateSchema,
54393
+ /** Active program id/name, or null when none selected / unknown. */
54394
+ program: string().nullable(),
54395
+ /** Program tokens the hardware accepts — drives the UI selector. */
54396
+ availablePrograms: array(string()),
54397
+ /** Minutes remaining on the active cycle, or null when not running. */
54398
+ remainingMinutes: number().int().nonnegative().nullable(),
54399
+ /** Cycle completion 0..100, or null when not applicable. */
54400
+ progressPercent: number().min(0).max(100).nullable(),
54401
+ /** True when the door is reported open. */
54402
+ doorOpen: boolean(),
54403
+ /** True when remote start is allowed (door closed, power on, etc.). */
54404
+ remoteStartAllowed: boolean(),
54405
+ /** Main power / switched-on state. */
54406
+ powerOn: boolean(),
54407
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
54408
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
54409
+ halfLoad: boolean(),
54410
+ hygienePlus: boolean(),
54411
+ /** Extra dry option when the appliance exposes it. */
54412
+ extraDry: boolean(),
54413
+ /** Intensive zone (lower basket) when the appliance exposes it. */
54414
+ intensiveZone: boolean(),
54415
+ /** VarioSpeed / VarioSpeed+ when the appliance exposes it. */
54416
+ varioSpeedPlus: boolean(),
54417
+ /** Child lock (controls disabled on the appliance). */
54418
+ childLock: boolean(),
54419
+ errorCode: number().nullable(),
54420
+ errorLabel: string().nullable(),
54421
+ lastFetchedAt: number()
54422
+ });
54423
+ DeviceType.Dishwasher, method(object({ deviceId: number().int().nonnegative() }), _void(), {
54424
+ kind: "mutation",
54425
+ auth: "protected"
54426
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
54427
+ kind: "mutation",
54428
+ auth: "protected"
54429
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
54430
+ kind: "mutation",
54431
+ auth: "protected"
54432
+ }), method(object({
54433
+ deviceId: number().int().nonnegative(),
54434
+ program: string().min(1)
54435
+ }), _void(), {
54436
+ kind: "mutation",
54437
+ auth: "protected"
54438
+ }), method(object({
54439
+ deviceId: number().int().nonnegative(),
54440
+ on: boolean()
54441
+ }), _void(), {
54442
+ kind: "mutation",
54443
+ auth: "protected"
54444
+ }), method(object({
54445
+ deviceId: number().int().nonnegative(),
54446
+ on: boolean()
54447
+ }), _void(), {
54448
+ kind: "mutation",
54449
+ auth: "protected"
54450
+ }), method(object({
54451
+ deviceId: number().int().nonnegative(),
54452
+ on: boolean()
54453
+ }), _void(), {
54454
+ kind: "mutation",
54455
+ auth: "protected"
54456
+ }), method(object({
54457
+ deviceId: number().int().nonnegative(),
54458
+ on: boolean()
54459
+ }), _void(), {
54460
+ kind: "mutation",
54461
+ auth: "protected"
54462
+ }), method(object({
54463
+ deviceId: number().int().nonnegative(),
54464
+ on: boolean()
54465
+ }), _void(), {
54466
+ kind: "mutation",
54467
+ auth: "protected"
54468
+ }), method(object({
54469
+ deviceId: number().int().nonnegative(),
54470
+ on: boolean()
54471
+ }), _void(), {
54472
+ kind: "mutation",
54473
+ auth: "protected"
54474
+ }), method(object({
54475
+ deviceId: number().int().nonnegative(),
54476
+ on: boolean()
54477
+ }), _void(), {
54478
+ kind: "mutation",
54479
+ auth: "protected"
54480
+ }), method(object({
54481
+ deviceId: number().int().nonnegative(),
54482
+ key: string().min(1),
54483
+ value: union([
54484
+ boolean(),
54485
+ string(),
54486
+ number()
54487
+ ])
54488
+ }), _void(), {
54489
+ kind: "mutation",
54490
+ auth: "protected"
54491
+ });
53553
54492
  object({
53554
54493
  /** Ms epoch of the last press. null = never observed since this provider started. */
53555
54494
  lastPressedAt: number().nullable(),
@@ -54115,6 +55054,13 @@ object({
54115
55054
  lastChangedAt: number()
54116
55055
  });
54117
55056
  DeviceType.Sensor;
55057
+ object({
55058
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
55059
+ position: number().min(0).max(100).nullable(),
55060
+ /** Ms epoch when the slice was last updated (push or poll). */
55061
+ lastFetchedAt: number()
55062
+ });
55063
+ DeviceType.Thermostat;
54118
55064
  object({
54119
55065
  /** Whether the humidifier is currently on. */
54120
55066
  on: boolean(),
@@ -61181,7 +62127,7 @@ var AccessoryKind = {
61181
62127
  PrivacyMask: DeviceRole.PrivacyMask
61182
62128
  };
61183
62129
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
61184
- 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;
62130
+ 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;
61185
62131
  new Set(Object.values(DeviceType));
61186
62132
  Object.freeze({
61187
62133
  "accessories.getStatus": {
@@ -63602,6 +64548,84 @@ Object.freeze({
63602
64548
  addonId: null,
63603
64549
  access: "view"
63604
64550
  },
64551
+ "dishwasher.getStatus": {
64552
+ capName: "dishwasher",
64553
+ capScope: "device",
64554
+ addonId: null,
64555
+ access: "view"
64556
+ },
64557
+ "dishwasher.pause": {
64558
+ capName: "dishwasher",
64559
+ capScope: "device",
64560
+ addonId: null,
64561
+ access: "create"
64562
+ },
64563
+ "dishwasher.setChildLock": {
64564
+ capName: "dishwasher",
64565
+ capScope: "device",
64566
+ addonId: null,
64567
+ access: "create"
64568
+ },
64569
+ "dishwasher.setExtraDry": {
64570
+ capName: "dishwasher",
64571
+ capScope: "device",
64572
+ addonId: null,
64573
+ access: "create"
64574
+ },
64575
+ "dishwasher.setHalfLoad": {
64576
+ capName: "dishwasher",
64577
+ capScope: "device",
64578
+ addonId: null,
64579
+ access: "create"
64580
+ },
64581
+ "dishwasher.setHygienePlus": {
64582
+ capName: "dishwasher",
64583
+ capScope: "device",
64584
+ addonId: null,
64585
+ access: "create"
64586
+ },
64587
+ "dishwasher.setIntensiveZone": {
64588
+ capName: "dishwasher",
64589
+ capScope: "device",
64590
+ addonId: null,
64591
+ access: "create"
64592
+ },
64593
+ "dishwasher.setOption": {
64594
+ capName: "dishwasher",
64595
+ capScope: "device",
64596
+ addonId: null,
64597
+ access: "create"
64598
+ },
64599
+ "dishwasher.setPower": {
64600
+ capName: "dishwasher",
64601
+ capScope: "device",
64602
+ addonId: null,
64603
+ access: "create"
64604
+ },
64605
+ "dishwasher.setProgram": {
64606
+ capName: "dishwasher",
64607
+ capScope: "device",
64608
+ addonId: null,
64609
+ access: "create"
64610
+ },
64611
+ "dishwasher.setVarioSpeedPlus": {
64612
+ capName: "dishwasher",
64613
+ capScope: "device",
64614
+ addonId: null,
64615
+ access: "create"
64616
+ },
64617
+ "dishwasher.start": {
64618
+ capName: "dishwasher",
64619
+ capScope: "device",
64620
+ addonId: null,
64621
+ access: "create"
64622
+ },
64623
+ "dishwasher.stop": {
64624
+ capName: "dishwasher",
64625
+ capScope: "device",
64626
+ addonId: null,
64627
+ access: "create"
64628
+ },
63605
64629
  "doorbell.getStatus": {
63606
64630
  capName: "doorbell",
63607
64631
  capScope: "device",
@@ -63812,6 +64836,12 @@ Object.freeze({
63812
64836
  addonId: null,
63813
64837
  access: "view"
63814
64838
  },
64839
+ "heatingValve.getStatus": {
64840
+ capName: "heating-valve",
64841
+ capScope: "device",
64842
+ addonId: null,
64843
+ access: "view"
64844
+ },
63815
64845
  "humidifier.getStatus": {
63816
64846
  capName: "humidifier",
63817
64847
  capScope: "device",
@@ -67088,6 +68118,30 @@ Object.freeze({
67088
68118
  addonId: null,
67089
68119
  access: "create"
67090
68120
  },
68121
+ "recordEntries.deleteEntry": {
68122
+ capName: "record-entries",
68123
+ capScope: "system",
68124
+ addonId: null,
68125
+ access: "delete"
68126
+ },
68127
+ "recordEntries.listEntries": {
68128
+ capName: "record-entries",
68129
+ capScope: "system",
68130
+ addonId: null,
68131
+ access: "view"
68132
+ },
68133
+ "recordEntries.listEntryKinds": {
68134
+ capName: "record-entries",
68135
+ capScope: "system",
68136
+ addonId: null,
68137
+ access: "view"
68138
+ },
68139
+ "recordEntries.putEntry": {
68140
+ capName: "record-entries",
68141
+ capScope: "system",
68142
+ addonId: null,
68143
+ access: "create"
68144
+ },
67091
68145
  "recording.getAvailability": {
67092
68146
  capName: "recording",
67093
68147
  capScope: "device",
@@ -67388,6 +68442,102 @@ Object.freeze({
67388
68442
  addonId: null,
67389
68443
  access: "view"
67390
68444
  },
68445
+ "records.aggregate": {
68446
+ capName: "records",
68447
+ capScope: "system",
68448
+ addonId: null,
68449
+ access: "view"
68450
+ },
68451
+ "records.allocateId": {
68452
+ capName: "records",
68453
+ capScope: "system",
68454
+ addonId: null,
68455
+ access: "create"
68456
+ },
68457
+ "records.count": {
68458
+ capName: "records",
68459
+ capScope: "system",
68460
+ addonId: null,
68461
+ access: "view"
68462
+ },
68463
+ "records.declareKinds": {
68464
+ capName: "records",
68465
+ capScope: "system",
68466
+ addonId: null,
68467
+ access: "create"
68468
+ },
68469
+ "records.delete": {
68470
+ capName: "records",
68471
+ capScope: "system",
68472
+ addonId: null,
68473
+ access: "delete"
68474
+ },
68475
+ "records.deleteDevice": {
68476
+ capName: "records",
68477
+ capScope: "system",
68478
+ addonId: null,
68479
+ access: "delete"
68480
+ },
68481
+ "records.deleteMany": {
68482
+ capName: "records",
68483
+ capScope: "system",
68484
+ addonId: null,
68485
+ access: "delete"
68486
+ },
68487
+ "records.deleteWhere": {
68488
+ capName: "records",
68489
+ capScope: "system",
68490
+ addonId: null,
68491
+ access: "delete"
68492
+ },
68493
+ "records.get": {
68494
+ capName: "records",
68495
+ capScope: "system",
68496
+ addonId: null,
68497
+ access: "view"
68498
+ },
68499
+ "records.getMany": {
68500
+ capName: "records",
68501
+ capScope: "system",
68502
+ addonId: null,
68503
+ access: "view"
68504
+ },
68505
+ "records.histogram": {
68506
+ capName: "records",
68507
+ capScope: "system",
68508
+ addonId: null,
68509
+ access: "view"
68510
+ },
68511
+ "records.patch": {
68512
+ capName: "records",
68513
+ capScope: "system",
68514
+ addonId: null,
68515
+ access: "create"
68516
+ },
68517
+ "records.put": {
68518
+ capName: "records",
68519
+ capScope: "system",
68520
+ addonId: null,
68521
+ access: "create"
68522
+ },
68523
+ "records.putMany": {
68524
+ capName: "records",
68525
+ capScope: "system",
68526
+ addonId: null,
68527
+ access: "create"
68528
+ },
68529
+ "records.query": {
68530
+ capName: "records",
68531
+ capScope: "system",
68532
+ addonId: null,
68533
+ access: "view"
68534
+ },
68535
+ "records.secretRefs": {
68536
+ capName: "records",
68537
+ capScope: "system",
68538
+ addonId: null,
68539
+ access: "view"
68540
+ },
67391
68541
  "sceneMonitor.captureReference": {
67392
68542
  capName: "scene-monitor",
67393
68543
  capScope: "device",
@@ -67820,18 +68970,48 @@ Object.freeze({
67820
68970
  addonId: null,
67821
68971
  access: "create"
67822
68972
  },
68973
+ "storageAdmin.adoptRecords": {
68974
+ capName: "storage-admin",
68975
+ capScope: "system",
68976
+ addonId: null,
68977
+ access: "create"
68978
+ },
67823
68979
  "storageAdmin.dropCollection": {
67824
68980
  capName: "storage-admin",
67825
68981
  capScope: "system",
67826
68982
  addonId: null,
67827
68983
  access: "delete"
67828
68984
  },
68985
+ "storageAdmin.isAdoptedLegacyTable": {
68986
+ capName: "storage-admin",
68987
+ capScope: "system",
68988
+ addonId: null,
68989
+ access: "view"
68990
+ },
68991
+ "storageAdmin.listKinds": {
68992
+ capName: "storage-admin",
68993
+ capScope: "system",
68994
+ addonId: null,
68995
+ access: "view"
68996
+ },
67829
68997
  "storageAdmin.listTables": {
67830
68998
  capName: "storage-admin",
67831
68999
  capScope: "system",
67832
69000
  addonId: null,
67833
69001
  access: "view"
67834
69002
  },
69003
+ "storageAdmin.readLegacyCollection": {
69004
+ capName: "storage-admin",
69005
+ capScope: "system",
69006
+ addonId: null,
69007
+ access: "view"
69008
+ },
69009
+ "storageAdmin.readRecords": {
69010
+ capName: "storage-admin",
69011
+ capScope: "system",
69012
+ addonId: null,
69013
+ access: "view"
69014
+ },
67835
69015
  "storageEvictable.evict": {
67836
69016
  capName: "storage-evictable",
67837
69017
  capScope: "system",
@@ -69249,7 +70429,7 @@ Object.freeze({
69249
70429
  access: "create"
69250
70430
  }
69251
70431
  });
69252
- 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;
70432
+ 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;
69253
70433
  DeviceFeature.BatteryOperated;
69254
70434
  Object.freeze({
69255
70435
  "accessories.getStatus": [{
@@ -70073,6 +71253,71 @@ Object.freeze({
70073
71253
  form: "single",
70074
71254
  optional: false
70075
71255
  }],
71256
+ "dishwasher.getStatus": [{
71257
+ name: "deviceId",
71258
+ form: "single",
71259
+ optional: false
71260
+ }],
71261
+ "dishwasher.pause": [{
71262
+ name: "deviceId",
71263
+ form: "single",
71264
+ optional: false
71265
+ }],
71266
+ "dishwasher.setChildLock": [{
71267
+ name: "deviceId",
71268
+ form: "single",
71269
+ optional: false
71270
+ }],
71271
+ "dishwasher.setExtraDry": [{
71272
+ name: "deviceId",
71273
+ form: "single",
71274
+ optional: false
71275
+ }],
71276
+ "dishwasher.setHalfLoad": [{
71277
+ name: "deviceId",
71278
+ form: "single",
71279
+ optional: false
71280
+ }],
71281
+ "dishwasher.setHygienePlus": [{
71282
+ name: "deviceId",
71283
+ form: "single",
71284
+ optional: false
71285
+ }],
71286
+ "dishwasher.setIntensiveZone": [{
71287
+ name: "deviceId",
71288
+ form: "single",
71289
+ optional: false
71290
+ }],
71291
+ "dishwasher.setOption": [{
71292
+ name: "deviceId",
71293
+ form: "single",
71294
+ optional: false
71295
+ }],
71296
+ "dishwasher.setPower": [{
71297
+ name: "deviceId",
71298
+ form: "single",
71299
+ optional: false
71300
+ }],
71301
+ "dishwasher.setProgram": [{
71302
+ name: "deviceId",
71303
+ form: "single",
71304
+ optional: false
71305
+ }],
71306
+ "dishwasher.setVarioSpeedPlus": [{
71307
+ name: "deviceId",
71308
+ form: "single",
71309
+ optional: false
71310
+ }],
71311
+ "dishwasher.start": [{
71312
+ name: "deviceId",
71313
+ form: "single",
71314
+ optional: false
71315
+ }],
71316
+ "dishwasher.stop": [{
71317
+ name: "deviceId",
71318
+ form: "single",
71319
+ optional: false
71320
+ }],
70076
71321
  "doorbell.getStatus": [{
70077
71322
  name: "deviceId",
70078
71323
  form: "single",
@@ -70142,6 +71387,11 @@ Object.freeze({
70142
71387
  form: "single",
70143
71388
  optional: false
70144
71389
  }],
71390
+ "heatingValve.getStatus": [{
71391
+ name: "deviceId",
71392
+ form: "single",
71393
+ optional: false
71394
+ }],
70145
71395
  "humidifier.getStatus": [{
70146
71396
  name: "deviceId",
70147
71397
  form: "single",
@@ -71426,6 +72676,37 @@ Object.freeze({
71426
72676
  form: "single",
71427
72677
  optional: false
71428
72678
  }],
72679
+ "records.count": [{
72680
+ name: "deviceId",
72681
+ form: "single",
72682
+ optional: true
72683
+ }],
72684
+ "records.deleteDevice": [{
72685
+ name: "deviceId",
72686
+ form: "single",
72687
+ optional: false
72688
+ }],
72689
+ "records.deleteWhere": [{
72690
+ name: "deviceId",
72691
+ form: "single",
72692
+ optional: true
72693
+ }],
72694
+ "records.histogram": [{
72695
+ name: "deviceId",
72696
+ form: "single",
72697
+ optional: true
72698
+ }],
72699
+ "records.putMany": [{
72700
+ name: "records",
72701
+ form: "object-array",
72702
+ optional: false,
72703
+ itemField: "deviceId"
72704
+ }],
72705
+ "records.query": [{
72706
+ name: "deviceId",
72707
+ form: "single",
72708
+ optional: true
72709
+ }],
71429
72710
  "sceneMonitor.captureReference": [{
71430
72711
  name: "deviceId",
71431
72712
  form: "single",
@@ -71542,6 +72823,17 @@ Object.freeze({
71542
72823
  form: "single",
71543
72824
  optional: false
71544
72825
  }],
72826
+ "storageAdmin.adoptRecords": [{
72827
+ name: "records",
72828
+ form: "object-array",
72829
+ optional: false,
72830
+ itemField: "deviceId"
72831
+ }],
72832
+ "storageAdmin.readRecords": [{
72833
+ name: "deviceId",
72834
+ form: "single",
72835
+ optional: true
72836
+ }],
71545
72837
  "streamBroker.acquireEgressTranscode": [{
71546
72838
  name: "deviceId",
71547
72839
  form: "single",
@@ -73372,7 +74664,31 @@ function createWasteCalendarSource(deps) {
73372
74664
  }
73373
74665
  //#endregion
73374
74666
  //#region src/waste-catalog.ts
73375
- var catalog = {
74667
+ var catalog = object({
74668
+ generatedAt: string(),
74669
+ sourceHash: string(),
74670
+ countries: array(object({
74671
+ id: string(),
74672
+ label: string()
74673
+ })),
74674
+ services: array(object({
74675
+ id: string(),
74676
+ countryId: string(),
74677
+ label: string(),
74678
+ module: string(),
74679
+ defaultArgs: record(string(), string()),
74680
+ fields: array(object({
74681
+ key: string(),
74682
+ label: string(),
74683
+ required: boolean(),
74684
+ kind: _enum([
74685
+ "text",
74686
+ "number",
74687
+ "boolean"
74688
+ ])
74689
+ }))
74690
+ }))
74691
+ }).parse({
73376
74692
  generatedAt: "2026-10-12T16:54:36.612Z",
73377
74693
  sourceHash: "35f2f21decca0a4beae07ec89164a2ae5ea34ff5832c440a046d79d69b5963ea",
73378
74694
  entries: [
@@ -159239,7 +160555,7 @@ var catalog = {
159239
160555
  }]
159240
160556
  }
159241
160557
  ]
159242
- };
160558
+ });
159243
160559
  function listCatalogCountries() {
159244
160560
  return catalog.countries;
159245
160561
  }
@@ -159366,6 +160682,79 @@ function allocateSourceId(label, existingIds) {
159366
160682
  throw new Error("could not allocate a unique source id");
159367
160683
  }
159368
160684
  //#endregion
160685
+ //#region src/waste-source-record-kinds.ts
160686
+ var WASTE_COLLECTIONS_OWNER = "waste-collections";
160687
+ var WasteSourceBodySchema = entryBody({
160688
+ module: string().min(1),
160689
+ args: preprocess((v) => v ?? {}, record(string(), WasteArgValueSchema)),
160690
+ enabled: boolean().default(true)
160691
+ });
160692
+ var wasteSourceEntryKind = defineEntryKind("waste-source", {
160693
+ title: "Waste collection sources",
160694
+ schema: WasteSourceBodySchema,
160695
+ writeTrigger: "an operator adds or edits a municipal waste calendar source",
160696
+ adoptsFrom: settingsArrayAdoptsFrom(WASTE_COLLECTIONS_OWNER, "sources")
160697
+ });
160698
+ //#endregion
160699
+ //#region src/waste-source-store.ts
160700
+ function rowToSource(id, data) {
160701
+ const parsed = WasteSourceConfigSchema.safeParse({
160702
+ id,
160703
+ label: data.name,
160704
+ module: data.module,
160705
+ args: data.args,
160706
+ enabled: data.enabled
160707
+ });
160708
+ return parsed.success ? parsed.data : null;
160709
+ }
160710
+ var WasteSourceStore = class WasteSourceStore {
160711
+ kind;
160712
+ constructor(kind) {
160713
+ this.kind = kind;
160714
+ }
160715
+ static of(records) {
160716
+ return new WasteSourceStore(records.kind(wasteSourceEntryKind));
160717
+ }
160718
+ async listResolved() {
160719
+ const page = await this.kind.query({ limit: 1e3 });
160720
+ const out = [];
160721
+ for (const record of page.records) {
160722
+ let data = record.data;
160723
+ try {
160724
+ const resolved = await this.kind.getResolved(record.id);
160725
+ if (resolved !== null) data = resolved.data;
160726
+ } catch (err) {
160727
+ if (!(err instanceof RecordSecretUnavailableError)) throw err;
160728
+ }
160729
+ const parsed = WasteSourceBodySchema.safeParse(data);
160730
+ if (!parsed.success) continue;
160731
+ const row = rowToSource(record.id, parsed.data);
160732
+ if (row !== null) out.push(row);
160733
+ }
160734
+ return out;
160735
+ }
160736
+ async replaceAll(sources) {
160737
+ const page = await this.kind.query({ limit: 1e3 });
160738
+ const nextIds = new Set(sources.map((s) => s.id));
160739
+ for (const row of page.records) if (!nextIds.has(row.id)) await this.kind.delete(row.id);
160740
+ for (const source of sources) {
160741
+ const { id, label, module, args, enabled } = source;
160742
+ const body = {
160743
+ name: label,
160744
+ module,
160745
+ args,
160746
+ enabled
160747
+ };
160748
+ const parsed = wasteSourceEntryKind.schema.safeParse(body);
160749
+ if (!parsed.success) throw new Error(`invalid waste source '${id}': ${parsed.error.message}`);
160750
+ await this.kind.put({
160751
+ id,
160752
+ data: parsed.data
160753
+ });
160754
+ }
160755
+ }
160756
+ };
160757
+ //#endregion
159369
160758
  //#region src/waste-collections.addon.ts
159370
160759
  /**
159371
160760
  * Waste Collections — hub-only calendar-source over the vendored HACS
@@ -159380,12 +160769,23 @@ var WasteCollectionsAddon = class extends BaseAddon {
159380
160769
  cache = /* @__PURE__ */ new Map();
159381
160770
  refreshTimer = null;
159382
160771
  refreshInFlight = null;
160772
+ sourceStore = null;
160773
+ activeSources = [];
159383
160774
  constructor() {
159384
160775
  super({ ...DEFAULT_WASTE_CONFIG });
159385
160776
  }
159386
160777
  async onInitialize() {
159387
160778
  this.scriptPath = resolveFetchScript();
159388
160779
  this.loadCacheFromDisk();
160780
+ const records = this.ctx.records;
160781
+ if (records === void 0) throw new Error("waste-collections: ctx.records is required (hub-only addon)");
160782
+ await records.declare({ "waste-source": wasteSourceEntryKind });
160783
+ this.sourceStore = WasteSourceStore.of(records);
160784
+ this.activeSources = await this.loadPersistedSources();
160785
+ if ((await this.sourceStore.listResolved()).length === 0 && this.config.sources.length > 0) {
160786
+ await this.sourceStore.replaceAll(this.parseConfigSources(this.config.sources));
160787
+ this.activeSources = await this.loadPersistedSources();
160788
+ }
159389
160789
  try {
159390
160790
  this.pythonPath = await this.ctx.deps.ensurePython();
159391
160791
  } catch (err) {
@@ -159443,6 +160843,7 @@ var WasteCollectionsAddon = class extends BaseAddon {
159443
160843
  };
159444
160844
  }
159445
160845
  async onConfigChanged() {
160846
+ this.activeSources = await this.loadPersistedSources();
159446
160847
  const ids = new Set(this.configuredSources().map((s) => s.id));
159447
160848
  for (const key of [...this.cache.keys()]) if (!ids.has(key)) this.cache.delete(key);
159448
160849
  this.persistCache();
@@ -159453,15 +160854,36 @@ var WasteCollectionsAddon = class extends BaseAddon {
159453
160854
  * is skipped AND logged: a source that silently vanishes reads as a calendar
159454
160855
  * that never existed.
159455
160856
  */
159456
- configuredSources() {
160857
+ parseConfigSources(rawList) {
159457
160858
  const out = [];
159458
- for (const raw of this.config.sources) {
160859
+ for (const raw of rawList) {
159459
160860
  const parsed = WasteSourceConfigSchema.safeParse(raw);
159460
160861
  if (parsed.success) out.push(parsed.data);
159461
- else this.ctx.logger.warn("waste-collections: a stored source does not parse - skipped", { meta: { sourceId: typeof raw?.id === "string" ? raw.id : null } });
160862
+ else this.ctx.logger.warn("waste-collections: a stored source does not parse - skipped", { meta: { sourceId: typeof raw === "object" && raw !== null && "id" in raw && typeof raw.id === "string" ? raw.id : null } });
159462
160863
  }
159463
160864
  return out;
159464
160865
  }
160866
+ async loadPersistedSources() {
160867
+ const store = this.sourceStore;
160868
+ if (store !== null) {
160869
+ const fromRecords = await store.listResolved();
160870
+ if (fromRecords.length > 0) return fromRecords;
160871
+ }
160872
+ return this.parseConfigSources(this.config.sources);
160873
+ }
160874
+ async persistSources(sources) {
160875
+ this.activeSources = [...sources];
160876
+ const store = this.sourceStore;
160877
+ if (store !== null) {
160878
+ await store.replaceAll(sources);
160879
+ return;
160880
+ }
160881
+ await this.updateGlobalSettings({ sources: [...sources] });
160882
+ }
160883
+ configuredSources() {
160884
+ if (this.activeSources.length > 0) return this.activeSources;
160885
+ return this.parseConfigSources(this.config.sources);
160886
+ }
159465
160887
  listSources() {
159466
160888
  return this.configuredSources().map((s) => {
159467
160889
  let args = {};
@@ -159505,7 +160927,7 @@ var WasteCollectionsAddon = class extends BaseAddon {
159505
160927
  args: this.typedArgs(mergeServiceArgs(service, restoreRedactedArgs(input.args, {}))),
159506
160928
  enabled: input.enabled ?? true
159507
160929
  });
159508
- await this.updateGlobalSettings({ sources: [...this.configuredSources(), row] });
160930
+ await this.persistSources([...this.configuredSources(), row]);
159509
160931
  return { id };
159510
160932
  }
159511
160933
  async updateSource(input) {
@@ -159541,7 +160963,7 @@ var WasteCollectionsAddon = class extends BaseAddon {
159541
160963
  args: this.typedArgs(args),
159542
160964
  enabled: input.enabled ?? prev.enabled
159543
160965
  });
159544
- await this.updateGlobalSettings({ sources: sources.map((s, i) => i === idx ? next : s) });
160966
+ await this.persistSources(sources.map((s, i) => i === idx ? next : s));
159545
160967
  return { ok: true };
159546
160968
  }
159547
160969
  /** Validate an argument bag against the typed value schema (a nested object is refused). */
@@ -159608,7 +161030,7 @@ var WasteCollectionsAddon = class extends BaseAddon {
159608
161030
  remainingRaw: legacy.length
159609
161031
  });
159610
161032
  try {
159611
- await this.updateGlobalSettings({ sources: migrated });
161033
+ await this.persistSources(migrated);
159612
161034
  } catch {
159613
161035
  return report({ failed: legacy.length });
159614
161036
  }
@@ -159648,7 +161070,7 @@ var WasteCollectionsAddon = class extends BaseAddon {
159648
161070
  async deleteSource(input) {
159649
161071
  const sources = this.configuredSources();
159650
161072
  if (!sources.some((s) => s.id === input.id)) throw new Error(`source '${input.id}' not found`);
159651
- await this.updateGlobalSettings({ sources: sources.filter((s) => s.id !== input.id) });
161073
+ await this.persistSources(sources.filter((s) => s.id !== input.id));
159652
161074
  return { ok: true };
159653
161075
  }
159654
161076
  async fetchNow(input) {