@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.
@@ -4130,6 +4130,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4130
4130
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4131
4131
  json.type = "boolean";
4132
4132
  };
4133
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4134
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4135
+ };
4136
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4137
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4138
+ };
4133
4139
  var nullProcessor = (_schema, ctx, json, _params) => {
4134
4140
  if (ctx.target === "openapi-3.0") {
4135
4141
  json.type = "string";
@@ -4137,12 +4143,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4137
4143
  json.enum = [null];
4138
4144
  } else json.type = "null";
4139
4145
  };
4146
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4147
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4148
+ };
4140
4149
  var voidProcessor = (_schema, ctx, _json, _params) => {
4141
4150
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4142
4151
  };
4143
4152
  var neverProcessor = (_schema, _ctx, json, _params) => {
4144
4153
  json.not = {};
4145
4154
  };
4155
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4156
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4146
4157
  var dateProcessor = (_schema, ctx, _json, _params) => {
4147
4158
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4148
4159
  };
@@ -4174,12 +4185,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4174
4185
  json.enum = vals;
4175
4186
  }
4176
4187
  };
4188
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4189
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4190
+ };
4191
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4192
+ const _json = json;
4193
+ const pattern = schema._zod.pattern;
4194
+ if (!pattern) throw new Error("Pattern not found in template literal");
4195
+ _json.type = "string";
4196
+ _json.pattern = pattern.source;
4197
+ };
4198
+ var fileProcessor = (schema, _ctx, json, _params) => {
4199
+ const _json = json;
4200
+ const file = {
4201
+ type: "string",
4202
+ format: "binary",
4203
+ contentEncoding: "binary"
4204
+ };
4205
+ const { minimum, maximum, mime } = schema._zod.bag;
4206
+ if (minimum !== void 0) file.minLength = minimum;
4207
+ if (maximum !== void 0) file.maxLength = maximum;
4208
+ if (mime) if (mime.length === 1) {
4209
+ file.contentMediaType = mime[0];
4210
+ Object.assign(_json, file);
4211
+ } else {
4212
+ Object.assign(_json, file);
4213
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4214
+ }
4215
+ else Object.assign(_json, file);
4216
+ };
4217
+ var successProcessor = (_schema, _ctx, json, _params) => {
4218
+ json.type = "boolean";
4219
+ };
4177
4220
  var customProcessor = (_schema, ctx, _json, _params) => {
4178
4221
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4179
4222
  };
4223
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4224
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4225
+ };
4180
4226
  var transformProcessor = (_schema, ctx, _json, _params) => {
4181
4227
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4182
4228
  };
4229
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4230
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4231
+ };
4232
+ var setProcessor = (_schema, ctx, _json, _params) => {
4233
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4234
+ };
4183
4235
  var arrayProcessor = (schema, ctx, _json, params) => {
4184
4236
  const json = _json;
4185
4237
  const def = schema._zod.def;
@@ -4384,6 +4436,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4384
4436
  seen.ref = def.innerType;
4385
4437
  json.readOnly = true;
4386
4438
  };
4439
+ var promiseProcessor = (schema, ctx, _json, params) => {
4440
+ const def = schema._zod.def;
4441
+ process(def.innerType, ctx, params);
4442
+ const seen = ctx.seen.get(schema);
4443
+ seen.ref = def.innerType;
4444
+ };
4387
4445
  var optionalProcessor = (schema, ctx, _json, params) => {
4388
4446
  const def = schema._zod.def;
4389
4447
  process(def.innerType, ctx, params);
@@ -4396,6 +4454,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4396
4454
  const seen = ctx.seen.get(schema);
4397
4455
  seen.ref = innerType;
4398
4456
  };
4457
+ var allProcessors = {
4458
+ string: stringProcessor,
4459
+ number: numberProcessor,
4460
+ boolean: booleanProcessor,
4461
+ bigint: bigintProcessor,
4462
+ symbol: symbolProcessor,
4463
+ null: nullProcessor,
4464
+ undefined: undefinedProcessor,
4465
+ void: voidProcessor,
4466
+ never: neverProcessor,
4467
+ any: anyProcessor,
4468
+ unknown: unknownProcessor,
4469
+ date: dateProcessor,
4470
+ enum: enumProcessor,
4471
+ literal: literalProcessor,
4472
+ nan: nanProcessor,
4473
+ template_literal: templateLiteralProcessor,
4474
+ file: fileProcessor,
4475
+ success: successProcessor,
4476
+ custom: customProcessor,
4477
+ function: functionProcessor,
4478
+ transform: transformProcessor,
4479
+ map: mapProcessor,
4480
+ set: setProcessor,
4481
+ array: arrayProcessor,
4482
+ object: objectProcessor,
4483
+ union: unionProcessor,
4484
+ intersection: intersectionProcessor,
4485
+ tuple: tupleProcessor,
4486
+ record: recordProcessor,
4487
+ nullable: nullableProcessor,
4488
+ nonoptional: nonoptionalProcessor,
4489
+ default: defaultProcessor,
4490
+ prefault: prefaultProcessor,
4491
+ catch: catchProcessor,
4492
+ pipe: pipeProcessor,
4493
+ readonly: readonlyProcessor,
4494
+ promise: promiseProcessor,
4495
+ optional: optionalProcessor,
4496
+ lazy: lazyProcessor
4497
+ };
4498
+ function toJSONSchema(input, params) {
4499
+ if ("_idmap" in input) {
4500
+ const registry = input;
4501
+ const ctx = initializeContext({
4502
+ ...params,
4503
+ processors: allProcessors
4504
+ });
4505
+ const defs = {};
4506
+ for (const entry of registry._idmap.entries()) {
4507
+ const [_, schema] = entry;
4508
+ process(schema, ctx);
4509
+ }
4510
+ const schemas = {};
4511
+ ctx.external = {
4512
+ registry,
4513
+ uri: params?.uri,
4514
+ defs
4515
+ };
4516
+ for (const entry of registry._idmap.entries()) {
4517
+ const [key, schema] = entry;
4518
+ extractDefs(ctx, schema);
4519
+ schemas[key] = finalize(ctx, schema);
4520
+ }
4521
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4522
+ return { schemas };
4523
+ }
4524
+ const ctx = initializeContext({
4525
+ ...params,
4526
+ processors: allProcessors
4527
+ });
4528
+ process(input, ctx);
4529
+ extractDefs(ctx, input);
4530
+ return finalize(ctx, input);
4531
+ }
4399
4532
  //#endregion
4400
4533
  //#region ../../node_modules/zod/v4/classic/iso.js
4401
4534
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5412,7 +5545,7 @@ var ZodIssueCode = {
5412
5545
  var ZodFirstPartyTypeKind;
5413
5546
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5414
5547
  //#endregion
5415
- //#region ../types/dist/sleep-D-Q2_Mcd.mjs
5548
+ //#region ../types/dist/sleep-BegKjwUu.mjs
5416
5549
  /**
5417
5550
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5418
5551
  * window to float samples (D455).
@@ -5539,7 +5672,7 @@ function isKeychainStoredField(field) {
5539
5672
  var SECRET_CLEAR = { $secretClear: true };
5540
5673
  /** The `'***'` token D634 redaction writes for non-admins. */
5541
5674
  var LEGACY_DEVICE_REDACTION = "***";
5542
- function isRecord$2(value) {
5675
+ function isRecord$5(value) {
5543
5676
  return typeof value === "object" && value !== null && !Array.isArray(value);
5544
5677
  }
5545
5678
  function makeSecretMarker(ref) {
@@ -5550,12 +5683,12 @@ function makeSecretMarker(ref) {
5550
5683
  }
5551
5684
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5552
5685
  function isSecretMarker(value) {
5553
- if (!isRecord$2(value)) return false;
5686
+ if (!isRecord$5(value)) return false;
5554
5687
  const ref = value["$secret"];
5555
5688
  return typeof ref === "string" && ref.length > 0;
5556
5689
  }
5557
5690
  function isSecretClear(value) {
5558
- return isRecord$2(value) && value["$secretClear"] === true;
5691
+ return isRecord$5(value) && value["$secretClear"] === true;
5559
5692
  }
5560
5693
  /**
5561
5694
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6165,7 +6298,7 @@ var KeychainWriteRefusedError = class extends Error {
6165
6298
  }
6166
6299
  };
6167
6300
  var KEEP = { kind: "keep" };
6168
- function isRecord$1(value) {
6301
+ function isRecord$4(value) {
6169
6302
  return typeof value === "object" && value !== null && !Array.isArray(value);
6170
6303
  }
6171
6304
  function defaultMintId() {
@@ -6178,7 +6311,7 @@ function collectSecretMarkerRefs(value, out = []) {
6178
6311
  return out;
6179
6312
  }
6180
6313
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6181
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6314
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6182
6315
  return out;
6183
6316
  }
6184
6317
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6233,7 +6366,7 @@ function rowId(row, idKey) {
6233
6366
  return null;
6234
6367
  }
6235
6368
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6236
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6369
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6237
6370
  if (!Array.isArray(incoming)) {
6238
6371
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6239
6372
  return {
@@ -6249,7 +6382,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6249
6382
  const kept = /* @__PURE__ */ new Set();
6250
6383
  const rows = [];
6251
6384
  for (const row of incoming) {
6252
- if (!isRecord$1(row)) {
6385
+ if (!isRecord$4(row)) {
6253
6386
  rows.push(row);
6254
6387
  continue;
6255
6388
  }
@@ -6274,7 +6407,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6274
6407
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6275
6408
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6276
6409
  case "object": {
6277
- if (!isRecord$1(incoming)) {
6410
+ if (!isRecord$4(incoming)) {
6278
6411
  if (incoming === void 0) return KEEP;
6279
6412
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6280
6413
  return {
@@ -6282,7 +6415,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6282
6415
  value: incoming
6283
6416
  };
6284
6417
  }
6285
- const storedObj = isRecord$1(stored) ? stored : {};
6418
+ const storedObj = isRecord$4(stored) ? stored : {};
6286
6419
  return {
6287
6420
  kind: "value",
6288
6421
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6405,7 +6538,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6405
6538
  value: items
6406
6539
  };
6407
6540
  }
6408
- if (isRecord$1(v)) {
6541
+ if (isRecord$4(v)) {
6409
6542
  const out = {};
6410
6543
  for (const [k, child] of Object.entries(v)) {
6411
6544
  const s = substitute(child);
@@ -6437,7 +6570,7 @@ var SecretOverwriteRefusedError = class extends Error {
6437
6570
  this.name = "SecretOverwriteRefusedError";
6438
6571
  }
6439
6572
  };
6440
- function isRecord(value) {
6573
+ function isRecord$3(value) {
6441
6574
  return typeof value === "object" && value !== null && !Array.isArray(value);
6442
6575
  }
6443
6576
  function resolvedValue(pass, marker) {
@@ -6466,7 +6599,7 @@ function inArray(pass, incoming, stored) {
6466
6599
  return incoming.map((item, index) => {
6467
6600
  const twin = stored[index];
6468
6601
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6469
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6602
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6470
6603
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6471
6604
  return item;
6472
6605
  });
@@ -6477,7 +6610,7 @@ function inArrayRow(pass, incoming, stored) {
6477
6610
  const twin = stored[key];
6478
6611
  if (isSecretMarker(twin)) {
6479
6612
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6480
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6613
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6481
6614
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6482
6615
  }
6483
6616
  return out;
@@ -6485,7 +6618,7 @@ function inArrayRow(pass, incoming, stored) {
6485
6618
  async function walk(pass, incoming, stored) {
6486
6619
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6487
6620
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6488
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6621
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6489
6622
  const out = { ...incoming };
6490
6623
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6491
6624
  return out;
@@ -6516,7 +6649,7 @@ async function restoreUnchangedSecrets(input) {
6516
6649
  function isJsonEqual(a, b) {
6517
6650
  if (Object.is(a, b)) return true;
6518
6651
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6519
- if (isRecord(a) && isRecord(b)) {
6652
+ if (isRecord$3(a) && isRecord$3(b)) {
6520
6653
  const keys = Object.keys(a);
6521
6654
  if (keys.length !== Object.keys(b).length) return false;
6522
6655
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6540,7 +6673,7 @@ function markerKeysOf(blob, owner) {
6540
6673
  }
6541
6674
  function nodeFromStored(value, owner) {
6542
6675
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6543
- if (!isRecord(value)) return null;
6676
+ if (!isRecord$3(value)) return null;
6544
6677
  const children = /* @__PURE__ */ new Map();
6545
6678
  for (const [key, child] of Object.entries(value)) {
6546
6679
  const node = nodeFromStored(child, owner);
@@ -7328,7 +7461,7 @@ var BaseAddon = class {
7328
7461
  if (!ctx) return;
7329
7462
  const addonId = ctx.id;
7330
7463
  setImmediate(() => {
7331
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7464
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7332
7465
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7333
7466
  }).catch((err) => {
7334
7467
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7822,6 +7955,355 @@ var PeerBytesTicketSchema = object({
7822
7955
  */
7823
7956
  declaredBytes: number().int().nonnegative().nullable()
7824
7957
  });
7958
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7959
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7960
+ var RECORD_DATABASES = ["settings", "events"];
7961
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7962
+ var RECORD_CLASSES = [
7963
+ "config",
7964
+ "ledger",
7965
+ "audit",
7966
+ "mirror",
7967
+ "ephemeral"
7968
+ ];
7969
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7970
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7971
+ var RECORD_BATCH_MAX = 1e3;
7972
+ var RECORD_QUERY_MAX = 1e3;
7973
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
7974
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
7975
+ var PREFIX = "records/";
7976
+ /** The base of every records failure. `detail` is the human part of the message. */
7977
+ var RecordsError = class extends Error {
7978
+ code;
7979
+ detail;
7980
+ constructor(code, detail) {
7981
+ super(`${PREFIX}${code}: ${detail}`);
7982
+ this.name = "RecordsError";
7983
+ this.code = code;
7984
+ this.detail = detail;
7985
+ }
7986
+ };
7987
+ /** The keychain could not store or serve a value: explicit, never an empty string. */
7988
+ var RecordSecretUnavailableError = class extends RecordsError {
7989
+ constructor(detail) {
7990
+ super("secret-unavailable", detail);
7991
+ this.name = "RecordSecretUnavailableError";
7992
+ }
7993
+ };
7994
+ var InvalidRecordError = class extends RecordsError {
7995
+ constructor(detail) {
7996
+ super("invalid-record", detail);
7997
+ this.name = "InvalidRecordError";
7998
+ }
7999
+ };
8000
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
8001
+ var DeclarationRefusedError = class extends RecordsError {
8002
+ constructor(detail) {
8003
+ super("declaration-refused", detail);
8004
+ this.name = "DeclarationRefusedError";
8005
+ }
8006
+ };
8007
+ function defOf(schema) {
8008
+ const zodBag = Reflect.get(schema, "_zod");
8009
+ if (typeof zodBag !== "object" || zodBag === null) return {};
8010
+ const def = Reflect.get(zodBag, "def");
8011
+ if (typeof def !== "object" || def === null) return {};
8012
+ return def;
8013
+ }
8014
+ function declaredHere(schema) {
8015
+ return globalRegistry.get(schema)?.secret === true;
8016
+ }
8017
+ /** Wrapper kinds whose `innerType` is the field itself. */
8018
+ var WRAPPERS = new Set([
8019
+ "optional",
8020
+ "nullable",
8021
+ "default",
8022
+ "prefault",
8023
+ "catch",
8024
+ "readonly",
8025
+ "nonoptional"
8026
+ ]);
8027
+ /**
8028
+ * The schema layers that make up ONE field: the schema itself and every
8029
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8030
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8031
+ * `.transform` on `in`).
8032
+ */
8033
+ function layersOf(schema) {
8034
+ const out = [];
8035
+ const queue = [schema];
8036
+ while (queue.length > 0) {
8037
+ const s = queue.shift();
8038
+ if (!s || out.includes(s)) continue;
8039
+ out.push(s);
8040
+ const def = defOf(s);
8041
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8042
+ if (def.type === "pipe") {
8043
+ if (def.in) queue.push(def.in);
8044
+ if (def.out) queue.push(def.out);
8045
+ }
8046
+ }
8047
+ return out;
8048
+ }
8049
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8050
+ function isZodSecret(schema) {
8051
+ return layersOf(schema).some(declaredHere);
8052
+ }
8053
+ /**
8054
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8055
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8056
+ * object or array is reported as one path and not descended into — everything
8057
+ * under it is secret.
8058
+ */
8059
+ function collectZodSecretPaths(schema, prefix = "") {
8060
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8061
+ const paths = [];
8062
+ for (const layer of layersOf(schema)) {
8063
+ const def = defOf(layer);
8064
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8065
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8066
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8067
+ else if (def.type === "intersection") {
8068
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8069
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8070
+ }
8071
+ }
8072
+ return [...new Set(paths)];
8073
+ }
8074
+ /**
8075
+ * Secret fields of a record, addressed the way a Zod schema declares them
8076
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8077
+ * (`auth.accessToken`, `headers[].value`).
8078
+ *
8079
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8080
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8081
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8082
+ * leaf names its element: `headers[X-Api].value`.
8083
+ *
8084
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8085
+ */
8086
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8087
+ function parseSecretPath(path) {
8088
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8089
+ return path.split(".").map((raw) => {
8090
+ const each = raw.endsWith("[]");
8091
+ const key = each ? raw.slice(0, -2) : raw;
8092
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8093
+ return {
8094
+ key,
8095
+ each
8096
+ };
8097
+ });
8098
+ }
8099
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8100
+ function secretArrayPrefixes(path) {
8101
+ const segments = parseSecretPath(path);
8102
+ const prefixes = [];
8103
+ const walked = [];
8104
+ for (const segment of segments) {
8105
+ walked.push(segment.key);
8106
+ if (segment.each) prefixes.push(walked.join("."));
8107
+ }
8108
+ return prefixes;
8109
+ }
8110
+ /**
8111
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8112
+ * Zod row schema that describes it, and the helper that turns the two into the
8113
+ * JSON the engine stores.
8114
+ *
8115
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8116
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8117
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
8118
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
8119
+ * never a field name (D879).
8120
+ */
8121
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
8122
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
8123
+ var RecordIndexSchema = object({
8124
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
8125
+ fields: array(RecordFieldPathSchema).min(1).max(4),
8126
+ unique: boolean().optional()
8127
+ }).strict();
8128
+ var RecordRetentionSchema = union([
8129
+ object({
8130
+ ttlMs: number().int().positive(),
8131
+ from: _enum(["at", "write"])
8132
+ }).strict(),
8133
+ object({
8134
+ maxRows: number().int().positive().optional(),
8135
+ maxRowsPerDevice: number().int().positive().optional()
8136
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
8137
+ object({
8138
+ owner: string().min(1),
8139
+ reason: string().min(1)
8140
+ }).strict(),
8141
+ object({ none: string().min(1) }).strict()
8142
+ ]);
8143
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
8144
+ var EntryDescriptorSchema = object({
8145
+ title: string().min(1),
8146
+ /** The record body field shown as the entry's name. */
8147
+ nameField: string().min(1),
8148
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
8149
+ fields: record(string(), unknown())
8150
+ }).strict();
8151
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
8152
+ var RecordKindDeclarationSchema = object({
8153
+ database: _enum(RECORD_DATABASES).default("settings"),
8154
+ class: _enum(RECORD_CLASSES),
8155
+ writeTrigger: string().min(1),
8156
+ device: _enum([
8157
+ "required",
8158
+ "optional",
8159
+ "none"
8160
+ ]).default("none"),
8161
+ at: _enum(["required", "none"]).default("none"),
8162
+ indexes: array(RecordIndexSchema).max(8).default([]),
8163
+ retention: RecordRetentionSchema,
8164
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
8165
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
8166
+ /** Derived from the Zod schema; never written by hand. */
8167
+ secretPaths: array(string().min(1)).default([]),
8168
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
8169
+ secretArrayKeys: record(string(), string()).default({}),
8170
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
8171
+ adoptsFrom: string().min(1).optional(),
8172
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
8173
+ transactFamily: string().min(1).optional(),
8174
+ entry: EntryDescriptorSchema.optional()
8175
+ }).strict();
8176
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8177
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8178
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8179
+ function assertValidDeclaration(name, decl) {
8180
+ const refuse = (why) => {
8181
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8182
+ };
8183
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8184
+ const seen = /* @__PURE__ */ new Set();
8185
+ for (const index of decl.indexes) {
8186
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8187
+ seen.add(index.name);
8188
+ }
8189
+ const { retention } = decl;
8190
+ const hasSecrets = decl.secretPaths.length > 0;
8191
+ if ("ttlMs" in retention) {
8192
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8193
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8194
+ }
8195
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8196
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8197
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8198
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8199
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8200
+ 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)`);
8201
+ }
8202
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8203
+ 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`);
8204
+ }
8205
+ function bodyFieldsOf(schema) {
8206
+ return { ...toJSONSchema(schema, {
8207
+ unrepresentable: "any",
8208
+ io: "input"
8209
+ }) };
8210
+ }
8211
+ function isRecordLike(value) {
8212
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8213
+ }
8214
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8215
+ function hasNameField(json, field) {
8216
+ const branches = json["oneOf"] ?? json["anyOf"];
8217
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8218
+ const properties = json["properties"];
8219
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8220
+ }
8221
+ /**
8222
+ * Declare the kinds of a package. The keys are the kind names. The result is
8223
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8224
+ * types its handle from.
8225
+ */
8226
+ function defineRecordKinds(specs) {
8227
+ const out = {};
8228
+ for (const [name, spec] of Object.entries(specs)) {
8229
+ const secretPaths = collectZodSecretPaths(spec.schema);
8230
+ const nameField = spec.entry?.nameField ?? "name";
8231
+ const fields = bodyFieldsOf(spec.schema);
8232
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8233
+ const parsed = RecordKindDeclarationSchema.parse({
8234
+ database: spec.database,
8235
+ class: spec.class,
8236
+ writeTrigger: spec.writeTrigger,
8237
+ device: spec.device,
8238
+ at: spec.at,
8239
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8240
+ retention: spec.retention,
8241
+ deviceRemoval: spec.deviceRemoval,
8242
+ maxDataBytes: spec.maxDataBytes,
8243
+ secretPaths: [...secretPaths],
8244
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8245
+ adoptsFrom: spec.adoptsFrom,
8246
+ transactFamily: spec.transactFamily,
8247
+ entry: spec.entry === void 0 ? void 0 : {
8248
+ title: spec.entry.title,
8249
+ nameField,
8250
+ fields
8251
+ }
8252
+ });
8253
+ assertValidDeclaration(name, parsed);
8254
+ out[name] = {
8255
+ name,
8256
+ schema: spec.schema,
8257
+ declaration: parsed
8258
+ };
8259
+ }
8260
+ return out;
8261
+ }
8262
+ /**
8263
+ * Entry kinds (D881): every list of user-created entries (notification
8264
+ * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
8265
+ * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
8266
+ * through the `record-entries` capability with password fields derived from
8267
+ * the schema (`.meta({ secret: true })`).
8268
+ */
8269
+ /** The body of a plain entry: a name and the fields the kind adds. */
8270
+ function entryBody(shape) {
8271
+ return object({
8272
+ name: string().min(1),
8273
+ ...shape
8274
+ });
8275
+ }
8276
+ /**
8277
+ * Declare one entry kind. An entry is configuration: never trimmed by the
8278
+ * engine, never aged, belonging to no device.
8279
+ */
8280
+ function defineEntryKind(name, spec) {
8281
+ const defined = defineRecordKinds({ [name]: {
8282
+ schema: spec.schema,
8283
+ class: "config",
8284
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
8285
+ retention: { none: "an entry goes only when the operator deletes it" },
8286
+ ...spec.database === void 0 ? {} : { database: spec.database },
8287
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
8288
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
8289
+ ...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
8290
+ entry: {
8291
+ title: spec.title,
8292
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
8293
+ }
8294
+ } })[name];
8295
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
8296
+ return defined;
8297
+ }
8298
+ /**
8299
+ * Legacy source for entry adoption (B3): a list stored under addon-settings
8300
+ * `<addonId>.<key>` until records-adopt copies rows into the entry kind.
8301
+ */
8302
+ var SETTINGS_ARRAY_ADOPTS_PREFIX = "@settings-array/";
8303
+ /** The `adoptsFrom` value for an addon-settings array field. */
8304
+ function settingsArrayAdoptsFrom(addonId, settingsKey) {
8305
+ return `${SETTINGS_ARRAY_ADOPTS_PREFIX}${addonId}/${settingsKey}`;
8306
+ }
7825
8307
  /** Shared Zod schemas used across streaming capabilities. */
7826
8308
  var CamProfileSchema = _enum([
7827
8309
  "high",
@@ -8309,7 +8791,7 @@ object({
8309
8791
  params: record(string(), union([string(), number()])).optional()
8310
8792
  });
8311
8793
  //#endregion
8312
- //#region ../types/dist/err-msg--2RrYiLO.mjs
8794
+ //#region ../types/dist/err-msg-BXKzRBwg.mjs
8313
8795
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8314
8796
  DeviceType["Camera"] = "camera";
8315
8797
  DeviceType["Hub"] = "hub";
@@ -8401,6 +8883,10 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
8401
8883
  * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
8402
8884
  * integrations sharing the same food/desiccant/hopper surface. */
8403
8885
  DeviceType["PetFeeder"] = "pet-feeder";
8886
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
8887
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
8888
+ * Sources: native Bosch Home Connect, reusable by similar integrations. */
8889
+ DeviceType["Dishwasher"] = "dishwasher";
8404
8890
  return DeviceType;
8405
8891
  }({});
8406
8892
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -8648,7 +9134,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8648
9134
  return DeviceRole;
8649
9135
  }({});
8650
9136
  //#endregion
8651
- //#region ../types/dist/composition-DOwQB_Ua.mjs
9137
+ //#region ../types/dist/composition-CB6PMT9p.mjs
8652
9138
  /**
8653
9139
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8654
9140
  *
@@ -13034,8 +13520,13 @@ var AlertSeveritySchema = _enum([
13034
13520
  "info",
13035
13521
  "success",
13036
13522
  "warning",
13037
- "error"
13523
+ "error",
13524
+ "critical"
13038
13525
  ]);
13526
+ var AlertActionSchema = object({
13527
+ label: string(),
13528
+ href: string().optional()
13529
+ });
13039
13530
  var AlertStatusSchema = _enum([
13040
13531
  "active",
13041
13532
  "in-progress",
@@ -13053,6 +13544,7 @@ var AlertSchema = object({
13053
13544
  severity: AlertSeveritySchema,
13054
13545
  title: string(),
13055
13546
  message: string(),
13547
+ action: AlertActionSchema.optional(),
13056
13548
  status: AlertStatusSchema,
13057
13549
  progress: number().optional(),
13058
13550
  read: boolean(),
@@ -16008,6 +16500,222 @@ id: union([string(), number()]) }), {
16008
16500
  kind: "mutation",
16009
16501
  auth: "admin"
16010
16502
  });
16503
+ /**
16504
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16505
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16506
+ * (operator intent, D870) and device-history (numbers over time, D850).
16507
+ *
16508
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16509
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16510
+ * that with the addon id closed over). It is deliberately NOT in any input
16511
+ * schema, so a session can never supply it, and a call with no stamp is refused
16512
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16513
+ * addons go through the owner's capability.
16514
+ *
16515
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16516
+ * never `[]`. Secret fields are never on the wire: a read shows the
16517
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16518
+ * resolves itself, and a write may carry only a keychain marker bound to the
16519
+ * row's own ref.
16520
+ *
16521
+ * Internal: addons reach it through `ctx.records`, never directly.
16522
+ */
16523
+ var RecordIdSchema = string().min(1).max(256);
16524
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16525
+ var RecordBodySchema = record(string(), unknown());
16526
+ var RecordInputSchema = object({
16527
+ id: RecordIdSchema,
16528
+ /** The device this row belongs to (D865 removal, per-device reads). */
16529
+ deviceId: number().int().optional(),
16530
+ /** The domain clock, ms: observed / created / opened. */
16531
+ at: number().int().optional(),
16532
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16533
+ expiresAt: number().int().optional(),
16534
+ data: RecordBodySchema
16535
+ });
16536
+ var RecordViewSchema = object({
16537
+ id: string(),
16538
+ deviceId: number().int().nullable(),
16539
+ at: number().nullable(),
16540
+ expiresAt: number().nullable(),
16541
+ rev: number().int(),
16542
+ updatedAt: number(),
16543
+ data: RecordBodySchema
16544
+ });
16545
+ /** Declared index fields only. Anything else does not compile, by design. */
16546
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16547
+ string(),
16548
+ number(),
16549
+ boolean(),
16550
+ object({ in: array(union([
16551
+ string(),
16552
+ number(),
16553
+ boolean()
16554
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16555
+ object({
16556
+ gt: union([string(), number()]).optional(),
16557
+ gte: union([string(), number()]).optional(),
16558
+ lt: union([string(), number()]).optional(),
16559
+ lte: union([string(), number()]).optional()
16560
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16561
+ ]));
16562
+ var KindShape = { kind: RecordKindNameSchema };
16563
+ var TimeWindowShape = {
16564
+ deviceId: number().int().optional(),
16565
+ atFrom: number().optional(),
16566
+ atTo: number().optional()
16567
+ };
16568
+ var RecordQueryInputSchema = object({
16569
+ ...KindShape,
16570
+ ...TimeWindowShape,
16571
+ where: RecordWhereSchema.optional(),
16572
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16573
+ order: _enum(["at", "id"]).optional(),
16574
+ desc: boolean().optional(),
16575
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16576
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16577
+ cursor: string().min(1).optional()
16578
+ });
16579
+ var RecordQueryResultSchema = object({
16580
+ records: array(RecordViewSchema),
16581
+ nextCursor: string().nullable()
16582
+ });
16583
+ var RecordKindStateSchema = _enum([
16584
+ "created",
16585
+ "unchanged",
16586
+ "updated"
16587
+ ]);
16588
+ var DeclareKindResultSchema = object({
16589
+ kindId: number().int(),
16590
+ state: RecordKindStateSchema,
16591
+ createdIndexes: array(string()),
16592
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16593
+ adoptionPending: object({
16594
+ legacyTable: string(),
16595
+ legacyRows: number().int()
16596
+ }).nullable()
16597
+ });
16598
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16599
+ var SecretRefsList = array(string());
16600
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16601
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16602
+ kind: "mutation",
16603
+ auth: "admin"
16604
+ }), method(object({
16605
+ ...KindShape,
16606
+ id: RecordIdSchema
16607
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16608
+ ...KindShape,
16609
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16610
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16611
+ ...KindShape,
16612
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16613
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16614
+ ...KindShape,
16615
+ record: RecordInputSchema,
16616
+ /** Compare-and-set. `0` means "the row must not exist". */
16617
+ ifRev: number().int().min(0).optional()
16618
+ }), object({
16619
+ rev: number().int(),
16620
+ releasedRefs: SecretRefsList
16621
+ }), {
16622
+ kind: "mutation",
16623
+ auth: "admin"
16624
+ }), method(object({
16625
+ ...KindShape,
16626
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16627
+ }), object({
16628
+ count: number().int(),
16629
+ releasedRefs: SecretRefsList
16630
+ }), {
16631
+ kind: "mutation",
16632
+ auth: "admin"
16633
+ }), method(object({
16634
+ ...KindShape,
16635
+ id: RecordIdSchema,
16636
+ data: RecordBodySchema,
16637
+ at: number().int().nullable().optional(),
16638
+ expiresAt: number().int().nullable().optional(),
16639
+ ifRev: number().int().min(1).optional()
16640
+ }), object({
16641
+ rev: number().int(),
16642
+ releasedRefs: SecretRefsList
16643
+ }), {
16644
+ kind: "mutation",
16645
+ auth: "admin"
16646
+ }), method(object({
16647
+ ...KindShape,
16648
+ id: RecordIdSchema
16649
+ }), object({
16650
+ deleted: boolean(),
16651
+ secretRefs: SecretRefsList
16652
+ }), {
16653
+ kind: "mutation",
16654
+ auth: "admin"
16655
+ }), method(object({
16656
+ ...KindShape,
16657
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16658
+ }), object({
16659
+ deleted: number().int(),
16660
+ secretRefs: SecretRefsList
16661
+ }), {
16662
+ kind: "mutation",
16663
+ auth: "admin"
16664
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16665
+ ...KindShape,
16666
+ ...TimeWindowShape,
16667
+ where: RecordWhereSchema.optional()
16668
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16669
+ ...KindShape,
16670
+ deviceId: number().int().optional(),
16671
+ from: number(),
16672
+ to: number(),
16673
+ bucketMs: number().int().positive()
16674
+ }), object({ buckets: array(object({
16675
+ bucketStart: number(),
16676
+ count: number().int()
16677
+ })) }), { auth: "admin" }), method(object({
16678
+ ...KindShape,
16679
+ op: _enum([
16680
+ "sum",
16681
+ "min",
16682
+ "max",
16683
+ "count"
16684
+ ]),
16685
+ field: RecordFieldPathSchema.optional(),
16686
+ groupBy: RecordFieldPathSchema.optional(),
16687
+ where: RecordWhereSchema.optional()
16688
+ }), object({ rows: array(object({
16689
+ group: union([
16690
+ string(),
16691
+ number(),
16692
+ _null()
16693
+ ]),
16694
+ value: number().nullable()
16695
+ })) }), { auth: "admin" }), method(object({
16696
+ ...KindShape,
16697
+ deviceId: number().int().optional(),
16698
+ atBefore: number().optional(),
16699
+ where: RecordWhereSchema.optional()
16700
+ }), object({
16701
+ deleted: number().int(),
16702
+ secretRefs: SecretRefsList
16703
+ }), {
16704
+ kind: "mutation",
16705
+ auth: "admin"
16706
+ }), method(object({
16707
+ deviceId: number().int(),
16708
+ kinds: array(RecordKindNameSchema).optional()
16709
+ }), object({
16710
+ deleted: record(string(), number().int()),
16711
+ secretRefs: SecretRefsList
16712
+ }), {
16713
+ kind: "mutation",
16714
+ auth: "admin"
16715
+ }), method(object(KindShape), object({ id: number().int() }), {
16716
+ kind: "mutation",
16717
+ auth: "admin"
16718
+ });
16011
16719
  /** One table of the settings database. */
16012
16720
  var StorageTableSchema = object({
16013
16721
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -16020,6 +16728,28 @@ var StorageTableSchema = object({
16020
16728
  /** Declared by an addon since this engine process started (a running addon claims it). */
16021
16729
  declaredThisBoot: boolean()
16022
16730
  });
16731
+ /** One declared record kind (D881) as System -> Data shows it. */
16732
+ var StorageKindSchema = object({
16733
+ owner: string(),
16734
+ kind: string(),
16735
+ database: _enum(["settings", "events"]),
16736
+ class: string(),
16737
+ state: _enum([
16738
+ "declared",
16739
+ "orphaned",
16740
+ "dropped"
16741
+ ]),
16742
+ /** `null` when the caller asked for no counts (`counts: false`). */
16743
+ rows: number().int().nonnegative().nullable(),
16744
+ /** Rows x the average size of a sample; null for an empty kind. */
16745
+ bytesEstimate: number().int().nonnegative().nullable(),
16746
+ writeTrigger: string(),
16747
+ retention: RecordRetentionSchema,
16748
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16749
+ entry: boolean(),
16750
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16751
+ declaration: RecordKindDeclarationSchema
16752
+ });
16023
16753
  method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16024
16754
  collection: string().min(1),
16025
16755
  expectRows: number().int().nonnegative()
@@ -16029,6 +16759,87 @@ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: arr
16029
16759
  }), {
16030
16760
  kind: "mutation",
16031
16761
  auth: "admin"
16762
+ }), method(object({
16763
+ owner: string().min(1).optional(),
16764
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16765
+ counts: boolean().optional()
16766
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16767
+ owner: string().min(1),
16768
+ kind: RecordKindNameSchema
16769
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16770
+ owner: string().min(1),
16771
+ kind: RecordKindNameSchema,
16772
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16773
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16774
+ complete: boolean().optional()
16775
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16776
+ kind: "mutation",
16777
+ auth: "admin"
16778
+ }), method(object({
16779
+ collection: string().min(1),
16780
+ cursor: string().optional(),
16781
+ limit: number().int().min(1).max(1e3).optional()
16782
+ }), object({
16783
+ rows: array(object({
16784
+ id: string(),
16785
+ data: record(string(), unknown())
16786
+ })),
16787
+ nextCursor: string().nullable()
16788
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16789
+ /**
16790
+ * record-entries - the ONE admin surface for every list of user-created entries
16791
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16792
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16793
+ *
16794
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16795
+ * the entry body with `secret: true` on every credential field, so a password
16796
+ * field is derived from the schema and never from a name. `putEntry` takes the
16797
+ * redaction token for an untouched secret (the stored value is kept), a string
16798
+ * for a new one, and the clear instruction to remove one. A read never carries
16799
+ * a secret value, and a locked keychain refuses the write with
16800
+ * `records/secret-unavailable` instead of storing plaintext.
16801
+ *
16802
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16803
+ */
16804
+ var EntryKindInfoSchema = object({
16805
+ owner: string(),
16806
+ kind: RecordKindNameSchema,
16807
+ title: string(),
16808
+ nameField: string(),
16809
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16810
+ fields: record(string(), unknown()),
16811
+ secretPaths: array(string()),
16812
+ rows: number().int().nonnegative()
16813
+ });
16814
+ var EntryViewSchema = object({
16815
+ id: RecordIdSchema,
16816
+ name: string(),
16817
+ rev: number().int(),
16818
+ updatedAt: number(),
16819
+ /** Secret fields hold the redaction token. */
16820
+ data: RecordBodySchema
16821
+ });
16822
+ var EntryAddress = {
16823
+ owner: string().min(1),
16824
+ kind: RecordKindNameSchema
16825
+ };
16826
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16827
+ ...EntryAddress,
16828
+ id: RecordIdSchema.optional(),
16829
+ data: RecordBodySchema,
16830
+ ifRev: number().int().min(1).optional()
16831
+ }), object({
16832
+ id: string(),
16833
+ rev: number().int()
16834
+ }), {
16835
+ kind: "mutation",
16836
+ auth: "admin"
16837
+ }), method(object({
16838
+ ...EntryAddress,
16839
+ id: RecordIdSchema
16840
+ }), object({ deleted: boolean() }), {
16841
+ kind: "mutation",
16842
+ auth: "admin"
16032
16843
  });
16033
16844
  /**
16034
16845
  * `keychain` — the hub's encrypted store of secret values (D787).
@@ -16878,7 +17689,11 @@ DeviceType.Hub, DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number().int
16878
17689
  });
16879
17690
  /**
16880
17691
  * `device-adoption` — generic discovery + adoption surface,
16881
- * system-scoped singleton. The de-HA-ified successor to `ha-discovery`:
17692
+ * system-scoped collection (one provider per integration addon), routed
17693
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
17694
+ * pin model as `connection-test`. The admin UI keeps using
17695
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
17696
+ * successor to `ha-discovery`:
16882
17697
  * keyed by `integrationId` (the addon resolves integrationId → broker
16883
17698
  * internally) rather than a connection-specific `brokerId`, and it
16884
17699
  * REUSES the shared `DiscoveredChildDevice` candidate type from
@@ -52668,7 +53483,7 @@ var BatteryStatusSchema = object({
52668
53483
  */
52669
53484
  binary: boolean().optional()
52670
53485
  });
52671
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, method(object({
53486
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, method(object({
52672
53487
  deviceId: number(),
52673
53488
  /** Bound on the wait. Sensible range 3000–10000ms. */
52674
53489
  timeoutMs: number().int().min(500).max(3e4).default(8e3)
@@ -53554,6 +54369,130 @@ object({
53554
54369
  deviceId: number(),
53555
54370
  status: DeviceStatusSchema
53556
54371
  });
54372
+ /**
54373
+ * Smart-dishwasher cap — program lifecycle, door / remote-start gates,
54374
+ * consumable levels (salt, rinse aid) and common program options.
54375
+ *
54376
+ * Sources: native Bosch Home Connect (`dishwasher` device type). Reusable
54377
+ * by any integration that exposes the same program / option surface.
54378
+ *
54379
+ * `kind: 'poll'` — cloud REST APIs typically have no push channel; the
54380
+ * provider refreshes the slice on an interval and eagerly after commands.
54381
+ */
54382
+ var DishwasherStateSchema = _enum([
54383
+ "idle",
54384
+ "running",
54385
+ "paused",
54386
+ "finished",
54387
+ "error",
54388
+ "unavailable"
54389
+ ]);
54390
+ var DishwasherConsumableLevelSchema = _enum([
54391
+ "ok",
54392
+ "low",
54393
+ "empty"
54394
+ ]);
54395
+ object({
54396
+ state: DishwasherStateSchema,
54397
+ /** Active program id/name, or null when none selected / unknown. */
54398
+ program: string().nullable(),
54399
+ /** Program tokens the hardware accepts — drives the UI selector. */
54400
+ availablePrograms: array(string()),
54401
+ /** Minutes remaining on the active cycle, or null when not running. */
54402
+ remainingMinutes: number().int().nonnegative().nullable(),
54403
+ /** Cycle completion 0..100, or null when not applicable. */
54404
+ progressPercent: number().min(0).max(100).nullable(),
54405
+ /** True when the door is reported open. */
54406
+ doorOpen: boolean(),
54407
+ /** True when remote start is allowed (door closed, power on, etc.). */
54408
+ remoteStartAllowed: boolean(),
54409
+ /** Main power / switched-on state. */
54410
+ powerOn: boolean(),
54411
+ saltLevel: DishwasherConsumableLevelSchema.nullable(),
54412
+ rinseAidLevel: DishwasherConsumableLevelSchema.nullable(),
54413
+ halfLoad: boolean(),
54414
+ hygienePlus: boolean(),
54415
+ /** Extra dry option when the appliance exposes it. */
54416
+ extraDry: boolean(),
54417
+ /** Intensive zone (lower basket) when the appliance exposes it. */
54418
+ intensiveZone: boolean(),
54419
+ /** VarioSpeed / VarioSpeed+ when the appliance exposes it. */
54420
+ varioSpeedPlus: boolean(),
54421
+ /** Child lock (controls disabled on the appliance). */
54422
+ childLock: boolean(),
54423
+ errorCode: number().nullable(),
54424
+ errorLabel: string().nullable(),
54425
+ lastFetchedAt: number()
54426
+ });
54427
+ DeviceType.Dishwasher, method(object({ deviceId: number().int().nonnegative() }), _void(), {
54428
+ kind: "mutation",
54429
+ auth: "protected"
54430
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
54431
+ kind: "mutation",
54432
+ auth: "protected"
54433
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
54434
+ kind: "mutation",
54435
+ auth: "protected"
54436
+ }), method(object({
54437
+ deviceId: number().int().nonnegative(),
54438
+ program: string().min(1)
54439
+ }), _void(), {
54440
+ kind: "mutation",
54441
+ auth: "protected"
54442
+ }), method(object({
54443
+ deviceId: number().int().nonnegative(),
54444
+ on: boolean()
54445
+ }), _void(), {
54446
+ kind: "mutation",
54447
+ auth: "protected"
54448
+ }), method(object({
54449
+ deviceId: number().int().nonnegative(),
54450
+ on: boolean()
54451
+ }), _void(), {
54452
+ kind: "mutation",
54453
+ auth: "protected"
54454
+ }), method(object({
54455
+ deviceId: number().int().nonnegative(),
54456
+ on: boolean()
54457
+ }), _void(), {
54458
+ kind: "mutation",
54459
+ auth: "protected"
54460
+ }), method(object({
54461
+ deviceId: number().int().nonnegative(),
54462
+ on: boolean()
54463
+ }), _void(), {
54464
+ kind: "mutation",
54465
+ auth: "protected"
54466
+ }), method(object({
54467
+ deviceId: number().int().nonnegative(),
54468
+ on: boolean()
54469
+ }), _void(), {
54470
+ kind: "mutation",
54471
+ auth: "protected"
54472
+ }), method(object({
54473
+ deviceId: number().int().nonnegative(),
54474
+ on: boolean()
54475
+ }), _void(), {
54476
+ kind: "mutation",
54477
+ auth: "protected"
54478
+ }), method(object({
54479
+ deviceId: number().int().nonnegative(),
54480
+ on: boolean()
54481
+ }), _void(), {
54482
+ kind: "mutation",
54483
+ auth: "protected"
54484
+ }), method(object({
54485
+ deviceId: number().int().nonnegative(),
54486
+ key: string().min(1),
54487
+ value: union([
54488
+ boolean(),
54489
+ string(),
54490
+ number()
54491
+ ])
54492
+ }), _void(), {
54493
+ kind: "mutation",
54494
+ auth: "protected"
54495
+ });
53557
54496
  object({
53558
54497
  /** Ms epoch of the last press. null = never observed since this provider started. */
53559
54498
  lastPressedAt: number().nullable(),
@@ -54119,6 +55058,13 @@ object({
54119
55058
  lastChangedAt: number()
54120
55059
  });
54121
55060
  DeviceType.Sensor;
55061
+ object({
55062
+ /** Radiator valve opening 0 (closed) .. 100 (open). Null = not yet known. */
55063
+ position: number().min(0).max(100).nullable(),
55064
+ /** Ms epoch when the slice was last updated (push or poll). */
55065
+ lastFetchedAt: number()
55066
+ });
55067
+ DeviceType.Thermostat;
54122
55068
  object({
54123
55069
  /** Whether the humidifier is currently on. */
54124
55070
  on: boolean(),
@@ -61185,7 +62131,7 @@ var AccessoryKind = {
61185
62131
  PrivacyMask: DeviceRole.PrivacyMask
61186
62132
  };
61187
62133
  AccessoryKind.Siren, AccessoryKind.Floodlight, AccessoryKind.Spotlight, AccessoryKind.PirSensor, AccessoryKind.Chime, AccessoryKind.Autotrack, AccessoryKind.Nightvision, AccessoryKind.PrivacyMask;
61188
- 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;
62134
+ 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;
61189
62135
  new Set(Object.values(DeviceType));
61190
62136
  Object.freeze({
61191
62137
  "accessories.getStatus": {
@@ -63606,6 +64552,84 @@ Object.freeze({
63606
64552
  addonId: null,
63607
64553
  access: "view"
63608
64554
  },
64555
+ "dishwasher.getStatus": {
64556
+ capName: "dishwasher",
64557
+ capScope: "device",
64558
+ addonId: null,
64559
+ access: "view"
64560
+ },
64561
+ "dishwasher.pause": {
64562
+ capName: "dishwasher",
64563
+ capScope: "device",
64564
+ addonId: null,
64565
+ access: "create"
64566
+ },
64567
+ "dishwasher.setChildLock": {
64568
+ capName: "dishwasher",
64569
+ capScope: "device",
64570
+ addonId: null,
64571
+ access: "create"
64572
+ },
64573
+ "dishwasher.setExtraDry": {
64574
+ capName: "dishwasher",
64575
+ capScope: "device",
64576
+ addonId: null,
64577
+ access: "create"
64578
+ },
64579
+ "dishwasher.setHalfLoad": {
64580
+ capName: "dishwasher",
64581
+ capScope: "device",
64582
+ addonId: null,
64583
+ access: "create"
64584
+ },
64585
+ "dishwasher.setHygienePlus": {
64586
+ capName: "dishwasher",
64587
+ capScope: "device",
64588
+ addonId: null,
64589
+ access: "create"
64590
+ },
64591
+ "dishwasher.setIntensiveZone": {
64592
+ capName: "dishwasher",
64593
+ capScope: "device",
64594
+ addonId: null,
64595
+ access: "create"
64596
+ },
64597
+ "dishwasher.setOption": {
64598
+ capName: "dishwasher",
64599
+ capScope: "device",
64600
+ addonId: null,
64601
+ access: "create"
64602
+ },
64603
+ "dishwasher.setPower": {
64604
+ capName: "dishwasher",
64605
+ capScope: "device",
64606
+ addonId: null,
64607
+ access: "create"
64608
+ },
64609
+ "dishwasher.setProgram": {
64610
+ capName: "dishwasher",
64611
+ capScope: "device",
64612
+ addonId: null,
64613
+ access: "create"
64614
+ },
64615
+ "dishwasher.setVarioSpeedPlus": {
64616
+ capName: "dishwasher",
64617
+ capScope: "device",
64618
+ addonId: null,
64619
+ access: "create"
64620
+ },
64621
+ "dishwasher.start": {
64622
+ capName: "dishwasher",
64623
+ capScope: "device",
64624
+ addonId: null,
64625
+ access: "create"
64626
+ },
64627
+ "dishwasher.stop": {
64628
+ capName: "dishwasher",
64629
+ capScope: "device",
64630
+ addonId: null,
64631
+ access: "create"
64632
+ },
63609
64633
  "doorbell.getStatus": {
63610
64634
  capName: "doorbell",
63611
64635
  capScope: "device",
@@ -63816,6 +64840,12 @@ Object.freeze({
63816
64840
  addonId: null,
63817
64841
  access: "view"
63818
64842
  },
64843
+ "heatingValve.getStatus": {
64844
+ capName: "heating-valve",
64845
+ capScope: "device",
64846
+ addonId: null,
64847
+ access: "view"
64848
+ },
63819
64849
  "humidifier.getStatus": {
63820
64850
  capName: "humidifier",
63821
64851
  capScope: "device",
@@ -67092,6 +68122,30 @@ Object.freeze({
67092
68122
  addonId: null,
67093
68123
  access: "create"
67094
68124
  },
68125
+ "recordEntries.deleteEntry": {
68126
+ capName: "record-entries",
68127
+ capScope: "system",
68128
+ addonId: null,
68129
+ access: "delete"
68130
+ },
68131
+ "recordEntries.listEntries": {
68132
+ capName: "record-entries",
68133
+ capScope: "system",
68134
+ addonId: null,
68135
+ access: "view"
68136
+ },
68137
+ "recordEntries.listEntryKinds": {
68138
+ capName: "record-entries",
68139
+ capScope: "system",
68140
+ addonId: null,
68141
+ access: "view"
68142
+ },
68143
+ "recordEntries.putEntry": {
68144
+ capName: "record-entries",
68145
+ capScope: "system",
68146
+ addonId: null,
68147
+ access: "create"
68148
+ },
67095
68149
  "recording.getAvailability": {
67096
68150
  capName: "recording",
67097
68151
  capScope: "device",
@@ -67392,6 +68446,102 @@ Object.freeze({
67392
68446
  addonId: null,
67393
68447
  access: "view"
67394
68448
  },
68449
+ "records.aggregate": {
68450
+ capName: "records",
68451
+ capScope: "system",
68452
+ addonId: null,
68453
+ access: "view"
68454
+ },
68455
+ "records.allocateId": {
68456
+ capName: "records",
68457
+ capScope: "system",
68458
+ addonId: null,
68459
+ access: "create"
68460
+ },
68461
+ "records.count": {
68462
+ capName: "records",
68463
+ capScope: "system",
68464
+ addonId: null,
68465
+ access: "view"
68466
+ },
68467
+ "records.declareKinds": {
68468
+ capName: "records",
68469
+ capScope: "system",
68470
+ addonId: null,
68471
+ access: "create"
68472
+ },
68473
+ "records.delete": {
68474
+ capName: "records",
68475
+ capScope: "system",
68476
+ addonId: null,
68477
+ access: "delete"
68478
+ },
68479
+ "records.deleteDevice": {
68480
+ capName: "records",
68481
+ capScope: "system",
68482
+ addonId: null,
68483
+ access: "delete"
68484
+ },
68485
+ "records.deleteMany": {
68486
+ capName: "records",
68487
+ capScope: "system",
68488
+ addonId: null,
68489
+ access: "delete"
68490
+ },
68491
+ "records.deleteWhere": {
68492
+ capName: "records",
68493
+ capScope: "system",
68494
+ addonId: null,
68495
+ access: "delete"
68496
+ },
68497
+ "records.get": {
68498
+ capName: "records",
68499
+ capScope: "system",
68500
+ addonId: null,
68501
+ access: "view"
68502
+ },
68503
+ "records.getMany": {
68504
+ capName: "records",
68505
+ capScope: "system",
68506
+ addonId: null,
68507
+ access: "view"
68508
+ },
68509
+ "records.histogram": {
68510
+ capName: "records",
68511
+ capScope: "system",
68512
+ addonId: null,
68513
+ access: "view"
68514
+ },
68515
+ "records.patch": {
68516
+ capName: "records",
68517
+ capScope: "system",
68518
+ addonId: null,
68519
+ access: "create"
68520
+ },
68521
+ "records.put": {
68522
+ capName: "records",
68523
+ capScope: "system",
68524
+ addonId: null,
68525
+ access: "create"
68526
+ },
68527
+ "records.putMany": {
68528
+ capName: "records",
68529
+ capScope: "system",
68530
+ addonId: null,
68531
+ access: "create"
68532
+ },
68533
+ "records.query": {
68534
+ capName: "records",
68535
+ capScope: "system",
68536
+ addonId: null,
68537
+ access: "view"
68538
+ },
68539
+ "records.secretRefs": {
68540
+ capName: "records",
68541
+ capScope: "system",
68542
+ addonId: null,
68543
+ access: "view"
68544
+ },
67395
68545
  "sceneMonitor.captureReference": {
67396
68546
  capName: "scene-monitor",
67397
68547
  capScope: "device",
@@ -67824,18 +68974,48 @@ Object.freeze({
67824
68974
  addonId: null,
67825
68975
  access: "create"
67826
68976
  },
68977
+ "storageAdmin.adoptRecords": {
68978
+ capName: "storage-admin",
68979
+ capScope: "system",
68980
+ addonId: null,
68981
+ access: "create"
68982
+ },
67827
68983
  "storageAdmin.dropCollection": {
67828
68984
  capName: "storage-admin",
67829
68985
  capScope: "system",
67830
68986
  addonId: null,
67831
68987
  access: "delete"
67832
68988
  },
68989
+ "storageAdmin.isAdoptedLegacyTable": {
68990
+ capName: "storage-admin",
68991
+ capScope: "system",
68992
+ addonId: null,
68993
+ access: "view"
68994
+ },
68995
+ "storageAdmin.listKinds": {
68996
+ capName: "storage-admin",
68997
+ capScope: "system",
68998
+ addonId: null,
68999
+ access: "view"
69000
+ },
67833
69001
  "storageAdmin.listTables": {
67834
69002
  capName: "storage-admin",
67835
69003
  capScope: "system",
67836
69004
  addonId: null,
67837
69005
  access: "view"
67838
69006
  },
69007
+ "storageAdmin.readLegacyCollection": {
69008
+ capName: "storage-admin",
69009
+ capScope: "system",
69010
+ addonId: null,
69011
+ access: "view"
69012
+ },
69013
+ "storageAdmin.readRecords": {
69014
+ capName: "storage-admin",
69015
+ capScope: "system",
69016
+ addonId: null,
69017
+ access: "view"
69018
+ },
67839
69019
  "storageEvictable.evict": {
67840
69020
  capName: "storage-evictable",
67841
69021
  capScope: "system",
@@ -69253,7 +70433,7 @@ Object.freeze({
69253
70433
  access: "create"
69254
70434
  }
69255
70435
  });
69256
- 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;
70436
+ 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;
69257
70437
  DeviceFeature.BatteryOperated;
69258
70438
  Object.freeze({
69259
70439
  "accessories.getStatus": [{
@@ -70077,6 +71257,71 @@ Object.freeze({
70077
71257
  form: "single",
70078
71258
  optional: false
70079
71259
  }],
71260
+ "dishwasher.getStatus": [{
71261
+ name: "deviceId",
71262
+ form: "single",
71263
+ optional: false
71264
+ }],
71265
+ "dishwasher.pause": [{
71266
+ name: "deviceId",
71267
+ form: "single",
71268
+ optional: false
71269
+ }],
71270
+ "dishwasher.setChildLock": [{
71271
+ name: "deviceId",
71272
+ form: "single",
71273
+ optional: false
71274
+ }],
71275
+ "dishwasher.setExtraDry": [{
71276
+ name: "deviceId",
71277
+ form: "single",
71278
+ optional: false
71279
+ }],
71280
+ "dishwasher.setHalfLoad": [{
71281
+ name: "deviceId",
71282
+ form: "single",
71283
+ optional: false
71284
+ }],
71285
+ "dishwasher.setHygienePlus": [{
71286
+ name: "deviceId",
71287
+ form: "single",
71288
+ optional: false
71289
+ }],
71290
+ "dishwasher.setIntensiveZone": [{
71291
+ name: "deviceId",
71292
+ form: "single",
71293
+ optional: false
71294
+ }],
71295
+ "dishwasher.setOption": [{
71296
+ name: "deviceId",
71297
+ form: "single",
71298
+ optional: false
71299
+ }],
71300
+ "dishwasher.setPower": [{
71301
+ name: "deviceId",
71302
+ form: "single",
71303
+ optional: false
71304
+ }],
71305
+ "dishwasher.setProgram": [{
71306
+ name: "deviceId",
71307
+ form: "single",
71308
+ optional: false
71309
+ }],
71310
+ "dishwasher.setVarioSpeedPlus": [{
71311
+ name: "deviceId",
71312
+ form: "single",
71313
+ optional: false
71314
+ }],
71315
+ "dishwasher.start": [{
71316
+ name: "deviceId",
71317
+ form: "single",
71318
+ optional: false
71319
+ }],
71320
+ "dishwasher.stop": [{
71321
+ name: "deviceId",
71322
+ form: "single",
71323
+ optional: false
71324
+ }],
70080
71325
  "doorbell.getStatus": [{
70081
71326
  name: "deviceId",
70082
71327
  form: "single",
@@ -70146,6 +71391,11 @@ Object.freeze({
70146
71391
  form: "single",
70147
71392
  optional: false
70148
71393
  }],
71394
+ "heatingValve.getStatus": [{
71395
+ name: "deviceId",
71396
+ form: "single",
71397
+ optional: false
71398
+ }],
70149
71399
  "humidifier.getStatus": [{
70150
71400
  name: "deviceId",
70151
71401
  form: "single",
@@ -71430,6 +72680,37 @@ Object.freeze({
71430
72680
  form: "single",
71431
72681
  optional: false
71432
72682
  }],
72683
+ "records.count": [{
72684
+ name: "deviceId",
72685
+ form: "single",
72686
+ optional: true
72687
+ }],
72688
+ "records.deleteDevice": [{
72689
+ name: "deviceId",
72690
+ form: "single",
72691
+ optional: false
72692
+ }],
72693
+ "records.deleteWhere": [{
72694
+ name: "deviceId",
72695
+ form: "single",
72696
+ optional: true
72697
+ }],
72698
+ "records.histogram": [{
72699
+ name: "deviceId",
72700
+ form: "single",
72701
+ optional: true
72702
+ }],
72703
+ "records.putMany": [{
72704
+ name: "records",
72705
+ form: "object-array",
72706
+ optional: false,
72707
+ itemField: "deviceId"
72708
+ }],
72709
+ "records.query": [{
72710
+ name: "deviceId",
72711
+ form: "single",
72712
+ optional: true
72713
+ }],
71433
72714
  "sceneMonitor.captureReference": [{
71434
72715
  name: "deviceId",
71435
72716
  form: "single",
@@ -71546,6 +72827,17 @@ Object.freeze({
71546
72827
  form: "single",
71547
72828
  optional: false
71548
72829
  }],
72830
+ "storageAdmin.adoptRecords": [{
72831
+ name: "records",
72832
+ form: "object-array",
72833
+ optional: false,
72834
+ itemField: "deviceId"
72835
+ }],
72836
+ "storageAdmin.readRecords": [{
72837
+ name: "deviceId",
72838
+ form: "single",
72839
+ optional: true
72840
+ }],
71549
72841
  "streamBroker.acquireEgressTranscode": [{
71550
72842
  name: "deviceId",
71551
72843
  form: "single",
@@ -73376,7 +74668,31 @@ function createWasteCalendarSource(deps) {
73376
74668
  }
73377
74669
  //#endregion
73378
74670
  //#region src/waste-catalog.ts
73379
- var catalog = {
74671
+ var catalog = object({
74672
+ generatedAt: string(),
74673
+ sourceHash: string(),
74674
+ countries: array(object({
74675
+ id: string(),
74676
+ label: string()
74677
+ })),
74678
+ services: array(object({
74679
+ id: string(),
74680
+ countryId: string(),
74681
+ label: string(),
74682
+ module: string(),
74683
+ defaultArgs: record(string(), string()),
74684
+ fields: array(object({
74685
+ key: string(),
74686
+ label: string(),
74687
+ required: boolean(),
74688
+ kind: _enum([
74689
+ "text",
74690
+ "number",
74691
+ "boolean"
74692
+ ])
74693
+ }))
74694
+ }))
74695
+ }).parse({
73380
74696
  generatedAt: "2026-10-12T16:54:36.612Z",
73381
74697
  sourceHash: "35f2f21decca0a4beae07ec89164a2ae5ea34ff5832c440a046d79d69b5963ea",
73382
74698
  entries: [
@@ -159243,7 +160559,7 @@ var catalog = {
159243
160559
  }]
159244
160560
  }
159245
160561
  ]
159246
- };
160562
+ });
159247
160563
  function listCatalogCountries() {
159248
160564
  return catalog.countries;
159249
160565
  }
@@ -159370,6 +160686,79 @@ function allocateSourceId(label, existingIds) {
159370
160686
  throw new Error("could not allocate a unique source id");
159371
160687
  }
159372
160688
  //#endregion
160689
+ //#region src/waste-source-record-kinds.ts
160690
+ var WASTE_COLLECTIONS_OWNER = "waste-collections";
160691
+ var WasteSourceBodySchema = entryBody({
160692
+ module: string().min(1),
160693
+ args: preprocess((v) => v ?? {}, record(string(), WasteArgValueSchema)),
160694
+ enabled: boolean().default(true)
160695
+ });
160696
+ var wasteSourceEntryKind = defineEntryKind("waste-source", {
160697
+ title: "Waste collection sources",
160698
+ schema: WasteSourceBodySchema,
160699
+ writeTrigger: "an operator adds or edits a municipal waste calendar source",
160700
+ adoptsFrom: settingsArrayAdoptsFrom(WASTE_COLLECTIONS_OWNER, "sources")
160701
+ });
160702
+ //#endregion
160703
+ //#region src/waste-source-store.ts
160704
+ function rowToSource(id, data) {
160705
+ const parsed = WasteSourceConfigSchema.safeParse({
160706
+ id,
160707
+ label: data.name,
160708
+ module: data.module,
160709
+ args: data.args,
160710
+ enabled: data.enabled
160711
+ });
160712
+ return parsed.success ? parsed.data : null;
160713
+ }
160714
+ var WasteSourceStore = class WasteSourceStore {
160715
+ kind;
160716
+ constructor(kind) {
160717
+ this.kind = kind;
160718
+ }
160719
+ static of(records) {
160720
+ return new WasteSourceStore(records.kind(wasteSourceEntryKind));
160721
+ }
160722
+ async listResolved() {
160723
+ const page = await this.kind.query({ limit: 1e3 });
160724
+ const out = [];
160725
+ for (const record of page.records) {
160726
+ let data = record.data;
160727
+ try {
160728
+ const resolved = await this.kind.getResolved(record.id);
160729
+ if (resolved !== null) data = resolved.data;
160730
+ } catch (err) {
160731
+ if (!(err instanceof RecordSecretUnavailableError)) throw err;
160732
+ }
160733
+ const parsed = WasteSourceBodySchema.safeParse(data);
160734
+ if (!parsed.success) continue;
160735
+ const row = rowToSource(record.id, parsed.data);
160736
+ if (row !== null) out.push(row);
160737
+ }
160738
+ return out;
160739
+ }
160740
+ async replaceAll(sources) {
160741
+ const page = await this.kind.query({ limit: 1e3 });
160742
+ const nextIds = new Set(sources.map((s) => s.id));
160743
+ for (const row of page.records) if (!nextIds.has(row.id)) await this.kind.delete(row.id);
160744
+ for (const source of sources) {
160745
+ const { id, label, module, args, enabled } = source;
160746
+ const body = {
160747
+ name: label,
160748
+ module,
160749
+ args,
160750
+ enabled
160751
+ };
160752
+ const parsed = wasteSourceEntryKind.schema.safeParse(body);
160753
+ if (!parsed.success) throw new Error(`invalid waste source '${id}': ${parsed.error.message}`);
160754
+ await this.kind.put({
160755
+ id,
160756
+ data: parsed.data
160757
+ });
160758
+ }
160759
+ }
160760
+ };
160761
+ //#endregion
159373
160762
  //#region src/waste-collections.addon.ts
159374
160763
  /**
159375
160764
  * Waste Collections — hub-only calendar-source over the vendored HACS
@@ -159384,12 +160773,23 @@ var WasteCollectionsAddon = class extends BaseAddon {
159384
160773
  cache = /* @__PURE__ */ new Map();
159385
160774
  refreshTimer = null;
159386
160775
  refreshInFlight = null;
160776
+ sourceStore = null;
160777
+ activeSources = [];
159387
160778
  constructor() {
159388
160779
  super({ ...DEFAULT_WASTE_CONFIG });
159389
160780
  }
159390
160781
  async onInitialize() {
159391
160782
  this.scriptPath = resolveFetchScript();
159392
160783
  this.loadCacheFromDisk();
160784
+ const records = this.ctx.records;
160785
+ if (records === void 0) throw new Error("waste-collections: ctx.records is required (hub-only addon)");
160786
+ await records.declare({ "waste-source": wasteSourceEntryKind });
160787
+ this.sourceStore = WasteSourceStore.of(records);
160788
+ this.activeSources = await this.loadPersistedSources();
160789
+ if ((await this.sourceStore.listResolved()).length === 0 && this.config.sources.length > 0) {
160790
+ await this.sourceStore.replaceAll(this.parseConfigSources(this.config.sources));
160791
+ this.activeSources = await this.loadPersistedSources();
160792
+ }
159393
160793
  try {
159394
160794
  this.pythonPath = await this.ctx.deps.ensurePython();
159395
160795
  } catch (err) {
@@ -159447,6 +160847,7 @@ var WasteCollectionsAddon = class extends BaseAddon {
159447
160847
  };
159448
160848
  }
159449
160849
  async onConfigChanged() {
160850
+ this.activeSources = await this.loadPersistedSources();
159450
160851
  const ids = new Set(this.configuredSources().map((s) => s.id));
159451
160852
  for (const key of [...this.cache.keys()]) if (!ids.has(key)) this.cache.delete(key);
159452
160853
  this.persistCache();
@@ -159457,15 +160858,36 @@ var WasteCollectionsAddon = class extends BaseAddon {
159457
160858
  * is skipped AND logged: a source that silently vanishes reads as a calendar
159458
160859
  * that never existed.
159459
160860
  */
159460
- configuredSources() {
160861
+ parseConfigSources(rawList) {
159461
160862
  const out = [];
159462
- for (const raw of this.config.sources) {
160863
+ for (const raw of rawList) {
159463
160864
  const parsed = WasteSourceConfigSchema.safeParse(raw);
159464
160865
  if (parsed.success) out.push(parsed.data);
159465
- else this.ctx.logger.warn("waste-collections: a stored source does not parse - skipped", { meta: { sourceId: typeof raw?.id === "string" ? raw.id : null } });
160866
+ 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 } });
159466
160867
  }
159467
160868
  return out;
159468
160869
  }
160870
+ async loadPersistedSources() {
160871
+ const store = this.sourceStore;
160872
+ if (store !== null) {
160873
+ const fromRecords = await store.listResolved();
160874
+ if (fromRecords.length > 0) return fromRecords;
160875
+ }
160876
+ return this.parseConfigSources(this.config.sources);
160877
+ }
160878
+ async persistSources(sources) {
160879
+ this.activeSources = [...sources];
160880
+ const store = this.sourceStore;
160881
+ if (store !== null) {
160882
+ await store.replaceAll(sources);
160883
+ return;
160884
+ }
160885
+ await this.updateGlobalSettings({ sources: [...sources] });
160886
+ }
160887
+ configuredSources() {
160888
+ if (this.activeSources.length > 0) return this.activeSources;
160889
+ return this.parseConfigSources(this.config.sources);
160890
+ }
159469
160891
  listSources() {
159470
160892
  return this.configuredSources().map((s) => {
159471
160893
  let args = {};
@@ -159509,7 +160931,7 @@ var WasteCollectionsAddon = class extends BaseAddon {
159509
160931
  args: this.typedArgs(mergeServiceArgs(service, restoreRedactedArgs(input.args, {}))),
159510
160932
  enabled: input.enabled ?? true
159511
160933
  });
159512
- await this.updateGlobalSettings({ sources: [...this.configuredSources(), row] });
160934
+ await this.persistSources([...this.configuredSources(), row]);
159513
160935
  return { id };
159514
160936
  }
159515
160937
  async updateSource(input) {
@@ -159545,7 +160967,7 @@ var WasteCollectionsAddon = class extends BaseAddon {
159545
160967
  args: this.typedArgs(args),
159546
160968
  enabled: input.enabled ?? prev.enabled
159547
160969
  });
159548
- await this.updateGlobalSettings({ sources: sources.map((s, i) => i === idx ? next : s) });
160970
+ await this.persistSources(sources.map((s, i) => i === idx ? next : s));
159549
160971
  return { ok: true };
159550
160972
  }
159551
160973
  /** Validate an argument bag against the typed value schema (a nested object is refused). */
@@ -159612,7 +161034,7 @@ var WasteCollectionsAddon = class extends BaseAddon {
159612
161034
  remainingRaw: legacy.length
159613
161035
  });
159614
161036
  try {
159615
- await this.updateGlobalSettings({ sources: migrated });
161037
+ await this.persistSources(migrated);
159616
161038
  } catch {
159617
161039
  return report({ failed: legacy.length });
159618
161040
  }
@@ -159652,7 +161074,7 @@ var WasteCollectionsAddon = class extends BaseAddon {
159652
161074
  async deleteSource(input) {
159653
161075
  const sources = this.configuredSources();
159654
161076
  if (!sources.some((s) => s.id === input.id)) throw new Error(`source '${input.id}' not found`);
159655
- await this.updateGlobalSettings({ sources: sources.filter((s) => s.id !== input.id) });
161077
+ await this.persistSources(sources.filter((s) => s.id !== input.id));
159656
161078
  return { ok: true };
159657
161079
  }
159658
161080
  async fetchNow(input) {