@camstack/addon-provider-homeassistant 1.2.173 → 1.2.601

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.
@@ -1,4 +1,4 @@
1
- //#region ../types/dist/event-category-C4hVnRo8.mjs
1
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
2
2
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
3
3
  EventCategory["SystemBoot"] = "system.boot";
4
4
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -62,6 +62,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
62
62
  * consumes this category and maps it to the `addon-crash-loop` kind.
63
63
  */
64
64
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
65
+ /**
66
+ * A runner whose addon refused to start with a typed reason (D877) - parked
67
+ * in `refused`, never counted by the crash breaker, retried on operator
68
+ * action. One event per refusal.
69
+ */
70
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
71
+ /**
72
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
73
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
74
+ * runner is still pending) and the alert centre (close a recovered runner).
75
+ */
76
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
77
+ /**
78
+ * The node's one-shot runner boot check (D877): planned runners against the
79
+ * process service, `degraded` when any is failed, refused or missing. The
80
+ * alert centre turns it into one alert and a direct critical push.
81
+ */
82
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
65
83
  EventCategory["AddonError"] = "addon.error";
66
84
  EventCategory["AddonPageReady"] = "addon.page-ready";
67
85
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -4104,6 +4122,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4104
4122
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4105
4123
  json.type = "boolean";
4106
4124
  };
4125
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4126
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4127
+ };
4128
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4129
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4130
+ };
4107
4131
  var nullProcessor = (_schema, ctx, json, _params) => {
4108
4132
  if (ctx.target === "openapi-3.0") {
4109
4133
  json.type = "string";
@@ -4111,12 +4135,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4111
4135
  json.enum = [null];
4112
4136
  } else json.type = "null";
4113
4137
  };
4138
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4139
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4140
+ };
4114
4141
  var voidProcessor = (_schema, ctx, _json, _params) => {
4115
4142
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4116
4143
  };
4117
4144
  var neverProcessor = (_schema, _ctx, json, _params) => {
4118
4145
  json.not = {};
4119
4146
  };
4147
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4148
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4120
4149
  var dateProcessor = (_schema, ctx, _json, _params) => {
4121
4150
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4122
4151
  };
@@ -4148,12 +4177,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4148
4177
  json.enum = vals;
4149
4178
  }
4150
4179
  };
4180
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4181
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4182
+ };
4183
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4184
+ const _json = json;
4185
+ const pattern = schema._zod.pattern;
4186
+ if (!pattern) throw new Error("Pattern not found in template literal");
4187
+ _json.type = "string";
4188
+ _json.pattern = pattern.source;
4189
+ };
4190
+ var fileProcessor = (schema, _ctx, json, _params) => {
4191
+ const _json = json;
4192
+ const file = {
4193
+ type: "string",
4194
+ format: "binary",
4195
+ contentEncoding: "binary"
4196
+ };
4197
+ const { minimum, maximum, mime } = schema._zod.bag;
4198
+ if (minimum !== void 0) file.minLength = minimum;
4199
+ if (maximum !== void 0) file.maxLength = maximum;
4200
+ if (mime) if (mime.length === 1) {
4201
+ file.contentMediaType = mime[0];
4202
+ Object.assign(_json, file);
4203
+ } else {
4204
+ Object.assign(_json, file);
4205
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4206
+ }
4207
+ else Object.assign(_json, file);
4208
+ };
4209
+ var successProcessor = (_schema, _ctx, json, _params) => {
4210
+ json.type = "boolean";
4211
+ };
4151
4212
  var customProcessor = (_schema, ctx, _json, _params) => {
4152
4213
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4153
4214
  };
4215
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4216
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4217
+ };
4154
4218
  var transformProcessor = (_schema, ctx, _json, _params) => {
4155
4219
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4156
4220
  };
4221
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4222
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4223
+ };
4224
+ var setProcessor = (_schema, ctx, _json, _params) => {
4225
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4226
+ };
4157
4227
  var arrayProcessor = (schema, ctx, _json, params) => {
4158
4228
  const json = _json;
4159
4229
  const def = schema._zod.def;
@@ -4358,6 +4428,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4358
4428
  seen.ref = def.innerType;
4359
4429
  json.readOnly = true;
4360
4430
  };
4431
+ var promiseProcessor = (schema, ctx, _json, params) => {
4432
+ const def = schema._zod.def;
4433
+ process(def.innerType, ctx, params);
4434
+ const seen = ctx.seen.get(schema);
4435
+ seen.ref = def.innerType;
4436
+ };
4361
4437
  var optionalProcessor = (schema, ctx, _json, params) => {
4362
4438
  const def = schema._zod.def;
4363
4439
  process(def.innerType, ctx, params);
@@ -4370,6 +4446,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4370
4446
  const seen = ctx.seen.get(schema);
4371
4447
  seen.ref = innerType;
4372
4448
  };
4449
+ var allProcessors = {
4450
+ string: stringProcessor,
4451
+ number: numberProcessor,
4452
+ boolean: booleanProcessor,
4453
+ bigint: bigintProcessor,
4454
+ symbol: symbolProcessor,
4455
+ null: nullProcessor,
4456
+ undefined: undefinedProcessor,
4457
+ void: voidProcessor,
4458
+ never: neverProcessor,
4459
+ any: anyProcessor,
4460
+ unknown: unknownProcessor,
4461
+ date: dateProcessor,
4462
+ enum: enumProcessor,
4463
+ literal: literalProcessor,
4464
+ nan: nanProcessor,
4465
+ template_literal: templateLiteralProcessor,
4466
+ file: fileProcessor,
4467
+ success: successProcessor,
4468
+ custom: customProcessor,
4469
+ function: functionProcessor,
4470
+ transform: transformProcessor,
4471
+ map: mapProcessor,
4472
+ set: setProcessor,
4473
+ array: arrayProcessor,
4474
+ object: objectProcessor,
4475
+ union: unionProcessor,
4476
+ intersection: intersectionProcessor,
4477
+ tuple: tupleProcessor,
4478
+ record: recordProcessor,
4479
+ nullable: nullableProcessor,
4480
+ nonoptional: nonoptionalProcessor,
4481
+ default: defaultProcessor,
4482
+ prefault: prefaultProcessor,
4483
+ catch: catchProcessor,
4484
+ pipe: pipeProcessor,
4485
+ readonly: readonlyProcessor,
4486
+ promise: promiseProcessor,
4487
+ optional: optionalProcessor,
4488
+ lazy: lazyProcessor
4489
+ };
4490
+ function toJSONSchema(input, params) {
4491
+ if ("_idmap" in input) {
4492
+ const registry = input;
4493
+ const ctx = initializeContext({
4494
+ ...params,
4495
+ processors: allProcessors
4496
+ });
4497
+ const defs = {};
4498
+ for (const entry of registry._idmap.entries()) {
4499
+ const [_, schema] = entry;
4500
+ process(schema, ctx);
4501
+ }
4502
+ const schemas = {};
4503
+ ctx.external = {
4504
+ registry,
4505
+ uri: params?.uri,
4506
+ defs
4507
+ };
4508
+ for (const entry of registry._idmap.entries()) {
4509
+ const [key, schema] = entry;
4510
+ extractDefs(ctx, schema);
4511
+ schemas[key] = finalize(ctx, schema);
4512
+ }
4513
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4514
+ return { schemas };
4515
+ }
4516
+ const ctx = initializeContext({
4517
+ ...params,
4518
+ processors: allProcessors
4519
+ });
4520
+ process(input, ctx);
4521
+ extractDefs(ctx, input);
4522
+ return finalize(ctx, input);
4523
+ }
4373
4524
  //#endregion
4374
4525
  //#region ../../node_modules/zod/v4/classic/iso.js
4375
4526
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5386,7 +5537,7 @@ var ZodIssueCode = {
5386
5537
  var ZodFirstPartyTypeKind;
5387
5538
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5388
5539
  //#endregion
5389
- //#region ../types/dist/sleep-bwsTj221.mjs
5540
+ //#region ../types/dist/sleep-bZIhUvjd.mjs
5390
5541
  /**
5391
5542
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5392
5543
  * window to float samples (D455).
@@ -5503,7 +5654,7 @@ function isKeychainStoredField(field) {
5503
5654
  var SECRET_CLEAR = { $secretClear: true };
5504
5655
  /** The `'***'` token D634 redaction writes for non-admins. */
5505
5656
  var LEGACY_DEVICE_REDACTION = "***";
5506
- function isRecord$2(value) {
5657
+ function isRecord$5(value) {
5507
5658
  return typeof value === "object" && value !== null && !Array.isArray(value);
5508
5659
  }
5509
5660
  function makeSecretMarker(ref) {
@@ -5514,12 +5665,12 @@ function makeSecretMarker(ref) {
5514
5665
  }
5515
5666
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5516
5667
  function isSecretMarker(value) {
5517
- if (!isRecord$2(value)) return false;
5668
+ if (!isRecord$5(value)) return false;
5518
5669
  const ref = value["$secret"];
5519
5670
  return typeof ref === "string" && ref.length > 0;
5520
5671
  }
5521
5672
  function isSecretClear(value) {
5522
- return isRecord$2(value) && value["$secretClear"] === true;
5673
+ return isRecord$5(value) && value["$secretClear"] === true;
5523
5674
  }
5524
5675
  /**
5525
5676
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6129,7 +6280,7 @@ var KeychainWriteRefusedError = class extends Error {
6129
6280
  }
6130
6281
  };
6131
6282
  var KEEP = { kind: "keep" };
6132
- function isRecord$1(value) {
6283
+ function isRecord$4(value) {
6133
6284
  return typeof value === "object" && value !== null && !Array.isArray(value);
6134
6285
  }
6135
6286
  function defaultMintId() {
@@ -6142,7 +6293,7 @@ function collectSecretMarkerRefs(value, out = []) {
6142
6293
  return out;
6143
6294
  }
6144
6295
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6145
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6296
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6146
6297
  return out;
6147
6298
  }
6148
6299
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6197,7 +6348,7 @@ function rowId(row, idKey) {
6197
6348
  return null;
6198
6349
  }
6199
6350
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6200
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6351
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6201
6352
  if (!Array.isArray(incoming)) {
6202
6353
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6203
6354
  return {
@@ -6213,7 +6364,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6213
6364
  const kept = /* @__PURE__ */ new Set();
6214
6365
  const rows = [];
6215
6366
  for (const row of incoming) {
6216
- if (!isRecord$1(row)) {
6367
+ if (!isRecord$4(row)) {
6217
6368
  rows.push(row);
6218
6369
  continue;
6219
6370
  }
@@ -6238,7 +6389,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6238
6389
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6239
6390
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6240
6391
  case "object": {
6241
- if (!isRecord$1(incoming)) {
6392
+ if (!isRecord$4(incoming)) {
6242
6393
  if (incoming === void 0) return KEEP;
6243
6394
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6244
6395
  return {
@@ -6246,7 +6397,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6246
6397
  value: incoming
6247
6398
  };
6248
6399
  }
6249
- const storedObj = isRecord$1(stored) ? stored : {};
6400
+ const storedObj = isRecord$4(stored) ? stored : {};
6250
6401
  return {
6251
6402
  kind: "value",
6252
6403
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6369,7 +6520,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6369
6520
  value: items
6370
6521
  };
6371
6522
  }
6372
- if (isRecord$1(v)) {
6523
+ if (isRecord$4(v)) {
6373
6524
  const out = {};
6374
6525
  for (const [k, child] of Object.entries(v)) {
6375
6526
  const s = substitute(child);
@@ -6401,7 +6552,7 @@ var SecretOverwriteRefusedError = class extends Error {
6401
6552
  this.name = "SecretOverwriteRefusedError";
6402
6553
  }
6403
6554
  };
6404
- function isRecord(value) {
6555
+ function isRecord$3(value) {
6405
6556
  return typeof value === "object" && value !== null && !Array.isArray(value);
6406
6557
  }
6407
6558
  function resolvedValue(pass, marker) {
@@ -6430,7 +6581,7 @@ function inArray(pass, incoming, stored) {
6430
6581
  return incoming.map((item, index) => {
6431
6582
  const twin = stored[index];
6432
6583
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6433
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6584
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6434
6585
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6435
6586
  return item;
6436
6587
  });
@@ -6441,7 +6592,7 @@ function inArrayRow(pass, incoming, stored) {
6441
6592
  const twin = stored[key];
6442
6593
  if (isSecretMarker(twin)) {
6443
6594
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6444
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6595
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6445
6596
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6446
6597
  }
6447
6598
  return out;
@@ -6449,7 +6600,7 @@ function inArrayRow(pass, incoming, stored) {
6449
6600
  async function walk(pass, incoming, stored) {
6450
6601
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6451
6602
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6452
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6603
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6453
6604
  const out = { ...incoming };
6454
6605
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6455
6606
  return out;
@@ -6480,7 +6631,7 @@ async function restoreUnchangedSecrets(input) {
6480
6631
  function isJsonEqual(a, b) {
6481
6632
  if (Object.is(a, b)) return true;
6482
6633
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6483
- if (isRecord(a) && isRecord(b)) {
6634
+ if (isRecord$3(a) && isRecord$3(b)) {
6484
6635
  const keys = Object.keys(a);
6485
6636
  if (keys.length !== Object.keys(b).length) return false;
6486
6637
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6504,7 +6655,7 @@ function markerKeysOf(blob, owner) {
6504
6655
  }
6505
6656
  function nodeFromStored(value, owner) {
6506
6657
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6507
- if (!isRecord(value)) return null;
6658
+ if (!isRecord$3(value)) return null;
6508
6659
  const children = /* @__PURE__ */ new Map();
6509
6660
  for (const [key, child] of Object.entries(value)) {
6510
6661
  const node = nodeFromStored(child, owner);
@@ -7292,7 +7443,7 @@ var BaseAddon = class {
7292
7443
  if (!ctx) return;
7293
7444
  const addonId = ctx.id;
7294
7445
  setImmediate(() => {
7295
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7446
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7296
7447
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7297
7448
  }).catch((err) => {
7298
7449
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7786,6 +7937,356 @@ var PeerBytesTicketSchema = object({
7786
7937
  */
7787
7938
  declaredBytes: number().int().nonnegative().nullable()
7788
7939
  });
7940
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7941
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7942
+ var RECORD_DATABASES = ["settings", "events"];
7943
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7944
+ var RECORD_CLASSES = [
7945
+ "config",
7946
+ "ledger",
7947
+ "audit",
7948
+ "mirror",
7949
+ "ephemeral"
7950
+ ];
7951
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7952
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7953
+ var RECORD_BATCH_MAX = 1e3;
7954
+ var RECORD_QUERY_MAX = 1e3;
7955
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
7956
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
7957
+ var PREFIX = "records/";
7958
+ /** The base of every records failure. `detail` is the human part of the message. */
7959
+ var RecordsError = class extends Error {
7960
+ code;
7961
+ detail;
7962
+ constructor(code, detail) {
7963
+ super(`${PREFIX}${code}: ${detail}`);
7964
+ this.name = "RecordsError";
7965
+ this.code = code;
7966
+ this.detail = detail;
7967
+ }
7968
+ };
7969
+ /** The keychain could not store or serve a value: explicit, never an empty string. */
7970
+ var RecordSecretUnavailableError = class extends RecordsError {
7971
+ constructor(detail) {
7972
+ super("secret-unavailable", detail);
7973
+ this.name = "RecordSecretUnavailableError";
7974
+ }
7975
+ };
7976
+ var InvalidRecordError = class extends RecordsError {
7977
+ constructor(detail) {
7978
+ super("invalid-record", detail);
7979
+ this.name = "InvalidRecordError";
7980
+ }
7981
+ };
7982
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
7983
+ var DeclarationRefusedError = class extends RecordsError {
7984
+ constructor(detail) {
7985
+ super("declaration-refused", detail);
7986
+ this.name = "DeclarationRefusedError";
7987
+ }
7988
+ };
7989
+ function defOf(schema) {
7990
+ const zodBag = Reflect.get(schema, "_zod");
7991
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7992
+ const def = Reflect.get(zodBag, "def");
7993
+ if (typeof def !== "object" || def === null) return {};
7994
+ return def;
7995
+ }
7996
+ function declaredHere(schema) {
7997
+ return globalRegistry.get(schema)?.secret === true;
7998
+ }
7999
+ /** Wrapper kinds whose `innerType` is the field itself. */
8000
+ var WRAPPERS = new Set([
8001
+ "optional",
8002
+ "nullable",
8003
+ "default",
8004
+ "prefault",
8005
+ "catch",
8006
+ "readonly",
8007
+ "nonoptional"
8008
+ ]);
8009
+ /**
8010
+ * The schema layers that make up ONE field: the schema itself and every
8011
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8012
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8013
+ * `.transform` on `in`).
8014
+ */
8015
+ function layersOf(schema) {
8016
+ const out = [];
8017
+ const queue = [schema];
8018
+ while (queue.length > 0) {
8019
+ const s = queue.shift();
8020
+ if (!s || out.includes(s)) continue;
8021
+ out.push(s);
8022
+ const def = defOf(s);
8023
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8024
+ if (def.type === "pipe") {
8025
+ if (def.in) queue.push(def.in);
8026
+ if (def.out) queue.push(def.out);
8027
+ }
8028
+ }
8029
+ return out;
8030
+ }
8031
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8032
+ function isZodSecret(schema) {
8033
+ return layersOf(schema).some(declaredHere);
8034
+ }
8035
+ /**
8036
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8037
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8038
+ * object or array is reported as one path and not descended into — everything
8039
+ * under it is secret.
8040
+ */
8041
+ function collectZodSecretPaths(schema, prefix = "") {
8042
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8043
+ const paths = [];
8044
+ for (const layer of layersOf(schema)) {
8045
+ const def = defOf(layer);
8046
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8047
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8048
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8049
+ else if (def.type === "intersection") {
8050
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8051
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8052
+ }
8053
+ }
8054
+ return [...new Set(paths)];
8055
+ }
8056
+ /**
8057
+ * Secret fields of a record, addressed the way a Zod schema declares them
8058
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8059
+ * (`auth.accessToken`, `headers[].value`).
8060
+ *
8061
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8062
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8063
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8064
+ * leaf names its element: `headers[X-Api].value`.
8065
+ *
8066
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8067
+ */
8068
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8069
+ function parseSecretPath(path) {
8070
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8071
+ return path.split(".").map((raw) => {
8072
+ const each = raw.endsWith("[]");
8073
+ const key = each ? raw.slice(0, -2) : raw;
8074
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8075
+ return {
8076
+ key,
8077
+ each
8078
+ };
8079
+ });
8080
+ }
8081
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8082
+ function secretArrayPrefixes(path) {
8083
+ const segments = parseSecretPath(path);
8084
+ const prefixes = [];
8085
+ const walked = [];
8086
+ for (const segment of segments) {
8087
+ walked.push(segment.key);
8088
+ if (segment.each) prefixes.push(walked.join("."));
8089
+ }
8090
+ return prefixes;
8091
+ }
8092
+ /**
8093
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8094
+ * Zod row schema that describes it, and the helper that turns the two into the
8095
+ * JSON the engine stores.
8096
+ *
8097
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8098
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8099
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
8100
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
8101
+ * never a field name (D879).
8102
+ */
8103
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
8104
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
8105
+ var RecordIndexSchema = object({
8106
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
8107
+ fields: array(RecordFieldPathSchema).min(1).max(4),
8108
+ unique: boolean().optional()
8109
+ }).strict();
8110
+ var RecordRetentionSchema = union([
8111
+ object({
8112
+ ttlMs: number().int().positive(),
8113
+ from: _enum(["at", "write"])
8114
+ }).strict(),
8115
+ object({
8116
+ maxRows: number().int().positive().optional(),
8117
+ maxRowsPerDevice: number().int().positive().optional()
8118
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
8119
+ object({
8120
+ owner: string().min(1),
8121
+ reason: string().min(1)
8122
+ }).strict(),
8123
+ object({ none: string().min(1) }).strict()
8124
+ ]);
8125
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
8126
+ var EntryDescriptorSchema = object({
8127
+ title: string().min(1),
8128
+ /** The record body field shown as the entry's name. */
8129
+ nameField: string().min(1),
8130
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
8131
+ fields: record(string(), unknown())
8132
+ }).strict();
8133
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
8134
+ var RecordKindDeclarationSchema = object({
8135
+ database: _enum(RECORD_DATABASES).default("settings"),
8136
+ class: _enum(RECORD_CLASSES),
8137
+ writeTrigger: string().min(1),
8138
+ device: _enum([
8139
+ "required",
8140
+ "optional",
8141
+ "none"
8142
+ ]).default("none"),
8143
+ at: _enum(["required", "none"]).default("none"),
8144
+ indexes: array(RecordIndexSchema).max(8).default([]),
8145
+ retention: RecordRetentionSchema,
8146
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
8147
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
8148
+ /** Derived from the Zod schema; never written by hand. */
8149
+ secretPaths: array(string().min(1)).default([]),
8150
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
8151
+ secretArrayKeys: record(string(), string()).default({}),
8152
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
8153
+ adoptsFrom: string().min(1).optional(),
8154
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
8155
+ transactFamily: string().min(1).optional(),
8156
+ entry: EntryDescriptorSchema.optional()
8157
+ }).strict();
8158
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8159
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8160
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8161
+ function assertValidDeclaration(name, decl) {
8162
+ const refuse = (why) => {
8163
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8164
+ };
8165
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8166
+ const seen = /* @__PURE__ */ new Set();
8167
+ for (const index of decl.indexes) {
8168
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8169
+ seen.add(index.name);
8170
+ }
8171
+ const { retention } = decl;
8172
+ const hasSecrets = decl.secretPaths.length > 0;
8173
+ if ("ttlMs" in retention) {
8174
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8175
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8176
+ }
8177
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8178
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8179
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8180
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8181
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8182
+ 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)`);
8183
+ }
8184
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8185
+ 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`);
8186
+ }
8187
+ function bodyFieldsOf(schema) {
8188
+ return { ...toJSONSchema(schema, {
8189
+ unrepresentable: "any",
8190
+ io: "input"
8191
+ }) };
8192
+ }
8193
+ function isRecordLike(value) {
8194
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8195
+ }
8196
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8197
+ function hasNameField(json, field) {
8198
+ const branches = json["oneOf"] ?? json["anyOf"];
8199
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8200
+ const properties = json["properties"];
8201
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8202
+ }
8203
+ /**
8204
+ * Declare the kinds of a package. The keys are the kind names. The result is
8205
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8206
+ * types its handle from.
8207
+ */
8208
+ function defineRecordKinds(specs) {
8209
+ const out = {};
8210
+ for (const [name, spec] of Object.entries(specs)) {
8211
+ const secretPaths = collectZodSecretPaths(spec.schema);
8212
+ const nameField = spec.entry?.nameField ?? "name";
8213
+ const fields = bodyFieldsOf(spec.schema);
8214
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8215
+ const parsed = RecordKindDeclarationSchema.parse({
8216
+ database: spec.database,
8217
+ class: spec.class,
8218
+ writeTrigger: spec.writeTrigger,
8219
+ device: spec.device,
8220
+ at: spec.at,
8221
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8222
+ retention: spec.retention,
8223
+ deviceRemoval: spec.deviceRemoval,
8224
+ maxDataBytes: spec.maxDataBytes,
8225
+ secretPaths: [...secretPaths],
8226
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8227
+ adoptsFrom: spec.adoptsFrom,
8228
+ transactFamily: spec.transactFamily,
8229
+ entry: spec.entry === void 0 ? void 0 : {
8230
+ title: spec.entry.title,
8231
+ nameField,
8232
+ fields
8233
+ }
8234
+ });
8235
+ assertValidDeclaration(name, parsed);
8236
+ out[name] = {
8237
+ name,
8238
+ schema: spec.schema,
8239
+ declaration: parsed
8240
+ };
8241
+ }
8242
+ return out;
8243
+ }
8244
+ /**
8245
+ * Entry kinds (D881): every list of user-created entries (notification
8246
+ * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
8247
+ * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
8248
+ * through the `record-entries` capability with password fields derived from
8249
+ * the schema (`.meta({ secret: true })`).
8250
+ */
8251
+ /** The body of a plain entry: a name and the fields the kind adds. */
8252
+ function entryBody(shape) {
8253
+ return object({
8254
+ name: string().min(1),
8255
+ ...shape
8256
+ });
8257
+ }
8258
+ /**
8259
+ * Declare one entry kind. An entry is configuration: never trimmed by the
8260
+ * engine, never aged, belonging to no device.
8261
+ */
8262
+ function defineEntryKind(name, spec) {
8263
+ const defined = defineRecordKinds({ [name]: {
8264
+ schema: spec.schema,
8265
+ class: "config",
8266
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
8267
+ retention: { none: "an entry goes only when the operator deletes it" },
8268
+ ...spec.database === void 0 ? {} : { database: spec.database },
8269
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
8270
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
8271
+ ...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
8272
+ entry: {
8273
+ title: spec.title,
8274
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
8275
+ }
8276
+ } })[name];
8277
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
8278
+ return defined;
8279
+ }
8280
+ /**
8281
+ * Legacy source for broker entry adoption (B2): brokers live in addon-settings
8282
+ * as one row `<addonId>.brokers` whose value is an array until records-adopt
8283
+ * copies them into the entry kind.
8284
+ */
8285
+ var SETTINGS_BROKERS_ADOPTS_PREFIX = "@settings-brokers/";
8286
+ /** The `adoptsFrom` value for an addon's broker entry kind. */
8287
+ function settingsBrokersAdoptsFrom(addonId) {
8288
+ return `${SETTINGS_BROKERS_ADOPTS_PREFIX}${addonId}`;
8289
+ }
7789
8290
  /** Shared Zod schemas used across streaming capabilities. */
7790
8291
  var CamProfileSchema = _enum([
7791
8292
  "high",
@@ -8309,69 +8810,6 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8309
8810
  kind: "mutation",
8310
8811
  auth: "admin"
8311
8812
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8312
- function defOf(schema) {
8313
- return schema._zod?.def ?? {};
8314
- }
8315
- function declaredHere(schema) {
8316
- return globalRegistry.get(schema)?.secret === true;
8317
- }
8318
- /** Wrapper kinds whose `innerType` is the field itself. */
8319
- var WRAPPERS = new Set([
8320
- "optional",
8321
- "nullable",
8322
- "default",
8323
- "prefault",
8324
- "catch",
8325
- "readonly",
8326
- "nonoptional"
8327
- ]);
8328
- /**
8329
- * The schema layers that make up ONE field: the schema itself and every
8330
- * wrapper below it (optional / default / nullable / readonly / catch), plus
8331
- * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8332
- * `.transform` on `in`).
8333
- */
8334
- function layersOf(schema) {
8335
- const out = [];
8336
- const queue = [schema];
8337
- while (queue.length > 0) {
8338
- const s = queue.shift();
8339
- if (!s || out.includes(s)) continue;
8340
- out.push(s);
8341
- const def = defOf(s);
8342
- if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8343
- if (def.type === "pipe") {
8344
- if (def.in) queue.push(def.in);
8345
- if (def.out) queue.push(def.out);
8346
- }
8347
- }
8348
- return out;
8349
- }
8350
- /** True when any layer of this field declares `.meta({ secret: true })`. */
8351
- function isZodSecret(schema) {
8352
- return layersOf(schema).some(declaredHere);
8353
- }
8354
- /**
8355
- * Every declared secret path in a config schema: dotted keys, `[]` for "each
8356
- * element of this array" (`connection.password`, `rows[].token`). A declared
8357
- * object or array is reported as one path and not descended into — everything
8358
- * under it is secret.
8359
- */
8360
- function collectZodSecretPaths(schema, prefix = "") {
8361
- if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8362
- const paths = [];
8363
- for (const layer of layersOf(schema)) {
8364
- const def = defOf(layer);
8365
- if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8366
- else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8367
- else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8368
- else if (def.type === "intersection") {
8369
- if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8370
- if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8371
- }
8372
- }
8373
- return [...new Set(paths)];
8374
- }
8375
8813
  object({
8376
8814
  code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8377
8815
  params: record(string(), union([string(), number()])).optional()
@@ -15878,6 +16316,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15878
16316
  keyField: string()
15879
16317
  }).optional()
15880
16318
  })) });
16319
+ /**
16320
+ * The report of a one-shot "move this owner's plaintext secrets into the
16321
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16322
+ *
16323
+ * The owner runs it on its own rows, through its own write path; an operator
16324
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16325
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16326
+ */
16327
+ var RawSecretMigrationInputSchema = object({
16328
+ /** `false` (the default of the script) = report only. */
16329
+ apply: boolean() });
16330
+ var RawSecretMigrationReportSchema = object({
16331
+ apply: boolean(),
16332
+ /** Rows that can carry a secret (a profile, an enrolment). */
16333
+ rows: number().int(),
16334
+ /** Rows whose secret was plaintext when the run started. */
16335
+ raw: number().int(),
16336
+ /** Rows that already held a keychain marker when the run started. */
16337
+ markers: number().int(),
16338
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16339
+ migrated: number().int(),
16340
+ /** Plaintext rows left in place because the move or its read-back failed. */
16341
+ failed: number().int(),
16342
+ /** After the run: rows still holding plaintext. */
16343
+ remainingRaw: number().int(),
16344
+ /** After the run: markers the keychain could not resolve right now. */
16345
+ unresolvedMarkers: number().int(),
16346
+ /**
16347
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16348
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16349
+ */
16350
+ redundantCopies: number().int().optional(),
16351
+ /** True when nothing is raw and every marker resolves. */
16352
+ verified: boolean()
16353
+ });
15881
16354
  /** Where a block runs. The operator chooses — a block driving a device on an
15882
16355
  * agent is the reason placement is not fixed to the hub. */
15883
16356
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -16104,6 +16577,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
16104
16577
  }), SettingsUpdateResultSchema, {
16105
16578
  kind: "mutation",
16106
16579
  auth: "admin"
16580
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16581
+ kind: "mutation",
16582
+ auth: "admin"
16107
16583
  }), method(object({}), object({ libs: array(object({
16108
16584
  filePath: string(),
16109
16585
  content: string()
@@ -16366,6 +16842,222 @@ id: union([string(), number()]) }), {
16366
16842
  kind: "mutation",
16367
16843
  auth: "admin"
16368
16844
  });
16845
+ /**
16846
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16847
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16848
+ * (operator intent, D870) and device-history (numbers over time, D850).
16849
+ *
16850
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16851
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16852
+ * that with the addon id closed over). It is deliberately NOT in any input
16853
+ * schema, so a session can never supply it, and a call with no stamp is refused
16854
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16855
+ * addons go through the owner's capability.
16856
+ *
16857
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16858
+ * never `[]`. Secret fields are never on the wire: a read shows the
16859
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16860
+ * resolves itself, and a write may carry only a keychain marker bound to the
16861
+ * row's own ref.
16862
+ *
16863
+ * Internal: addons reach it through `ctx.records`, never directly.
16864
+ */
16865
+ var RecordIdSchema = string().min(1).max(256);
16866
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16867
+ var RecordBodySchema = record(string(), unknown());
16868
+ var RecordInputSchema = object({
16869
+ id: RecordIdSchema,
16870
+ /** The device this row belongs to (D865 removal, per-device reads). */
16871
+ deviceId: number().int().optional(),
16872
+ /** The domain clock, ms: observed / created / opened. */
16873
+ at: number().int().optional(),
16874
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16875
+ expiresAt: number().int().optional(),
16876
+ data: RecordBodySchema
16877
+ });
16878
+ var RecordViewSchema = object({
16879
+ id: string(),
16880
+ deviceId: number().int().nullable(),
16881
+ at: number().nullable(),
16882
+ expiresAt: number().nullable(),
16883
+ rev: number().int(),
16884
+ updatedAt: number(),
16885
+ data: RecordBodySchema
16886
+ });
16887
+ /** Declared index fields only. Anything else does not compile, by design. */
16888
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16889
+ string(),
16890
+ number(),
16891
+ boolean(),
16892
+ object({ in: array(union([
16893
+ string(),
16894
+ number(),
16895
+ boolean()
16896
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16897
+ object({
16898
+ gt: union([string(), number()]).optional(),
16899
+ gte: union([string(), number()]).optional(),
16900
+ lt: union([string(), number()]).optional(),
16901
+ lte: union([string(), number()]).optional()
16902
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16903
+ ]));
16904
+ var KindShape = { kind: RecordKindNameSchema };
16905
+ var TimeWindowShape = {
16906
+ deviceId: number().int().optional(),
16907
+ atFrom: number().optional(),
16908
+ atTo: number().optional()
16909
+ };
16910
+ var RecordQueryInputSchema = object({
16911
+ ...KindShape,
16912
+ ...TimeWindowShape,
16913
+ where: RecordWhereSchema.optional(),
16914
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16915
+ order: _enum(["at", "id"]).optional(),
16916
+ desc: boolean().optional(),
16917
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16918
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16919
+ cursor: string().min(1).optional()
16920
+ });
16921
+ var RecordQueryResultSchema = object({
16922
+ records: array(RecordViewSchema),
16923
+ nextCursor: string().nullable()
16924
+ });
16925
+ var RecordKindStateSchema = _enum([
16926
+ "created",
16927
+ "unchanged",
16928
+ "updated"
16929
+ ]);
16930
+ var DeclareKindResultSchema = object({
16931
+ kindId: number().int(),
16932
+ state: RecordKindStateSchema,
16933
+ createdIndexes: array(string()),
16934
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16935
+ adoptionPending: object({
16936
+ legacyTable: string(),
16937
+ legacyRows: number().int()
16938
+ }).nullable()
16939
+ });
16940
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16941
+ var SecretRefsList = array(string());
16942
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16943
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16944
+ kind: "mutation",
16945
+ auth: "admin"
16946
+ }), method(object({
16947
+ ...KindShape,
16948
+ id: RecordIdSchema
16949
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16950
+ ...KindShape,
16951
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16952
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16953
+ ...KindShape,
16954
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16955
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16956
+ ...KindShape,
16957
+ record: RecordInputSchema,
16958
+ /** Compare-and-set. `0` means "the row must not exist". */
16959
+ ifRev: number().int().min(0).optional()
16960
+ }), object({
16961
+ rev: number().int(),
16962
+ releasedRefs: SecretRefsList
16963
+ }), {
16964
+ kind: "mutation",
16965
+ auth: "admin"
16966
+ }), method(object({
16967
+ ...KindShape,
16968
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16969
+ }), object({
16970
+ count: number().int(),
16971
+ releasedRefs: SecretRefsList
16972
+ }), {
16973
+ kind: "mutation",
16974
+ auth: "admin"
16975
+ }), method(object({
16976
+ ...KindShape,
16977
+ id: RecordIdSchema,
16978
+ data: RecordBodySchema,
16979
+ at: number().int().nullable().optional(),
16980
+ expiresAt: number().int().nullable().optional(),
16981
+ ifRev: number().int().min(1).optional()
16982
+ }), object({
16983
+ rev: number().int(),
16984
+ releasedRefs: SecretRefsList
16985
+ }), {
16986
+ kind: "mutation",
16987
+ auth: "admin"
16988
+ }), method(object({
16989
+ ...KindShape,
16990
+ id: RecordIdSchema
16991
+ }), object({
16992
+ deleted: boolean(),
16993
+ secretRefs: SecretRefsList
16994
+ }), {
16995
+ kind: "mutation",
16996
+ auth: "admin"
16997
+ }), method(object({
16998
+ ...KindShape,
16999
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17000
+ }), object({
17001
+ deleted: number().int(),
17002
+ secretRefs: SecretRefsList
17003
+ }), {
17004
+ kind: "mutation",
17005
+ auth: "admin"
17006
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
17007
+ ...KindShape,
17008
+ ...TimeWindowShape,
17009
+ where: RecordWhereSchema.optional()
17010
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
17011
+ ...KindShape,
17012
+ deviceId: number().int().optional(),
17013
+ from: number(),
17014
+ to: number(),
17015
+ bucketMs: number().int().positive()
17016
+ }), object({ buckets: array(object({
17017
+ bucketStart: number(),
17018
+ count: number().int()
17019
+ })) }), { auth: "admin" }), method(object({
17020
+ ...KindShape,
17021
+ op: _enum([
17022
+ "sum",
17023
+ "min",
17024
+ "max",
17025
+ "count"
17026
+ ]),
17027
+ field: RecordFieldPathSchema.optional(),
17028
+ groupBy: RecordFieldPathSchema.optional(),
17029
+ where: RecordWhereSchema.optional()
17030
+ }), object({ rows: array(object({
17031
+ group: union([
17032
+ string(),
17033
+ number(),
17034
+ _null()
17035
+ ]),
17036
+ value: number().nullable()
17037
+ })) }), { auth: "admin" }), method(object({
17038
+ ...KindShape,
17039
+ deviceId: number().int().optional(),
17040
+ atBefore: number().optional(),
17041
+ where: RecordWhereSchema.optional()
17042
+ }), object({
17043
+ deleted: number().int(),
17044
+ secretRefs: SecretRefsList
17045
+ }), {
17046
+ kind: "mutation",
17047
+ auth: "admin"
17048
+ }), method(object({
17049
+ deviceId: number().int(),
17050
+ kinds: array(RecordKindNameSchema).optional()
17051
+ }), object({
17052
+ deleted: record(string(), number().int()),
17053
+ secretRefs: SecretRefsList
17054
+ }), {
17055
+ kind: "mutation",
17056
+ auth: "admin"
17057
+ }), method(object(KindShape), object({ id: number().int() }), {
17058
+ kind: "mutation",
17059
+ auth: "admin"
17060
+ });
16369
17061
  /** One table of the settings database. */
16370
17062
  var StorageTableSchema = object({
16371
17063
  /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
@@ -16378,6 +17070,28 @@ var StorageTableSchema = object({
16378
17070
  /** Declared by an addon since this engine process started (a running addon claims it). */
16379
17071
  declaredThisBoot: boolean()
16380
17072
  });
17073
+ /** One declared record kind (D881) as System -> Data shows it. */
17074
+ var StorageKindSchema = object({
17075
+ owner: string(),
17076
+ kind: string(),
17077
+ database: _enum(["settings", "events"]),
17078
+ class: string(),
17079
+ state: _enum([
17080
+ "declared",
17081
+ "orphaned",
17082
+ "dropped"
17083
+ ]),
17084
+ /** `null` when the caller asked for no counts (`counts: false`). */
17085
+ rows: number().int().nonnegative().nullable(),
17086
+ /** Rows x the average size of a sample; null for an empty kind. */
17087
+ bytesEstimate: number().int().nonnegative().nullable(),
17088
+ writeTrigger: string(),
17089
+ retention: RecordRetentionSchema,
17090
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
17091
+ entry: boolean(),
17092
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
17093
+ declaration: RecordKindDeclarationSchema
17094
+ });
16381
17095
  method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16382
17096
  collection: string().min(1),
16383
17097
  expectRows: number().int().nonnegative()
@@ -16387,6 +17101,87 @@ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: arr
16387
17101
  }), {
16388
17102
  kind: "mutation",
16389
17103
  auth: "admin"
17104
+ }), method(object({
17105
+ owner: string().min(1).optional(),
17106
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
17107
+ counts: boolean().optional()
17108
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
17109
+ owner: string().min(1),
17110
+ kind: RecordKindNameSchema
17111
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
17112
+ owner: string().min(1),
17113
+ kind: RecordKindNameSchema,
17114
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
17115
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
17116
+ complete: boolean().optional()
17117
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
17118
+ kind: "mutation",
17119
+ auth: "admin"
17120
+ }), method(object({
17121
+ collection: string().min(1),
17122
+ cursor: string().optional(),
17123
+ limit: number().int().min(1).max(1e3).optional()
17124
+ }), object({
17125
+ rows: array(object({
17126
+ id: string(),
17127
+ data: record(string(), unknown())
17128
+ })),
17129
+ nextCursor: string().nullable()
17130
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
17131
+ /**
17132
+ * record-entries - the ONE admin surface for every list of user-created entries
17133
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
17134
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
17135
+ *
17136
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
17137
+ * the entry body with `secret: true` on every credential field, so a password
17138
+ * field is derived from the schema and never from a name. `putEntry` takes the
17139
+ * redaction token for an untouched secret (the stored value is kept), a string
17140
+ * for a new one, and the clear instruction to remove one. A read never carries
17141
+ * a secret value, and a locked keychain refuses the write with
17142
+ * `records/secret-unavailable` instead of storing plaintext.
17143
+ *
17144
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
17145
+ */
17146
+ var EntryKindInfoSchema = object({
17147
+ owner: string(),
17148
+ kind: RecordKindNameSchema,
17149
+ title: string(),
17150
+ nameField: string(),
17151
+ /** JSON Schema of the body; `secret: true` marks a password field. */
17152
+ fields: record(string(), unknown()),
17153
+ secretPaths: array(string()),
17154
+ rows: number().int().nonnegative()
17155
+ });
17156
+ var EntryViewSchema = object({
17157
+ id: RecordIdSchema,
17158
+ name: string(),
17159
+ rev: number().int(),
17160
+ updatedAt: number(),
17161
+ /** Secret fields hold the redaction token. */
17162
+ data: RecordBodySchema
17163
+ });
17164
+ var EntryAddress = {
17165
+ owner: string().min(1),
17166
+ kind: RecordKindNameSchema
17167
+ };
17168
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
17169
+ ...EntryAddress,
17170
+ id: RecordIdSchema.optional(),
17171
+ data: RecordBodySchema,
17172
+ ifRev: number().int().min(1).optional()
17173
+ }), object({
17174
+ id: string(),
17175
+ rev: number().int()
17176
+ }), {
17177
+ kind: "mutation",
17178
+ auth: "admin"
17179
+ }), method(object({
17180
+ ...EntryAddress,
17181
+ id: RecordIdSchema
17182
+ }), object({ deleted: boolean() }), {
17183
+ kind: "mutation",
17184
+ auth: "admin"
16390
17185
  });
16391
17186
  /**
16392
17187
  * `keychain` — the hub's encrypted store of secret values (D787).
@@ -39834,6 +40629,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39834
40629
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39835
40630
  kind: "mutation",
39836
40631
  auth: "admin"
40632
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40633
+ kind: "mutation",
40634
+ auth: "admin"
39837
40635
  }), method(ProfileRefInputSchema, _void(), {
39838
40636
  kind: "mutation",
39839
40637
  auth: "admin"
@@ -50381,6 +51179,41 @@ var ServerRollbackInfoSchema = object({
50381
51179
  atMs: number(),
50382
51180
  reason: string()
50383
51181
  });
51182
+ /**
51183
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
51184
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
51185
+ * service holds, because only the hub plans) against the states the process
51186
+ * service reports. Kept in memory, recomputed by the same one-shot check after
51187
+ * every boot, served on `getServerPackageStatus`.
51188
+ *
51189
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
51190
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
51191
+ * planned runner the process service has no entry for.
51192
+ */
51193
+ var RunnerRefusalSchema = object({
51194
+ runnerId: string(),
51195
+ addonIds: array(string()),
51196
+ reason: string()
51197
+ });
51198
+ var RunnerBootCheckSchema = object({
51199
+ checkedAtMs: number(),
51200
+ /** Runners planned for this node. */
51201
+ expected: number(),
51202
+ /** Planned runners whose process is `running`. */
51203
+ running: number(),
51204
+ failed: array(string()),
51205
+ refused: array(RunnerRefusalSchema),
51206
+ missing: array(string()),
51207
+ /**
51208
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
51209
+ * respawn. The check is FINAL only when this is empty; until then nothing is
51210
+ * pushed and the verdict is re-evaluated on the next runner state change.
51211
+ * Optional for version skew (absent = settled).
51212
+ */
51213
+ pending: array(string()).optional(),
51214
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
51215
+ planKnown: boolean()
51216
+ });
50384
51217
  var ServerPackageStatusSchema = object({
50385
51218
  /** Root package name (`@camstack/server` on the hub). */
50386
51219
  packageName: string(),
@@ -50443,7 +51276,14 @@ var ServerPackageStatusSchema = object({
50443
51276
  * for version skew: an older provider's payload simply omits it, and an
50444
51277
  * absent wrapper is unknown — never `native`.
50445
51278
  */
50446
- wrapper: WrapperIdentitySchema.optional()
51279
+ wrapper: WrapperIdentitySchema.optional(),
51280
+ /**
51281
+ * What this node PLANNED to run against what its process service reports
51282
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
51283
+ * on a provider that predates it. Absent is "not checked yet", never "all
51284
+ * well": a consumer that needs the answer treats it as pending.
51285
+ */
51286
+ runners: RunnerBootCheckSchema.optional()
50447
51287
  });
50448
51288
  var ServerUpdateCheckResultSchema = object({
50449
51289
  packageName: string(),
@@ -50494,6 +51334,13 @@ var ServerUpdateOutcomeSchema = _enum([
50494
51334
  "refused",
50495
51335
  "failed"
50496
51336
  ]);
51337
+ /** One addon the pre-flight found the target version would refuse (D877). */
51338
+ var UpdateBlockerSchema = object({
51339
+ addonId: string(),
51340
+ reason: string(),
51341
+ /** What the operator does about it. */
51342
+ remedy: string()
51343
+ });
50497
51344
  var ServerUpdateActionResultSchema = object({
50498
51345
  accepted: boolean(),
50499
51346
  targetVersion: string().nullable(),
@@ -50511,14 +51358,27 @@ var ServerUpdateActionResultSchema = object({
50511
51358
  * The failure itself, verbatim enough to act on (the npm output for a
50512
51359
  * staging install). Non-null only for `failed`.
50513
51360
  */
50514
- error: string().nullable().optional()
51361
+ error: string().nullable().optional(),
51362
+ /**
51363
+ * The addons the target version would refuse to start on this node's live
51364
+ * store (D877), present when the pre-flight refused the update
51365
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
51366
+ */
51367
+ blockers: array(UpdateBlockerSchema).optional()
50515
51368
  });
50516
51369
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
50517
51370
  kind: "mutation",
50518
51371
  auth: "admin"
50519
- }), method(object({
50520
- /** Explicit target version; omitted = latest from the registry. */
50521
- version: string().optional() }), ServerUpdateActionResultSchema, {
51372
+ }), method(object({
51373
+ /** Explicit target version; omitted = latest from the registry. */
51374
+ version: string().optional(),
51375
+ /**
51376
+ * Apply even though the pre-flight (D877) found addons the target would
51377
+ * refuse to start. Off by default: those addons stay down until the
51378
+ * remedy is run, which is the incident this gate exists to prevent.
51379
+ */
51380
+ acknowledgeRefusals: boolean().optional()
51381
+ }), ServerUpdateActionResultSchema, {
50522
51382
  kind: "mutation",
50523
51383
  auth: "admin",
50524
51384
  timeoutMs: 16 * 6e4
@@ -53036,7 +53896,9 @@ var ManifestShapeSchema = object({
53036
53896
  var AddonProcessSchema = object({
53037
53897
  pid: number().optional(),
53038
53898
  mode: string(),
53039
- state: string()
53899
+ state: string(),
53900
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53901
+ reason: string().optional()
53040
53902
  });
53041
53903
  /**
53042
53904
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -63802,7 +64664,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
63802
64664
  kind: "mutation",
63803
64665
  auth: "admin",
63804
64666
  access: "delete"
63805
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
64667
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
64668
+ kind: "mutation",
64669
+ auth: "admin",
64670
+ access: "create"
64671
+ }), method(object({
63806
64672
  userId: string(),
63807
64673
  code: string()
63808
64674
  }), object({ valid: boolean() }), {
@@ -65614,13 +66480,14 @@ var BaseDevice = class {
65614
66480
  get state() {
65615
66481
  if (!this._stateProxyCache) {
65616
66482
  const cache = {};
65617
- const handler = { get: (_target, key) => {
66483
+ const handler = { get: (target, key) => {
65618
66484
  const k = key;
65619
- if (k in cache) return cache[k];
66485
+ const existing = Reflect.get(target, k);
66486
+ if (existing !== void 0) return existing;
65620
66487
  const cap = DEVICE_LOCAL_STATE_CAPS[k];
65621
66488
  if (!cap) return void 0;
65622
66489
  const proxy = this.sliceProxy(cap);
65623
- cache[k] = proxy;
66490
+ Reflect.set(target, k, proxy);
65624
66491
  return proxy;
65625
66492
  } };
65626
66493
  this._stateProxyCache = new Proxy(cache, handler);
@@ -65819,7 +66686,7 @@ var BaseDevice = class {
65819
66686
  async updateSourceInfo(patch) {
65820
66687
  const next = mergeSourceInfo(this.sourceInfo, patch);
65821
66688
  this._sourceInfoCache = Object.freeze({ ...next });
65822
- const action = this.ctx.api?.deviceManager?.setMetadata;
66689
+ const action = this.ctx.api.deviceManager?.setMetadata;
65823
66690
  if (action) try {
65824
66691
  await action.mutate({
65825
66692
  deviceId: this.id,
@@ -65854,7 +66721,7 @@ var BaseDevice = class {
65854
66721
  * device boot on a meta refresh.
65855
66722
  */
65856
66723
  async refreshFeatures() {
65857
- const action = this.ctx.api?.deviceManager?.registerDevice;
66724
+ const action = this.ctx.api.deviceManager?.registerDevice;
65858
66725
  if (!action) return;
65859
66726
  try {
65860
66727
  await action.mutate({
@@ -67928,6 +68795,12 @@ Object.freeze({
67928
68795
  addonId: null,
67929
68796
  access: "view"
67930
68797
  },
68798
+ "coreBlocks.migrateRawSecrets": {
68799
+ capName: "core-blocks",
68800
+ capScope: "system",
68801
+ addonId: null,
68802
+ access: "create"
68803
+ },
67931
68804
  "coreBlocks.restart": {
67932
68805
  capName: "core-blocks",
67933
68806
  capScope: "system",
@@ -69788,6 +70661,12 @@ Object.freeze({
69788
70661
  addonId: null,
69789
70662
  access: "view"
69790
70663
  },
70664
+ "llm.migrateRawSecrets": {
70665
+ capName: "llm",
70666
+ capScope: "system",
70667
+ addonId: null,
70668
+ access: "create"
70669
+ },
69791
70670
  "llm.resolveModelRef": {
69792
70671
  capName: "llm",
69793
70672
  capScope: "system",
@@ -72674,6 +73553,30 @@ Object.freeze({
72674
73553
  addonId: null,
72675
73554
  access: "create"
72676
73555
  },
73556
+ "recordEntries.deleteEntry": {
73557
+ capName: "record-entries",
73558
+ capScope: "system",
73559
+ addonId: null,
73560
+ access: "delete"
73561
+ },
73562
+ "recordEntries.listEntries": {
73563
+ capName: "record-entries",
73564
+ capScope: "system",
73565
+ addonId: null,
73566
+ access: "view"
73567
+ },
73568
+ "recordEntries.listEntryKinds": {
73569
+ capName: "record-entries",
73570
+ capScope: "system",
73571
+ addonId: null,
73572
+ access: "view"
73573
+ },
73574
+ "recordEntries.putEntry": {
73575
+ capName: "record-entries",
73576
+ capScope: "system",
73577
+ addonId: null,
73578
+ access: "create"
73579
+ },
72677
73580
  "recording.getAvailability": {
72678
73581
  capName: "recording",
72679
73582
  capScope: "device",
@@ -72974,6 +73877,102 @@ Object.freeze({
72974
73877
  addonId: null,
72975
73878
  access: "view"
72976
73879
  },
73880
+ "records.aggregate": {
73881
+ capName: "records",
73882
+ capScope: "system",
73883
+ addonId: null,
73884
+ access: "view"
73885
+ },
73886
+ "records.allocateId": {
73887
+ capName: "records",
73888
+ capScope: "system",
73889
+ addonId: null,
73890
+ access: "create"
73891
+ },
73892
+ "records.count": {
73893
+ capName: "records",
73894
+ capScope: "system",
73895
+ addonId: null,
73896
+ access: "view"
73897
+ },
73898
+ "records.declareKinds": {
73899
+ capName: "records",
73900
+ capScope: "system",
73901
+ addonId: null,
73902
+ access: "create"
73903
+ },
73904
+ "records.delete": {
73905
+ capName: "records",
73906
+ capScope: "system",
73907
+ addonId: null,
73908
+ access: "delete"
73909
+ },
73910
+ "records.deleteDevice": {
73911
+ capName: "records",
73912
+ capScope: "system",
73913
+ addonId: null,
73914
+ access: "delete"
73915
+ },
73916
+ "records.deleteMany": {
73917
+ capName: "records",
73918
+ capScope: "system",
73919
+ addonId: null,
73920
+ access: "delete"
73921
+ },
73922
+ "records.deleteWhere": {
73923
+ capName: "records",
73924
+ capScope: "system",
73925
+ addonId: null,
73926
+ access: "delete"
73927
+ },
73928
+ "records.get": {
73929
+ capName: "records",
73930
+ capScope: "system",
73931
+ addonId: null,
73932
+ access: "view"
73933
+ },
73934
+ "records.getMany": {
73935
+ capName: "records",
73936
+ capScope: "system",
73937
+ addonId: null,
73938
+ access: "view"
73939
+ },
73940
+ "records.histogram": {
73941
+ capName: "records",
73942
+ capScope: "system",
73943
+ addonId: null,
73944
+ access: "view"
73945
+ },
73946
+ "records.patch": {
73947
+ capName: "records",
73948
+ capScope: "system",
73949
+ addonId: null,
73950
+ access: "create"
73951
+ },
73952
+ "records.put": {
73953
+ capName: "records",
73954
+ capScope: "system",
73955
+ addonId: null,
73956
+ access: "create"
73957
+ },
73958
+ "records.putMany": {
73959
+ capName: "records",
73960
+ capScope: "system",
73961
+ addonId: null,
73962
+ access: "create"
73963
+ },
73964
+ "records.query": {
73965
+ capName: "records",
73966
+ capScope: "system",
73967
+ addonId: null,
73968
+ access: "view"
73969
+ },
73970
+ "records.secretRefs": {
73971
+ capName: "records",
73972
+ capScope: "system",
73973
+ addonId: null,
73974
+ access: "view"
73975
+ },
72977
73976
  "sceneMonitor.captureReference": {
72978
73977
  capName: "scene-monitor",
72979
73978
  capScope: "device",
@@ -73406,18 +74405,48 @@ Object.freeze({
73406
74405
  addonId: null,
73407
74406
  access: "create"
73408
74407
  },
74408
+ "storageAdmin.adoptRecords": {
74409
+ capName: "storage-admin",
74410
+ capScope: "system",
74411
+ addonId: null,
74412
+ access: "create"
74413
+ },
73409
74414
  "storageAdmin.dropCollection": {
73410
74415
  capName: "storage-admin",
73411
74416
  capScope: "system",
73412
74417
  addonId: null,
73413
74418
  access: "delete"
73414
74419
  },
74420
+ "storageAdmin.isAdoptedLegacyTable": {
74421
+ capName: "storage-admin",
74422
+ capScope: "system",
74423
+ addonId: null,
74424
+ access: "view"
74425
+ },
74426
+ "storageAdmin.listKinds": {
74427
+ capName: "storage-admin",
74428
+ capScope: "system",
74429
+ addonId: null,
74430
+ access: "view"
74431
+ },
73415
74432
  "storageAdmin.listTables": {
73416
74433
  capName: "storage-admin",
73417
74434
  capScope: "system",
73418
74435
  addonId: null,
73419
74436
  access: "view"
73420
74437
  },
74438
+ "storageAdmin.readLegacyCollection": {
74439
+ capName: "storage-admin",
74440
+ capScope: "system",
74441
+ addonId: null,
74442
+ access: "view"
74443
+ },
74444
+ "storageAdmin.readRecords": {
74445
+ capName: "storage-admin",
74446
+ capScope: "system",
74447
+ addonId: null,
74448
+ access: "view"
74449
+ },
73421
74450
  "storageEvictable.evict": {
73422
74451
  capName: "storage-evictable",
73423
74452
  capScope: "system",
@@ -74330,6 +75359,12 @@ Object.freeze({
74330
75359
  addonId: null,
74331
75360
  access: "view"
74332
75361
  },
75362
+ "userManagement.migrateRawSecrets": {
75363
+ capName: "user-management",
75364
+ capScope: "system",
75365
+ addonId: null,
75366
+ access: "create"
75367
+ },
74333
75368
  "userManagement.oauthExchangeCode": {
74334
75369
  capName: "user-management",
74335
75370
  capScope: "system",
@@ -77006,6 +78041,37 @@ Object.freeze({
77006
78041
  form: "single",
77007
78042
  optional: false
77008
78043
  }],
78044
+ "records.count": [{
78045
+ name: "deviceId",
78046
+ form: "single",
78047
+ optional: true
78048
+ }],
78049
+ "records.deleteDevice": [{
78050
+ name: "deviceId",
78051
+ form: "single",
78052
+ optional: false
78053
+ }],
78054
+ "records.deleteWhere": [{
78055
+ name: "deviceId",
78056
+ form: "single",
78057
+ optional: true
78058
+ }],
78059
+ "records.histogram": [{
78060
+ name: "deviceId",
78061
+ form: "single",
78062
+ optional: true
78063
+ }],
78064
+ "records.putMany": [{
78065
+ name: "records",
78066
+ form: "object-array",
78067
+ optional: false,
78068
+ itemField: "deviceId"
78069
+ }],
78070
+ "records.query": [{
78071
+ name: "deviceId",
78072
+ form: "single",
78073
+ optional: true
78074
+ }],
77009
78075
  "sceneMonitor.captureReference": [{
77010
78076
  name: "deviceId",
77011
78077
  form: "single",
@@ -77122,6 +78188,17 @@ Object.freeze({
77122
78188
  form: "single",
77123
78189
  optional: false
77124
78190
  }],
78191
+ "storageAdmin.adoptRecords": [{
78192
+ name: "records",
78193
+ form: "object-array",
78194
+ optional: false,
78195
+ itemField: "deviceId"
78196
+ }],
78197
+ "storageAdmin.readRecords": [{
78198
+ name: "deviceId",
78199
+ form: "single",
78200
+ optional: true
78201
+ }],
77125
78202
  "streamBroker.acquireEgressTranscode": [{
77126
78203
  name: "deviceId",
77127
78204
  form: "single",
@@ -78831,4 +79908,4 @@ function bestLocationMatch(externalName, existing, threshold = .8) {
78831
79908
  var MB = 1024 * 1024;
78832
79909
  1024 * MB, 3072 * MB;
78833
79910
  //#endregion
78834
- export { oauthIntegrationCapability as $, connectivityCapability as A, record as At, floodCapability as B, buildAddonRouteProvider as C, _enum as Ct, carbonMonoxideCapability as D, literal as Dt, calendarSourceCapability as E, discriminatedUnion as Et, deviceAdoptionCapability as F, EventCategory as Ft, lawnMowerControlCapability as G, humidifierCapability as H, deviceExportCapability as I, motionCapability as J, lockControlCapability as K, enumSensorCapability as L, controlCapability as M, union as Mt, coverCapability as N, unknown as Nt, climateControlCapability as O, number as Ot, deviceAdminLinkCapability as P, url as Pt, numericSensorCapability as Q, eventEmitterCapability as R, brokerCapability as S, nodePin as St, buttonCapability as T, boolean as Tt, humiditySensorCapability as U, gasCapability as V, imageCapability as W, notificationOutputCapability as X, normalizeUnit as Y, notifierCapability as Z, automationControlCapability as _, DeviceRole as _t, COCO_TO_MACRO as a, scriptRunnerCapability as at, binaryCapability as b, BaseAddon as bt, FanDirectionSchema as c, tamperCapability as ct, TargetSchema as d, vacuumControlCapability as dt, parseAdminBase as et, accessoriesCapability as f, valveCapability as ft, ambientLightSensorCapability as g, DeviceFeature as gt, alarmPanelCapability as h, weatherCapability as ht, CAMERA_SWITCH_ORDER as i, pressureSensorCapability as it, contactCapability as j, string as jt, colorCapability as k, object as kt, HvacModeSchema as l, temperatureSensorCapability as lt, airQualitySensorCapability as m, waterHeaterCapability as mt, BaseDevice as n, prepareNotification as nt, CameraSwitchIdSchema as o, smokeCapability as ot, addonRoutesCapability as p, vibrationCapability as pt, mediaPlayerCapability as q, BaseDeviceProvider as r, presenceCapability as rt, EnumSensorDateTimeFormatSchema as s, switchCapability as st, AlarmArmModeSchema as t, powerMeterCapability as tt, MediaPlayerRepeatSchema as u, updateCapability as ut, batteryCapability as v, DeviceType as vt, buildDeviceAdminUrl as w, array as wt, brightnessCapability as x, createEvent as xt, bestLocationMatch as y, errMsg as yt, fanControlCapability as z };
79911
+ export { oauthIntegrationCapability as $, connectivityCapability as A, boolean as At, floodCapability as B, EventCategory as Bt, buildAddonRouteProvider as C, defineEntryKind as Ct, carbonMonoxideCapability as D, settingsBrokersAdoptsFrom as Dt, calendarSourceCapability as E, nodePin as Et, deviceAdoptionCapability as F, record as Ft, lawnMowerControlCapability as G, humidifierCapability as H, deviceExportCapability as I, string as It, motionCapability as J, lockControlCapability as K, enumSensorCapability as L, union as Lt, controlCapability as M, literal as Mt, coverCapability as N, number as Nt, climateControlCapability as O, _enum as Ot, deviceAdminLinkCapability as P, object as Pt, numericSensorCapability as Q, eventEmitterCapability as R, unknown as Rt, brokerCapability as S, createEvent as St, buttonCapability as T, entryBody as Tt, humiditySensorCapability as U, gasCapability as V, imageCapability as W, notificationOutputCapability as X, normalizeUnit as Y, notifierCapability as Z, automationControlCapability as _, DeviceRole as _t, COCO_TO_MACRO as a, scriptRunnerCapability as at, binaryCapability as b, BaseAddon as bt, FanDirectionSchema as c, tamperCapability as ct, TargetSchema as d, vacuumControlCapability as dt, parseAdminBase as et, accessoriesCapability as f, valveCapability as ft, ambientLightSensorCapability as g, DeviceFeature as gt, alarmPanelCapability as h, weatherCapability as ht, CAMERA_SWITCH_ORDER as i, pressureSensorCapability as it, contactCapability as j, discriminatedUnion as jt, colorCapability as k, array as kt, HvacModeSchema as l, temperatureSensorCapability as lt, airQualitySensorCapability as m, waterHeaterCapability as mt, BaseDevice as n, prepareNotification as nt, CameraSwitchIdSchema as o, smokeCapability as ot, addonRoutesCapability as p, vibrationCapability as pt, mediaPlayerCapability as q, BaseDeviceProvider as r, presenceCapability as rt, EnumSensorDateTimeFormatSchema as s, switchCapability as st, AlarmArmModeSchema as t, powerMeterCapability as tt, MediaPlayerRepeatSchema as u, updateCapability as ut, batteryCapability as v, DeviceType as vt, buildDeviceAdminUrl as w, defineRecordKinds as wt, brightnessCapability as x, RecordSecretUnavailableError as xt, bestLocationMatch as y, errMsg as yt, fanControlCapability as z, url as zt };