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