@camstack/addon-auth 1.2.147 → 1.2.149

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.
@@ -32,7 +32,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  }) : target, mod));
33
33
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
34
  require("node:crypto");
35
- //#region ../types/dist/event-category-C4hVnRo8.mjs
35
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
36
36
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
37
37
  EventCategory["SystemBoot"] = "system.boot";
38
38
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -96,6 +96,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
96
96
  * consumes this category and maps it to the `addon-crash-loop` kind.
97
97
  */
98
98
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
99
+ /**
100
+ * A runner whose addon refused to start with a typed reason (D877) - parked
101
+ * in `refused`, never counted by the crash breaker, retried on operator
102
+ * action. One event per refusal.
103
+ */
104
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
105
+ /**
106
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
107
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
108
+ * runner is still pending) and the alert centre (close a recovered runner).
109
+ */
110
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
111
+ /**
112
+ * The node's one-shot runner boot check (D877): planned runners against the
113
+ * process service, `degraded` when any is failed, refused or missing. The
114
+ * alert centre turns it into one alert and a direct critical push.
115
+ */
116
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
99
117
  EventCategory["AddonError"] = "addon.error";
100
118
  EventCategory["AddonPageReady"] = "addon.page-ready";
101
119
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -4138,6 +4156,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4138
4156
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4139
4157
  json.type = "boolean";
4140
4158
  };
4159
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4160
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4161
+ };
4162
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4163
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4164
+ };
4141
4165
  var nullProcessor = (_schema, ctx, json, _params) => {
4142
4166
  if (ctx.target === "openapi-3.0") {
4143
4167
  json.type = "string";
@@ -4145,12 +4169,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4145
4169
  json.enum = [null];
4146
4170
  } else json.type = "null";
4147
4171
  };
4172
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4173
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4174
+ };
4148
4175
  var voidProcessor = (_schema, ctx, _json, _params) => {
4149
4176
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4150
4177
  };
4151
4178
  var neverProcessor = (_schema, _ctx, json, _params) => {
4152
4179
  json.not = {};
4153
4180
  };
4181
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4182
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4154
4183
  var dateProcessor = (_schema, ctx, _json, _params) => {
4155
4184
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4156
4185
  };
@@ -4182,12 +4211,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4182
4211
  json.enum = vals;
4183
4212
  }
4184
4213
  };
4214
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4215
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4216
+ };
4217
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4218
+ const _json = json;
4219
+ const pattern = schema._zod.pattern;
4220
+ if (!pattern) throw new Error("Pattern not found in template literal");
4221
+ _json.type = "string";
4222
+ _json.pattern = pattern.source;
4223
+ };
4224
+ var fileProcessor = (schema, _ctx, json, _params) => {
4225
+ const _json = json;
4226
+ const file = {
4227
+ type: "string",
4228
+ format: "binary",
4229
+ contentEncoding: "binary"
4230
+ };
4231
+ const { minimum, maximum, mime } = schema._zod.bag;
4232
+ if (minimum !== void 0) file.minLength = minimum;
4233
+ if (maximum !== void 0) file.maxLength = maximum;
4234
+ if (mime) if (mime.length === 1) {
4235
+ file.contentMediaType = mime[0];
4236
+ Object.assign(_json, file);
4237
+ } else {
4238
+ Object.assign(_json, file);
4239
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4240
+ }
4241
+ else Object.assign(_json, file);
4242
+ };
4243
+ var successProcessor = (_schema, _ctx, json, _params) => {
4244
+ json.type = "boolean";
4245
+ };
4185
4246
  var customProcessor = (_schema, ctx, _json, _params) => {
4186
4247
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4187
4248
  };
4249
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4250
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4251
+ };
4188
4252
  var transformProcessor = (_schema, ctx, _json, _params) => {
4189
4253
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4190
4254
  };
4255
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4256
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4257
+ };
4258
+ var setProcessor = (_schema, ctx, _json, _params) => {
4259
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4260
+ };
4191
4261
  var arrayProcessor = (schema, ctx, _json, params) => {
4192
4262
  const json = _json;
4193
4263
  const def = schema._zod.def;
@@ -4392,6 +4462,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4392
4462
  seen.ref = def.innerType;
4393
4463
  json.readOnly = true;
4394
4464
  };
4465
+ var promiseProcessor = (schema, ctx, _json, params) => {
4466
+ const def = schema._zod.def;
4467
+ process(def.innerType, ctx, params);
4468
+ const seen = ctx.seen.get(schema);
4469
+ seen.ref = def.innerType;
4470
+ };
4395
4471
  var optionalProcessor = (schema, ctx, _json, params) => {
4396
4472
  const def = schema._zod.def;
4397
4473
  process(def.innerType, ctx, params);
@@ -4404,6 +4480,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4404
4480
  const seen = ctx.seen.get(schema);
4405
4481
  seen.ref = innerType;
4406
4482
  };
4483
+ var allProcessors = {
4484
+ string: stringProcessor,
4485
+ number: numberProcessor,
4486
+ boolean: booleanProcessor,
4487
+ bigint: bigintProcessor,
4488
+ symbol: symbolProcessor,
4489
+ null: nullProcessor,
4490
+ undefined: undefinedProcessor,
4491
+ void: voidProcessor,
4492
+ never: neverProcessor,
4493
+ any: anyProcessor,
4494
+ unknown: unknownProcessor,
4495
+ date: dateProcessor,
4496
+ enum: enumProcessor,
4497
+ literal: literalProcessor,
4498
+ nan: nanProcessor,
4499
+ template_literal: templateLiteralProcessor,
4500
+ file: fileProcessor,
4501
+ success: successProcessor,
4502
+ custom: customProcessor,
4503
+ function: functionProcessor,
4504
+ transform: transformProcessor,
4505
+ map: mapProcessor,
4506
+ set: setProcessor,
4507
+ array: arrayProcessor,
4508
+ object: objectProcessor,
4509
+ union: unionProcessor,
4510
+ intersection: intersectionProcessor,
4511
+ tuple: tupleProcessor,
4512
+ record: recordProcessor,
4513
+ nullable: nullableProcessor,
4514
+ nonoptional: nonoptionalProcessor,
4515
+ default: defaultProcessor,
4516
+ prefault: prefaultProcessor,
4517
+ catch: catchProcessor,
4518
+ pipe: pipeProcessor,
4519
+ readonly: readonlyProcessor,
4520
+ promise: promiseProcessor,
4521
+ optional: optionalProcessor,
4522
+ lazy: lazyProcessor
4523
+ };
4524
+ function toJSONSchema(input, params) {
4525
+ if ("_idmap" in input) {
4526
+ const registry = input;
4527
+ const ctx = initializeContext({
4528
+ ...params,
4529
+ processors: allProcessors
4530
+ });
4531
+ const defs = {};
4532
+ for (const entry of registry._idmap.entries()) {
4533
+ const [_, schema] = entry;
4534
+ process(schema, ctx);
4535
+ }
4536
+ const schemas = {};
4537
+ ctx.external = {
4538
+ registry,
4539
+ uri: params?.uri,
4540
+ defs
4541
+ };
4542
+ for (const entry of registry._idmap.entries()) {
4543
+ const [key, schema] = entry;
4544
+ extractDefs(ctx, schema);
4545
+ schemas[key] = finalize(ctx, schema);
4546
+ }
4547
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4548
+ return { schemas };
4549
+ }
4550
+ const ctx = initializeContext({
4551
+ ...params,
4552
+ processors: allProcessors
4553
+ });
4554
+ process(input, ctx);
4555
+ extractDefs(ctx, input);
4556
+ return finalize(ctx, input);
4557
+ }
4407
4558
  //#endregion
4408
4559
  //#region ../../node_modules/zod/v4/classic/iso.js
4409
4560
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5420,7 +5571,7 @@ var ZodIssueCode = {
5420
5571
  var ZodFirstPartyTypeKind;
5421
5572
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5422
5573
  //#endregion
5423
- //#region ../types/dist/sleep-DAX0-2v9.mjs
5574
+ //#region ../types/dist/sleep-bZIhUvjd.mjs
5424
5575
  /**
5425
5576
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5426
5577
  * window to float samples (D455).
@@ -5537,7 +5688,7 @@ function isKeychainStoredField(field) {
5537
5688
  var SECRET_CLEAR = { $secretClear: true };
5538
5689
  /** The `'***'` token D634 redaction writes for non-admins. */
5539
5690
  var LEGACY_DEVICE_REDACTION = "***";
5540
- function isRecord$2(value) {
5691
+ function isRecord$5(value) {
5541
5692
  return typeof value === "object" && value !== null && !Array.isArray(value);
5542
5693
  }
5543
5694
  function makeSecretMarker(ref) {
@@ -5548,12 +5699,12 @@ function makeSecretMarker(ref) {
5548
5699
  }
5549
5700
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5550
5701
  function isSecretMarker(value) {
5551
- if (!isRecord$2(value)) return false;
5702
+ if (!isRecord$5(value)) return false;
5552
5703
  const ref = value["$secret"];
5553
5704
  return typeof ref === "string" && ref.length > 0;
5554
5705
  }
5555
5706
  function isSecretClear(value) {
5556
- return isRecord$2(value) && value["$secretClear"] === true;
5707
+ return isRecord$5(value) && value["$secretClear"] === true;
5557
5708
  }
5558
5709
  /**
5559
5710
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6163,7 +6314,7 @@ var KeychainWriteRefusedError = class extends Error {
6163
6314
  }
6164
6315
  };
6165
6316
  var KEEP = { kind: "keep" };
6166
- function isRecord$1(value) {
6317
+ function isRecord$4(value) {
6167
6318
  return typeof value === "object" && value !== null && !Array.isArray(value);
6168
6319
  }
6169
6320
  function defaultMintId() {
@@ -6176,7 +6327,7 @@ function collectSecretMarkerRefs(value, out = []) {
6176
6327
  return out;
6177
6328
  }
6178
6329
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6179
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6330
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6180
6331
  return out;
6181
6332
  }
6182
6333
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6231,7 +6382,7 @@ function rowId(row, idKey) {
6231
6382
  return null;
6232
6383
  }
6233
6384
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6234
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6385
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6235
6386
  if (!Array.isArray(incoming)) {
6236
6387
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6237
6388
  return {
@@ -6247,7 +6398,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6247
6398
  const kept = /* @__PURE__ */ new Set();
6248
6399
  const rows = [];
6249
6400
  for (const row of incoming) {
6250
- if (!isRecord$1(row)) {
6401
+ if (!isRecord$4(row)) {
6251
6402
  rows.push(row);
6252
6403
  continue;
6253
6404
  }
@@ -6272,7 +6423,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6272
6423
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6273
6424
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6274
6425
  case "object": {
6275
- if (!isRecord$1(incoming)) {
6426
+ if (!isRecord$4(incoming)) {
6276
6427
  if (incoming === void 0) return KEEP;
6277
6428
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6278
6429
  return {
@@ -6280,7 +6431,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6280
6431
  value: incoming
6281
6432
  };
6282
6433
  }
6283
- const storedObj = isRecord$1(stored) ? stored : {};
6434
+ const storedObj = isRecord$4(stored) ? stored : {};
6284
6435
  return {
6285
6436
  kind: "value",
6286
6437
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6403,7 +6554,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6403
6554
  value: items
6404
6555
  };
6405
6556
  }
6406
- if (isRecord$1(v)) {
6557
+ if (isRecord$4(v)) {
6407
6558
  const out = {};
6408
6559
  for (const [k, child] of Object.entries(v)) {
6409
6560
  const s = substitute(child);
@@ -6435,7 +6586,7 @@ var SecretOverwriteRefusedError = class extends Error {
6435
6586
  this.name = "SecretOverwriteRefusedError";
6436
6587
  }
6437
6588
  };
6438
- function isRecord(value) {
6589
+ function isRecord$3(value) {
6439
6590
  return typeof value === "object" && value !== null && !Array.isArray(value);
6440
6591
  }
6441
6592
  function resolvedValue(pass, marker) {
@@ -6464,7 +6615,7 @@ function inArray(pass, incoming, stored) {
6464
6615
  return incoming.map((item, index) => {
6465
6616
  const twin = stored[index];
6466
6617
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6467
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6618
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6468
6619
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6469
6620
  return item;
6470
6621
  });
@@ -6475,7 +6626,7 @@ function inArrayRow(pass, incoming, stored) {
6475
6626
  const twin = stored[key];
6476
6627
  if (isSecretMarker(twin)) {
6477
6628
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6478
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6629
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6479
6630
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6480
6631
  }
6481
6632
  return out;
@@ -6483,7 +6634,7 @@ function inArrayRow(pass, incoming, stored) {
6483
6634
  async function walk(pass, incoming, stored) {
6484
6635
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6485
6636
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6486
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6637
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6487
6638
  const out = { ...incoming };
6488
6639
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6489
6640
  return out;
@@ -6514,7 +6665,7 @@ async function restoreUnchangedSecrets(input) {
6514
6665
  function isJsonEqual(a, b) {
6515
6666
  if (Object.is(a, b)) return true;
6516
6667
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6517
- if (isRecord(a) && isRecord(b)) {
6668
+ if (isRecord$3(a) && isRecord$3(b)) {
6518
6669
  const keys = Object.keys(a);
6519
6670
  if (keys.length !== Object.keys(b).length) return false;
6520
6671
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6538,7 +6689,7 @@ function markerKeysOf(blob, owner) {
6538
6689
  }
6539
6690
  function nodeFromStored(value, owner) {
6540
6691
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6541
- if (!isRecord(value)) return null;
6692
+ if (!isRecord$3(value)) return null;
6542
6693
  const children = /* @__PURE__ */ new Map();
6543
6694
  for (const [key, child] of Object.entries(value)) {
6544
6695
  const node = nodeFromStored(child, owner);
@@ -6671,7 +6822,6 @@ function createHandle(raw, opts) {
6671
6822
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6672
6823
  const readAddonStoreResult = raw.readAddonStoreResult;
6673
6824
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6674
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6675
6825
  const overrides = {
6676
6826
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6677
6827
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6695,12 +6845,12 @@ function createHandle(raw, opts) {
6695
6845
  };
6696
6846
  } } : {},
6697
6847
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6698
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6699
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6848
+ readDeviceStoreBatch: async (deviceIds) => {
6849
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6700
6850
  const out = /* @__PURE__ */ new Map();
6701
6851
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6702
6852
  return out;
6703
- } } : {},
6853
+ },
6704
6854
  writeAddonStore: async (patch) => {
6705
6855
  await writeAddon(patch);
6706
6856
  },
@@ -7327,7 +7477,7 @@ var BaseAddon = class {
7327
7477
  if (!ctx) return;
7328
7478
  const addonId = ctx.id;
7329
7479
  setImmediate(() => {
7330
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7480
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7331
7481
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7332
7482
  }).catch((err) => {
7333
7483
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7527,7 +7677,7 @@ var BaseAddon = class {
7527
7677
  return this._addonSecretTree;
7528
7678
  }
7529
7679
  deviceSecretTree() {
7530
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7680
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7531
7681
  return this._deviceSecretTree;
7532
7682
  }
7533
7683
  /**
@@ -7603,42 +7753,135 @@ var BaseAddon = class {
7603
7753
  this[timerOf] = timer;
7604
7754
  }
7605
7755
  /**
7606
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7607
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7608
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7609
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7756
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7757
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7610
7758
  * addon permanently broken.
7611
7759
  *
7612
- * Retry only the two known infra fingerprints. Anything else propagates so
7613
- * real bugs surface immediately. After the budget expires we fall back to
7614
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7760
+ * Two kinds of outage, two budgets:
7761
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7762
+ * initialized`, `provider not available`): a short budget, then the addon
7763
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7764
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7765
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7766
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7767
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7768
+ * loop. A long, bounded budget; only after it the error propagates - the
7769
+ * addon never runs on defaults for a store it could not ask.
7770
+ * Anything else propagates immediately so real bugs surface.
7615
7771
  */
7616
7772
  async readAddonStoreWithRetry() {
7617
7773
  const settings = this.rawSettings();
7618
7774
  if (!settings) return {};
7619
- const delaysMs = [
7620
- 150,
7621
- 350,
7622
- 600,
7623
- 900
7624
- ];
7625
7775
  let lastErr;
7626
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7776
+ for (let attempt = 0;; attempt++) try {
7627
7777
  const stored = await settings.readAddonStore() ?? {};
7628
7778
  this.settingsStoreReady = true;
7629
7779
  return stored;
7630
7780
  } catch (err) {
7631
7781
  lastErr = err;
7632
- const msg = err instanceof Error ? err.message : String(err);
7633
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7634
- if (attempt === delaysMs.length) break;
7635
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7782
+ const kind = classifyStoreError(err);
7783
+ if (kind === "permanent") throw err;
7784
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7785
+ if (delay === void 0) {
7786
+ if (kind === "transport") throw err;
7787
+ break;
7788
+ }
7789
+ await new Promise((r) => setTimeout(r, delay));
7636
7790
  }
7637
7791
  this.settingsStoreReady = false;
7638
7792
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7639
7793
  return {};
7640
7794
  }
7641
7795
  };
7796
+ /** The settings store's own restart fingerprints. */
7797
+ var RESTART_RETRY_DELAYS_MS = [
7798
+ 150,
7799
+ 350,
7800
+ 600,
7801
+ 900
7802
+ ];
7803
+ /** A hub restarting under a booting runner: ~100 s in total. */
7804
+ var TRANSPORT_RETRY_DELAYS_MS = [
7805
+ 150,
7806
+ 350,
7807
+ 600,
7808
+ 900,
7809
+ 2e3,
7810
+ 5e3,
7811
+ 1e4,
7812
+ 2e4,
7813
+ 3e4,
7814
+ 3e4
7815
+ ];
7816
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7817
+ /** Node / socket error codes of a connection that did not happen or broke. */
7818
+ var TRANSPORT_CODES = new Set([
7819
+ "ECONNREFUSED",
7820
+ "ECONNRESET",
7821
+ "ETIMEDOUT",
7822
+ "EPIPE",
7823
+ "EHOSTUNREACH",
7824
+ "ENETUNREACH"
7825
+ ]);
7826
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7827
+ var UNAVAILABLE_TRPC_CODES = new Set([
7828
+ "TIMEOUT",
7829
+ "SERVICE_UNAVAILABLE",
7830
+ "BAD_GATEWAY",
7831
+ "GATEWAY_TIMEOUT"
7832
+ ]);
7833
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7834
+ var TRANSPORT_PHRASES = [
7835
+ "discovery deadline exceeded",
7836
+ "parent could not route child unowned cap call",
7837
+ "UDS request timed out after",
7838
+ "channel closed"
7839
+ ];
7840
+ /** Moleculer error `type`s of a call that could not be served right now. */
7841
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7842
+ "REQUEST_TIMEOUT",
7843
+ "SERVICE_NOT_FOUND",
7844
+ "SERVICE_NOT_AVAILABLE",
7845
+ "REQUEST_REJECTED",
7846
+ "BROKER_DISCONNECTED"
7847
+ ]);
7848
+ function stringProp(value, key) {
7849
+ if (typeof value !== "object" || value === null) return void 0;
7850
+ const found = Reflect.get(value, key);
7851
+ return typeof found === "string" ? found : void 0;
7852
+ }
7853
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7854
+ function errorCode(err) {
7855
+ const out = {};
7856
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7857
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7858
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7859
+ if (node !== void 0) out.node = node;
7860
+ const trpc = stringProp(data, "code");
7861
+ if (trpc !== void 0) out.trpc = trpc;
7862
+ return out;
7863
+ }
7864
+ /**
7865
+ * Is a settings read failure worth retrying, and with which budget? Only
7866
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7867
+ * one of the exact phrases our own transport raises. A message that merely
7868
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7869
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7870
+ */
7871
+ function classifyStoreError(err) {
7872
+ const message = err instanceof Error ? err.message : String(err);
7873
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7874
+ const code = errorCode(err);
7875
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7876
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7877
+ if (typeof err === "object" && err !== null) {
7878
+ if (Reflect.get(err, "retryable") === true) return "transport";
7879
+ const type = stringProp(err, "type");
7880
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7881
+ }
7882
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7883
+ return "permanent";
7884
+ }
7642
7885
  /**
7643
7886
  * Collect the keys of every field marked `perNode: true`, recursing into
7644
7887
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7728,6 +7971,341 @@ var PeerBytesTicketSchema = object({
7728
7971
  */
7729
7972
  declaredBytes: number().int().nonnegative().nullable()
7730
7973
  });
7974
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7975
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7976
+ var RECORD_DATABASES = ["settings", "events"];
7977
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7978
+ var RECORD_CLASSES = [
7979
+ "config",
7980
+ "ledger",
7981
+ "audit",
7982
+ "mirror",
7983
+ "ephemeral"
7984
+ ];
7985
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7986
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7987
+ var RECORD_BATCH_MAX = 1e3;
7988
+ var RECORD_QUERY_MAX = 1e3;
7989
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
7990
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
7991
+ var PREFIX = "records/";
7992
+ /** The base of every records failure. `detail` is the human part of the message. */
7993
+ var RecordsError = class extends Error {
7994
+ code;
7995
+ detail;
7996
+ constructor(code, detail) {
7997
+ super(`${PREFIX}${code}: ${detail}`);
7998
+ this.name = "RecordsError";
7999
+ this.code = code;
8000
+ this.detail = detail;
8001
+ }
8002
+ };
8003
+ /** The keychain could not store or serve a value: explicit, never an empty string. */
8004
+ var RecordSecretUnavailableError = class extends RecordsError {
8005
+ constructor(detail) {
8006
+ super("secret-unavailable", detail);
8007
+ this.name = "RecordSecretUnavailableError";
8008
+ }
8009
+ };
8010
+ var InvalidRecordError = class extends RecordsError {
8011
+ constructor(detail) {
8012
+ super("invalid-record", detail);
8013
+ this.name = "InvalidRecordError";
8014
+ }
8015
+ };
8016
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
8017
+ var DeclarationRefusedError = class extends RecordsError {
8018
+ constructor(detail) {
8019
+ super("declaration-refused", detail);
8020
+ this.name = "DeclarationRefusedError";
8021
+ }
8022
+ };
8023
+ function defOf(schema) {
8024
+ const zodBag = Reflect.get(schema, "_zod");
8025
+ if (typeof zodBag !== "object" || zodBag === null) return {};
8026
+ const def = Reflect.get(zodBag, "def");
8027
+ if (typeof def !== "object" || def === null) return {};
8028
+ return def;
8029
+ }
8030
+ function declaredHere(schema) {
8031
+ return globalRegistry.get(schema)?.secret === true;
8032
+ }
8033
+ /** Wrapper kinds whose `innerType` is the field itself. */
8034
+ var WRAPPERS = new Set([
8035
+ "optional",
8036
+ "nullable",
8037
+ "default",
8038
+ "prefault",
8039
+ "catch",
8040
+ "readonly",
8041
+ "nonoptional"
8042
+ ]);
8043
+ /**
8044
+ * The schema layers that make up ONE field: the schema itself and every
8045
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8046
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8047
+ * `.transform` on `in`).
8048
+ */
8049
+ function layersOf(schema) {
8050
+ const out = [];
8051
+ const queue = [schema];
8052
+ while (queue.length > 0) {
8053
+ const s = queue.shift();
8054
+ if (!s || out.includes(s)) continue;
8055
+ out.push(s);
8056
+ const def = defOf(s);
8057
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8058
+ if (def.type === "pipe") {
8059
+ if (def.in) queue.push(def.in);
8060
+ if (def.out) queue.push(def.out);
8061
+ }
8062
+ }
8063
+ return out;
8064
+ }
8065
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8066
+ function isZodSecret(schema) {
8067
+ return layersOf(schema).some(declaredHere);
8068
+ }
8069
+ /**
8070
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8071
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8072
+ * object or array is reported as one path and not descended into — everything
8073
+ * under it is secret.
8074
+ */
8075
+ function collectZodSecretPaths(schema, prefix = "") {
8076
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8077
+ const paths = [];
8078
+ for (const layer of layersOf(schema)) {
8079
+ const def = defOf(layer);
8080
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8081
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8082
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8083
+ else if (def.type === "intersection") {
8084
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8085
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8086
+ }
8087
+ }
8088
+ return [...new Set(paths)];
8089
+ }
8090
+ /**
8091
+ * Secret fields of a record, addressed the way a Zod schema declares them
8092
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8093
+ * (`auth.accessToken`, `headers[].value`).
8094
+ *
8095
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8096
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8097
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8098
+ * leaf names its element: `headers[X-Api].value`.
8099
+ *
8100
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8101
+ */
8102
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8103
+ function parseSecretPath(path) {
8104
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8105
+ return path.split(".").map((raw) => {
8106
+ const each = raw.endsWith("[]");
8107
+ const key = each ? raw.slice(0, -2) : raw;
8108
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8109
+ return {
8110
+ key,
8111
+ each
8112
+ };
8113
+ });
8114
+ }
8115
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8116
+ function secretArrayPrefixes(path) {
8117
+ const segments = parseSecretPath(path);
8118
+ const prefixes = [];
8119
+ const walked = [];
8120
+ for (const segment of segments) {
8121
+ walked.push(segment.key);
8122
+ if (segment.each) prefixes.push(walked.join("."));
8123
+ }
8124
+ return prefixes;
8125
+ }
8126
+ /**
8127
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8128
+ * Zod row schema that describes it, and the helper that turns the two into the
8129
+ * JSON the engine stores.
8130
+ *
8131
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8132
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8133
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
8134
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
8135
+ * never a field name (D879).
8136
+ */
8137
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
8138
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
8139
+ var RecordIndexSchema = object({
8140
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
8141
+ fields: array(RecordFieldPathSchema).min(1).max(4),
8142
+ unique: boolean().optional()
8143
+ }).strict();
8144
+ var RecordRetentionSchema = union([
8145
+ object({
8146
+ ttlMs: number().int().positive(),
8147
+ from: _enum(["at", "write"])
8148
+ }).strict(),
8149
+ object({
8150
+ maxRows: number().int().positive().optional(),
8151
+ maxRowsPerDevice: number().int().positive().optional()
8152
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
8153
+ object({
8154
+ owner: string().min(1),
8155
+ reason: string().min(1)
8156
+ }).strict(),
8157
+ object({ none: string().min(1) }).strict()
8158
+ ]);
8159
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
8160
+ var EntryDescriptorSchema = object({
8161
+ title: string().min(1),
8162
+ /** The record body field shown as the entry's name. */
8163
+ nameField: string().min(1),
8164
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
8165
+ fields: record(string(), unknown())
8166
+ }).strict();
8167
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
8168
+ var RecordKindDeclarationSchema = object({
8169
+ database: _enum(RECORD_DATABASES).default("settings"),
8170
+ class: _enum(RECORD_CLASSES),
8171
+ writeTrigger: string().min(1),
8172
+ device: _enum([
8173
+ "required",
8174
+ "optional",
8175
+ "none"
8176
+ ]).default("none"),
8177
+ at: _enum(["required", "none"]).default("none"),
8178
+ indexes: array(RecordIndexSchema).max(8).default([]),
8179
+ retention: RecordRetentionSchema,
8180
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
8181
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
8182
+ /** Derived from the Zod schema; never written by hand. */
8183
+ secretPaths: array(string().min(1)).default([]),
8184
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
8185
+ secretArrayKeys: record(string(), string()).default({}),
8186
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
8187
+ adoptsFrom: string().min(1).optional(),
8188
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
8189
+ transactFamily: string().min(1).optional(),
8190
+ entry: EntryDescriptorSchema.optional()
8191
+ }).strict();
8192
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8193
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8194
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8195
+ function assertValidDeclaration(name, decl) {
8196
+ const refuse = (why) => {
8197
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8198
+ };
8199
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8200
+ const seen = /* @__PURE__ */ new Set();
8201
+ for (const index of decl.indexes) {
8202
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8203
+ seen.add(index.name);
8204
+ }
8205
+ const { retention } = decl;
8206
+ const hasSecrets = decl.secretPaths.length > 0;
8207
+ if ("ttlMs" in retention) {
8208
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8209
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8210
+ }
8211
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8212
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8213
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8214
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8215
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8216
+ 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)`);
8217
+ }
8218
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8219
+ 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`);
8220
+ }
8221
+ function bodyFieldsOf(schema) {
8222
+ return { ...toJSONSchema(schema, {
8223
+ unrepresentable: "any",
8224
+ io: "input"
8225
+ }) };
8226
+ }
8227
+ function isRecordLike(value) {
8228
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8229
+ }
8230
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8231
+ function hasNameField(json, field) {
8232
+ const branches = json["oneOf"] ?? json["anyOf"];
8233
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8234
+ const properties = json["properties"];
8235
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8236
+ }
8237
+ /**
8238
+ * Declare the kinds of a package. The keys are the kind names. The result is
8239
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8240
+ * types its handle from.
8241
+ */
8242
+ function defineRecordKinds(specs) {
8243
+ const out = {};
8244
+ for (const [name, spec] of Object.entries(specs)) {
8245
+ const secretPaths = collectZodSecretPaths(spec.schema);
8246
+ const nameField = spec.entry?.nameField ?? "name";
8247
+ const fields = bodyFieldsOf(spec.schema);
8248
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8249
+ const parsed = RecordKindDeclarationSchema.parse({
8250
+ database: spec.database,
8251
+ class: spec.class,
8252
+ writeTrigger: spec.writeTrigger,
8253
+ device: spec.device,
8254
+ at: spec.at,
8255
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8256
+ retention: spec.retention,
8257
+ deviceRemoval: spec.deviceRemoval,
8258
+ maxDataBytes: spec.maxDataBytes,
8259
+ secretPaths: [...secretPaths],
8260
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8261
+ adoptsFrom: spec.adoptsFrom,
8262
+ transactFamily: spec.transactFamily,
8263
+ entry: spec.entry === void 0 ? void 0 : {
8264
+ title: spec.entry.title,
8265
+ nameField,
8266
+ fields
8267
+ }
8268
+ });
8269
+ assertValidDeclaration(name, parsed);
8270
+ out[name] = {
8271
+ name,
8272
+ schema: spec.schema,
8273
+ declaration: parsed
8274
+ };
8275
+ }
8276
+ return out;
8277
+ }
8278
+ /**
8279
+ * Declare one entry kind. An entry is configuration: never trimmed by the
8280
+ * engine, never aged, belonging to no device.
8281
+ */
8282
+ function defineEntryKind(name, spec) {
8283
+ const defined = defineRecordKinds({ [name]: {
8284
+ schema: spec.schema,
8285
+ class: "config",
8286
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
8287
+ retention: { none: "an entry goes only when the operator deletes it" },
8288
+ ...spec.database === void 0 ? {} : { database: spec.database },
8289
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
8290
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
8291
+ ...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
8292
+ entry: {
8293
+ title: spec.title,
8294
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
8295
+ }
8296
+ } })[name];
8297
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
8298
+ return defined;
8299
+ }
8300
+ /**
8301
+ * Legacy source for entry adoption (B3): a list stored under addon-settings
8302
+ * `<addonId>.<key>` until records-adopt copies rows into the entry kind.
8303
+ */
8304
+ var SETTINGS_ARRAY_ADOPTS_PREFIX = "@settings-array/";
8305
+ /** The `adoptsFrom` value for an addon-settings array field. */
8306
+ function settingsArrayAdoptsFrom(addonId, settingsKey) {
8307
+ return `${SETTINGS_ARRAY_ADOPTS_PREFIX}${addonId}/${settingsKey}`;
8308
+ }
7731
8309
  /** Shared Zod schemas used across streaming capabilities. */
7732
8310
  var CamProfileSchema = _enum([
7733
8311
  "high",
@@ -8188,8 +8766,12 @@ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(o
8188
8766
  kind: "mutation",
8189
8767
  auth: "admin"
8190
8768
  }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
8769
+ object({
8770
+ code: string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/),
8771
+ params: record(string(), union([string(), number()])).optional()
8772
+ });
8191
8773
  //#endregion
8192
- //#region ../types/dist/err-msg-DX6i_MY4.mjs
8774
+ //#region ../types/dist/err-msg--2RrYiLO.mjs
8193
8775
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8194
8776
  DeviceType["Camera"] = "camera";
8195
8777
  DeviceType["Hub"] = "hub";
@@ -8439,9 +9021,28 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8439
9021
  DeviceRole["Nightvision"] = "nightvision";
8440
9022
  DeviceRole["PrivacyMask"] = "privacy-mask";
8441
9023
  DeviceRole["Doorbell"] = "doorbell";
9024
+ /** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
9025
+ DeviceRole["CoverBlind"] = "cover-blind";
9026
+ /** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
9027
+ DeviceRole["CoverShutter"] = "cover-shutter";
9028
+ /** Exterior awning. HA `device_class: awning`. */
9029
+ DeviceRole["CoverAwning"] = "cover-awning";
9030
+ /** Curtain / drape. HA `device_class: curtain`. */
9031
+ DeviceRole["CoverCurtain"] = "cover-curtain";
9032
+ /** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
9033
+ DeviceRole["CoverGarage"] = "cover-garage";
9034
+ /** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
9035
+ DeviceRole["CoverGate"] = "cover-gate";
9036
+ /** Door. HA `device_class: door`. A security actuator: exports gate it. */
9037
+ DeviceRole["CoverDoor"] = "cover-door";
9038
+ /** Window. HA `device_class: window`. */
9039
+ DeviceRole["CoverWindow"] = "cover-window";
8442
9040
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8443
9041
  * real Switch device for UI rendering / export adapters. */
8444
9042
  DeviceRole["BinaryHelper"] = "binary-helper";
9043
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
9044
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
9045
+ DeviceRole["Outlet"] = "outlet";
8445
9046
  /** Generic motion / occupancy / moving event source. Distinct from
8446
9047
  * the camera accessory PirSensor role: that one is a camera child;
8447
9048
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8519,7 +9120,7 @@ function errMsg(err) {
8519
9120
  return String(err);
8520
9121
  }
8521
9122
  //#endregion
8522
- //#region ../types/dist/composition-C-WpVYTX.mjs
9123
+ //#region ../types/dist/composition-DOwQB_Ua.mjs
8523
9124
  /**
8524
9125
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8525
9126
  *
@@ -11840,11 +12441,10 @@ var ClipModelMetaSchema = object({
11840
12441
  /**
11841
12442
  * The `vector-store` index this model's vectors live in. ONE feature space
11842
12443
  * per index: two models share an index only when their vectors are ranked
11843
- * against each other, which for CLIP means never across families. MobileCLIP
11844
- * S1 and S2 share `object-clip` for history (separated by the row's
11845
- * `modelId`); any other model gets its own.
12444
+ * against each other, which for CLIP means never across families. Every
12445
+ * model gets its own.
11846
12446
  */
11847
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12447
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11848
12448
  /**
11849
12449
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11850
12450
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -13038,7 +13638,9 @@ var ConfigTabDeclarationSchema = object({
13038
13638
  var ConfigSectionWithValuesSchema = object({
13039
13639
  id: string(),
13040
13640
  title: string(),
13641
+ titleKey: string().optional(),
13041
13642
  description: string().optional(),
13643
+ descriptionKey: string().optional(),
13042
13644
  style: _enum(["card", "accordion"]).optional(),
13043
13645
  defaultCollapsed: boolean().optional(),
13044
13646
  columns: union([
@@ -15728,6 +16330,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15728
16330
  keyField: string()
15729
16331
  }).optional()
15730
16332
  })) });
16333
+ /**
16334
+ * The report of a one-shot "move this owner's plaintext secrets into the
16335
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16336
+ *
16337
+ * The owner runs it on its own rows, through its own write path; an operator
16338
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16339
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16340
+ */
16341
+ var RawSecretMigrationInputSchema = object({
16342
+ /** `false` (the default of the script) = report only. */
16343
+ apply: boolean() });
16344
+ var RawSecretMigrationReportSchema = object({
16345
+ apply: boolean(),
16346
+ /** Rows that can carry a secret (a profile, an enrolment). */
16347
+ rows: number().int(),
16348
+ /** Rows whose secret was plaintext when the run started. */
16349
+ raw: number().int(),
16350
+ /** Rows that already held a keychain marker when the run started. */
16351
+ markers: number().int(),
16352
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16353
+ migrated: number().int(),
16354
+ /** Plaintext rows left in place because the move or its read-back failed. */
16355
+ failed: number().int(),
16356
+ /** After the run: rows still holding plaintext. */
16357
+ remainingRaw: number().int(),
16358
+ /** After the run: markers the keychain could not resolve right now. */
16359
+ unresolvedMarkers: number().int(),
16360
+ /**
16361
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16362
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16363
+ */
16364
+ redundantCopies: number().int().optional(),
16365
+ /** True when nothing is raw and every marker resolves. */
16366
+ verified: boolean()
16367
+ });
15731
16368
  /** Where a block runs. The operator chooses — a block driving a device on an
15732
16369
  * agent is the reason placement is not fixed to the hub. */
15733
16370
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15954,6 +16591,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15954
16591
  }), SettingsUpdateResultSchema, {
15955
16592
  kind: "mutation",
15956
16593
  auth: "admin"
16594
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16595
+ kind: "mutation",
16596
+ auth: "admin"
15957
16597
  }), method(object({}), object({ libs: array(object({
15958
16598
  filePath: string(),
15959
16599
  content: string()
@@ -16217,6 +16857,347 @@ id: union([string(), number()]) }), {
16217
16857
  auth: "admin"
16218
16858
  });
16219
16859
  /**
16860
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16861
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16862
+ * (operator intent, D870) and device-history (numbers over time, D850).
16863
+ *
16864
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16865
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16866
+ * that with the addon id closed over). It is deliberately NOT in any input
16867
+ * schema, so a session can never supply it, and a call with no stamp is refused
16868
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16869
+ * addons go through the owner's capability.
16870
+ *
16871
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16872
+ * never `[]`. Secret fields are never on the wire: a read shows the
16873
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16874
+ * resolves itself, and a write may carry only a keychain marker bound to the
16875
+ * row's own ref.
16876
+ *
16877
+ * Internal: addons reach it through `ctx.records`, never directly.
16878
+ */
16879
+ var RecordIdSchema = string().min(1).max(256);
16880
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16881
+ var RecordBodySchema = record(string(), unknown());
16882
+ var RecordInputSchema = object({
16883
+ id: RecordIdSchema,
16884
+ /** The device this row belongs to (D865 removal, per-device reads). */
16885
+ deviceId: number().int().optional(),
16886
+ /** The domain clock, ms: observed / created / opened. */
16887
+ at: number().int().optional(),
16888
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16889
+ expiresAt: number().int().optional(),
16890
+ data: RecordBodySchema
16891
+ });
16892
+ var RecordViewSchema = object({
16893
+ id: string(),
16894
+ deviceId: number().int().nullable(),
16895
+ at: number().nullable(),
16896
+ expiresAt: number().nullable(),
16897
+ rev: number().int(),
16898
+ updatedAt: number(),
16899
+ data: RecordBodySchema
16900
+ });
16901
+ /** Declared index fields only. Anything else does not compile, by design. */
16902
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16903
+ string(),
16904
+ number(),
16905
+ boolean(),
16906
+ object({ in: array(union([
16907
+ string(),
16908
+ number(),
16909
+ boolean()
16910
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16911
+ object({
16912
+ gt: union([string(), number()]).optional(),
16913
+ gte: union([string(), number()]).optional(),
16914
+ lt: union([string(), number()]).optional(),
16915
+ lte: union([string(), number()]).optional()
16916
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16917
+ ]));
16918
+ var KindShape = { kind: RecordKindNameSchema };
16919
+ var TimeWindowShape = {
16920
+ deviceId: number().int().optional(),
16921
+ atFrom: number().optional(),
16922
+ atTo: number().optional()
16923
+ };
16924
+ var RecordQueryInputSchema = object({
16925
+ ...KindShape,
16926
+ ...TimeWindowShape,
16927
+ where: RecordWhereSchema.optional(),
16928
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16929
+ order: _enum(["at", "id"]).optional(),
16930
+ desc: boolean().optional(),
16931
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16932
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16933
+ cursor: string().min(1).optional()
16934
+ });
16935
+ var RecordQueryResultSchema = object({
16936
+ records: array(RecordViewSchema),
16937
+ nextCursor: string().nullable()
16938
+ });
16939
+ var RecordKindStateSchema = _enum([
16940
+ "created",
16941
+ "unchanged",
16942
+ "updated"
16943
+ ]);
16944
+ var DeclareKindResultSchema = object({
16945
+ kindId: number().int(),
16946
+ state: RecordKindStateSchema,
16947
+ createdIndexes: array(string()),
16948
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16949
+ adoptionPending: object({
16950
+ legacyTable: string(),
16951
+ legacyRows: number().int()
16952
+ }).nullable()
16953
+ });
16954
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16955
+ var SecretRefsList = array(string());
16956
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16957
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16958
+ kind: "mutation",
16959
+ auth: "admin"
16960
+ }), method(object({
16961
+ ...KindShape,
16962
+ id: RecordIdSchema
16963
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16964
+ ...KindShape,
16965
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16966
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16967
+ ...KindShape,
16968
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16969
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16970
+ ...KindShape,
16971
+ record: RecordInputSchema,
16972
+ /** Compare-and-set. `0` means "the row must not exist". */
16973
+ ifRev: number().int().min(0).optional()
16974
+ }), object({
16975
+ rev: number().int(),
16976
+ releasedRefs: SecretRefsList
16977
+ }), {
16978
+ kind: "mutation",
16979
+ auth: "admin"
16980
+ }), method(object({
16981
+ ...KindShape,
16982
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16983
+ }), object({
16984
+ count: number().int(),
16985
+ releasedRefs: SecretRefsList
16986
+ }), {
16987
+ kind: "mutation",
16988
+ auth: "admin"
16989
+ }), method(object({
16990
+ ...KindShape,
16991
+ id: RecordIdSchema,
16992
+ data: RecordBodySchema,
16993
+ at: number().int().nullable().optional(),
16994
+ expiresAt: number().int().nullable().optional(),
16995
+ ifRev: number().int().min(1).optional()
16996
+ }), object({
16997
+ rev: number().int(),
16998
+ releasedRefs: SecretRefsList
16999
+ }), {
17000
+ kind: "mutation",
17001
+ auth: "admin"
17002
+ }), method(object({
17003
+ ...KindShape,
17004
+ id: RecordIdSchema
17005
+ }), object({
17006
+ deleted: boolean(),
17007
+ secretRefs: SecretRefsList
17008
+ }), {
17009
+ kind: "mutation",
17010
+ auth: "admin"
17011
+ }), method(object({
17012
+ ...KindShape,
17013
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
17014
+ }), object({
17015
+ deleted: number().int(),
17016
+ secretRefs: SecretRefsList
17017
+ }), {
17018
+ kind: "mutation",
17019
+ auth: "admin"
17020
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
17021
+ ...KindShape,
17022
+ ...TimeWindowShape,
17023
+ where: RecordWhereSchema.optional()
17024
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
17025
+ ...KindShape,
17026
+ deviceId: number().int().optional(),
17027
+ from: number(),
17028
+ to: number(),
17029
+ bucketMs: number().int().positive()
17030
+ }), object({ buckets: array(object({
17031
+ bucketStart: number(),
17032
+ count: number().int()
17033
+ })) }), { auth: "admin" }), method(object({
17034
+ ...KindShape,
17035
+ op: _enum([
17036
+ "sum",
17037
+ "min",
17038
+ "max",
17039
+ "count"
17040
+ ]),
17041
+ field: RecordFieldPathSchema.optional(),
17042
+ groupBy: RecordFieldPathSchema.optional(),
17043
+ where: RecordWhereSchema.optional()
17044
+ }), object({ rows: array(object({
17045
+ group: union([
17046
+ string(),
17047
+ number(),
17048
+ _null()
17049
+ ]),
17050
+ value: number().nullable()
17051
+ })) }), { auth: "admin" }), method(object({
17052
+ ...KindShape,
17053
+ deviceId: number().int().optional(),
17054
+ atBefore: number().optional(),
17055
+ where: RecordWhereSchema.optional()
17056
+ }), object({
17057
+ deleted: number().int(),
17058
+ secretRefs: SecretRefsList
17059
+ }), {
17060
+ kind: "mutation",
17061
+ auth: "admin"
17062
+ }), method(object({
17063
+ deviceId: number().int(),
17064
+ kinds: array(RecordKindNameSchema).optional()
17065
+ }), object({
17066
+ deleted: record(string(), number().int()),
17067
+ secretRefs: SecretRefsList
17068
+ }), {
17069
+ kind: "mutation",
17070
+ auth: "admin"
17071
+ }), method(object(KindShape), object({ id: number().int() }), {
17072
+ kind: "mutation",
17073
+ auth: "admin"
17074
+ });
17075
+ /** One table of the settings database. */
17076
+ var StorageTableSchema = object({
17077
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
17078
+ name: string(),
17079
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
17080
+ owner: string().nullable(),
17081
+ rows: number().int().nonnegative(),
17082
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
17083
+ bytes: number().int().nonnegative().nullable(),
17084
+ /** Declared by an addon since this engine process started (a running addon claims it). */
17085
+ declaredThisBoot: boolean()
17086
+ });
17087
+ /** One declared record kind (D881) as System -> Data shows it. */
17088
+ var StorageKindSchema = object({
17089
+ owner: string(),
17090
+ kind: string(),
17091
+ database: _enum(["settings", "events"]),
17092
+ class: string(),
17093
+ state: _enum([
17094
+ "declared",
17095
+ "orphaned",
17096
+ "dropped"
17097
+ ]),
17098
+ /** `null` when the caller asked for no counts (`counts: false`). */
17099
+ rows: number().int().nonnegative().nullable(),
17100
+ /** Rows x the average size of a sample; null for an empty kind. */
17101
+ bytesEstimate: number().int().nonnegative().nullable(),
17102
+ writeTrigger: string(),
17103
+ retention: RecordRetentionSchema,
17104
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
17105
+ entry: boolean(),
17106
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
17107
+ declaration: RecordKindDeclarationSchema
17108
+ });
17109
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
17110
+ collection: string().min(1),
17111
+ expectRows: number().int().nonnegative()
17112
+ }), object({
17113
+ dropped: literal(true),
17114
+ rows: number().int().nonnegative()
17115
+ }), {
17116
+ kind: "mutation",
17117
+ auth: "admin"
17118
+ }), method(object({
17119
+ owner: string().min(1).optional(),
17120
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
17121
+ counts: boolean().optional()
17122
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
17123
+ owner: string().min(1),
17124
+ kind: RecordKindNameSchema
17125
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
17126
+ owner: string().min(1),
17127
+ kind: RecordKindNameSchema,
17128
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
17129
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
17130
+ complete: boolean().optional()
17131
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
17132
+ kind: "mutation",
17133
+ auth: "admin"
17134
+ }), method(object({
17135
+ collection: string().min(1),
17136
+ cursor: string().optional(),
17137
+ limit: number().int().min(1).max(1e3).optional()
17138
+ }), object({
17139
+ rows: array(object({
17140
+ id: string(),
17141
+ data: record(string(), unknown())
17142
+ })),
17143
+ nextCursor: string().nullable()
17144
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
17145
+ /**
17146
+ * record-entries - the ONE admin surface for every list of user-created entries
17147
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
17148
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
17149
+ *
17150
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
17151
+ * the entry body with `secret: true` on every credential field, so a password
17152
+ * field is derived from the schema and never from a name. `putEntry` takes the
17153
+ * redaction token for an untouched secret (the stored value is kept), a string
17154
+ * for a new one, and the clear instruction to remove one. A read never carries
17155
+ * a secret value, and a locked keychain refuses the write with
17156
+ * `records/secret-unavailable` instead of storing plaintext.
17157
+ *
17158
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
17159
+ */
17160
+ var EntryKindInfoSchema = object({
17161
+ owner: string(),
17162
+ kind: RecordKindNameSchema,
17163
+ title: string(),
17164
+ nameField: string(),
17165
+ /** JSON Schema of the body; `secret: true` marks a password field. */
17166
+ fields: record(string(), unknown()),
17167
+ secretPaths: array(string()),
17168
+ rows: number().int().nonnegative()
17169
+ });
17170
+ var EntryViewSchema = object({
17171
+ id: RecordIdSchema,
17172
+ name: string(),
17173
+ rev: number().int(),
17174
+ updatedAt: number(),
17175
+ /** Secret fields hold the redaction token. */
17176
+ data: RecordBodySchema
17177
+ });
17178
+ var EntryAddress = {
17179
+ owner: string().min(1),
17180
+ kind: RecordKindNameSchema
17181
+ };
17182
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
17183
+ ...EntryAddress,
17184
+ id: RecordIdSchema.optional(),
17185
+ data: RecordBodySchema,
17186
+ ifRev: number().int().min(1).optional()
17187
+ }), object({
17188
+ id: string(),
17189
+ rev: number().int()
17190
+ }), {
17191
+ kind: "mutation",
17192
+ auth: "admin"
17193
+ }), method(object({
17194
+ ...EntryAddress,
17195
+ id: RecordIdSchema
17196
+ }), object({ deleted: boolean() }), {
17197
+ kind: "mutation",
17198
+ auth: "admin"
17199
+ });
17200
+ /**
16220
17201
  * `keychain` — the hub's encrypted store of secret values (D787).
16221
17202
  *
16222
17203
  * Settings blobs never hold a secret: they hold a marker
@@ -16296,6 +17277,9 @@ method(object({
16296
17277
  }), method(object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }), method(object({ refs: RefListSchema }), object({ deleted: number().int() }), {
16297
17278
  kind: "mutation",
16298
17279
  auth: "admin"
17280
+ }), method(object({ deviceId: number().int() }), object({ refs: array(string()).readonly() }), {
17281
+ kind: "mutation",
17282
+ auth: "admin"
16299
17283
  }), method(object({}), array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }), method(object({}), KeychainStateSchema, { auth: "admin" });
16300
17284
  /**
16301
17285
  * device-history — the ONE mechanism for numeric history (D850).
@@ -16754,6 +17738,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16754
17738
  kind: "mutation",
16755
17739
  auth: "admin",
16756
17740
  caller: "required"
17741
+ }), method(object({
17742
+ ref: string().min(1),
17743
+ value: string().min(1)
17744
+ }), object({
17745
+ ref: string(),
17746
+ version: number().int()
17747
+ }), {
17748
+ kind: "mutation",
17749
+ auth: "admin",
17750
+ caller: "required"
16757
17751
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16758
17752
  deleted: array(string()).readonly(),
16759
17753
  kept: array(object({
@@ -37717,6 +38711,38 @@ var DeviceRegisterPayloadSchema = object({
37717
38711
  * omits it and the keyword backstop applies. */
37718
38712
  secretConfigPaths: array(string()).optional()
37719
38713
  });
38714
+ /** One deleted device, kept by device-manager so an addon that missed the
38715
+ * deletion can still learn of it (D865). Written by the delete path ONLY. */
38716
+ var DeviceTombstoneSchema = object({
38717
+ deviceId: number().int().positive(),
38718
+ /** Epoch ms the device was deleted. */
38719
+ deletedAt: number(),
38720
+ /** The addon that owned the device when it was deleted. */
38721
+ providerAddonId: string()
38722
+ });
38723
+ /** Data held for one device that device-manager no longer knows. */
38724
+ var OrphanDeviceDataSchema = object({
38725
+ deviceId: number().int().positive(),
38726
+ /** Rows/files per store (`<addonId>:<store>`). */
38727
+ stores: record(string(), number().int().nonnegative())
38728
+ });
38729
+ var CleanupDeletedDevicesResultSchema = object({
38730
+ /**
38731
+ * `skipped` — the absence check could not be trusted (a device-list read
38732
+ * failed or the two reads disagreed); nothing was listed or deleted.
38733
+ * `dry-run` — `devices` is what a confirmed run would delete.
38734
+ * `cleaned` — `devices` is what was deleted.
38735
+ */
38736
+ status: _enum([
38737
+ "skipped",
38738
+ "dry-run",
38739
+ "cleaned"
38740
+ ]),
38741
+ reason: string().nullable(),
38742
+ devices: array(OrphanDeviceDataSchema),
38743
+ /** Implementers that could not be asked (their stores are not in `devices`). */
38744
+ unreachable: array(string())
38745
+ });
37720
38746
  var DeviceRemovePayloadSchema = object({ deviceId: number() });
37721
38747
  var DevicePersistConfigPayloadSchema = object({
37722
38748
  deviceId: number(),
@@ -37955,6 +38981,9 @@ method(object({
37955
38981
  }), method(object({ deviceId: number() }), object({ success: literal(true) }), {
37956
38982
  kind: "mutation",
37957
38983
  auth: "admin"
38984
+ }), method(object({ sinceMs: number() }), array(DeviceTombstoneSchema).readonly(), { auth: "admin" }), method(object({ confirm: boolean() }), CleanupDeletedDevicesResultSchema, {
38985
+ kind: "mutation",
38986
+ auth: "admin"
37958
38987
  }), method(object({ integrationId: string() }), object({ removed: number() }), {
37959
38988
  kind: "mutation",
37960
38989
  auth: "admin"
@@ -38417,6 +39446,72 @@ method(object({
38417
39446
  auth: "admin"
38418
39447
  });
38419
39448
  /**
39449
+ * `device-removal-hook` — the reliable way an addon learns a device was DELETED,
39450
+ * so it can delete what it keeps for that device (D865).
39451
+ *
39452
+ * ## Why an event was not enough
39453
+ *
39454
+ * `DeviceUnregistered` is telemetry and may be dropped (D8, D11). An addon that
39455
+ * hung its per-device clean-up on it left durable garbage whenever the event was
39456
+ * lost, the addon was down, or it was restarting at that moment — footage,
39457
+ * analytics rows and settings of device 4483 outlived the device. Loss of this
39458
+ * signal corrupts durable state, so it travels by RPC with a recorded fact
39459
+ * behind it (D8: "if loss would corrupt durable state, use RPC plus a reconcile").
39460
+ *
39461
+ * ## The three pieces
39462
+ *
39463
+ * 1. device-manager records a TOMBSTONE per deleted device
39464
+ * (`deviceManager.listDeletedSince`). The tombstone is written by the delete
39465
+ * path only — a device that is unregistered, offline or whose provider is
39466
+ * restarting is NOT deleted and gets none.
39467
+ * 2. After a delete, device-manager calls `onDeviceRemoved` on EVERY provider of
39468
+ * this collection, one by one, with bounded retries, logged.
39469
+ * 3. An implementer that was down asks `deviceManager.listDeletedSince` at start
39470
+ * (and periodically) and runs its own `onDeviceRemoved` for each tombstone it
39471
+ * may have missed. Reconcile is driven by tombstones, never by "the device is
39472
+ * not in the current list": a failed or partial list read must not destroy data.
39473
+ *
39474
+ * ## Contract for an implementer
39475
+ *
39476
+ * - **Idempotent.** It is called again by a retry, by a reconcile and by the
39477
+ * admin cleanup of data that predates tombstones. A device with nothing left
39478
+ * answers zero counts.
39479
+ * - **One key per store** in `counts`, deleted rows/files per store, so the log
39480
+ * line and the admin dry run can say where the data was.
39481
+ * - **Training datasets are NOT device data** and are never deleted by a hook.
39482
+ * - **Per-device SETTINGS are not hooked.** Configuration lives in the standard
39483
+ * per-device store (`ctx.settings.*DeviceStore`), which device-manager clears
39484
+ * for every addon centrally at delete time. This hook is for device DATA
39485
+ * that is not settings: footage, event media, analytics rows, history.
39486
+ * - A provider that cannot tell is allowed to throw; the caller retries it.
39487
+ *
39488
+ * `listDeviceData` is the read side of the admin "Clean data of deleted devices"
39489
+ * action: which device ids this addon holds data for, and how much per store. It
39490
+ * never deletes. device-manager decides which of those ids are absent from the
39491
+ * fleet, from TWO consistent reads of the device list (D49).
39492
+ */
39493
+ /** What a hook is told about the deletion. */
39494
+ var DeviceRemovedInputSchema = object({
39495
+ deviceId: number().int().positive(),
39496
+ /** Epoch ms the device was deleted (the tombstone's `deletedAt`). */
39497
+ deletedAt: number(),
39498
+ /** The addon that owned the device, as device-manager last knew it. */
39499
+ providerAddonId: string()
39500
+ });
39501
+ /** Rows/files/refs deleted, per store this implementer owns. */
39502
+ var DeviceRemovedResultSchema = object({ counts: record(string(), number().int().nonnegative()) });
39503
+ /** One (store, device) pair an implementer holds data for. */
39504
+ var DeviceDataEntrySchema = object({
39505
+ store: string(),
39506
+ deviceId: number().int().positive(),
39507
+ /** Rows (or files) held for the device in the store. */
39508
+ count: number().int().nonnegative()
39509
+ });
39510
+ method(DeviceRemovedInputSchema, DeviceRemovedResultSchema, {
39511
+ kind: "mutation",
39512
+ auth: "admin"
39513
+ }), method(_void(), array(DeviceDataEntrySchema).readonly(), { auth: "admin" });
39514
+ /**
38420
39515
  * `failure-contribution` — the capability an addon reports its OWN losses
38421
39516
  * through, per camera, with the denominator attached. It stores nothing.
38422
39517
  *
@@ -39140,6 +40235,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39140
40235
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39141
40236
  kind: "mutation",
39142
40237
  auth: "admin"
40238
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40239
+ kind: "mutation",
40240
+ auth: "admin"
39143
40241
  }), method(ProfileRefInputSchema, _void(), {
39144
40242
  kind: "mutation",
39145
40243
  auth: "admin"
@@ -49587,6 +50685,41 @@ var ServerRollbackInfoSchema = object({
49587
50685
  atMs: number(),
49588
50686
  reason: string()
49589
50687
  });
50688
+ /**
50689
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50690
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50691
+ * service holds, because only the hub plans) against the states the process
50692
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50693
+ * every boot, served on `getServerPackageStatus`.
50694
+ *
50695
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50696
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50697
+ * planned runner the process service has no entry for.
50698
+ */
50699
+ var RunnerRefusalSchema = object({
50700
+ runnerId: string(),
50701
+ addonIds: array(string()),
50702
+ reason: string()
50703
+ });
50704
+ var RunnerBootCheckSchema = object({
50705
+ checkedAtMs: number(),
50706
+ /** Runners planned for this node. */
50707
+ expected: number(),
50708
+ /** Planned runners whose process is `running`. */
50709
+ running: number(),
50710
+ failed: array(string()),
50711
+ refused: array(RunnerRefusalSchema),
50712
+ missing: array(string()),
50713
+ /**
50714
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50715
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50716
+ * pushed and the verdict is re-evaluated on the next runner state change.
50717
+ * Optional for version skew (absent = settled).
50718
+ */
50719
+ pending: array(string()).optional(),
50720
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50721
+ planKnown: boolean()
50722
+ });
49590
50723
  var ServerPackageStatusSchema = object({
49591
50724
  /** Root package name (`@camstack/server` on the hub). */
49592
50725
  packageName: string(),
@@ -49649,7 +50782,14 @@ var ServerPackageStatusSchema = object({
49649
50782
  * for version skew: an older provider's payload simply omits it, and an
49650
50783
  * absent wrapper is unknown — never `native`.
49651
50784
  */
49652
- wrapper: WrapperIdentitySchema.optional()
50785
+ wrapper: WrapperIdentitySchema.optional(),
50786
+ /**
50787
+ * What this node PLANNED to run against what its process service reports
50788
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50789
+ * on a provider that predates it. Absent is "not checked yet", never "all
50790
+ * well": a consumer that needs the answer treats it as pending.
50791
+ */
50792
+ runners: RunnerBootCheckSchema.optional()
49653
50793
  });
49654
50794
  var ServerUpdateCheckResultSchema = object({
49655
50795
  packageName: string(),
@@ -49700,6 +50840,13 @@ var ServerUpdateOutcomeSchema = _enum([
49700
50840
  "refused",
49701
50841
  "failed"
49702
50842
  ]);
50843
+ /** One addon the pre-flight found the target version would refuse (D877). */
50844
+ var UpdateBlockerSchema = object({
50845
+ addonId: string(),
50846
+ reason: string(),
50847
+ /** What the operator does about it. */
50848
+ remedy: string()
50849
+ });
49703
50850
  var ServerUpdateActionResultSchema = object({
49704
50851
  accepted: boolean(),
49705
50852
  targetVersion: string().nullable(),
@@ -49717,14 +50864,27 @@ var ServerUpdateActionResultSchema = object({
49717
50864
  * The failure itself, verbatim enough to act on (the npm output for a
49718
50865
  * staging install). Non-null only for `failed`.
49719
50866
  */
49720
- error: string().nullable().optional()
50867
+ error: string().nullable().optional(),
50868
+ /**
50869
+ * The addons the target version would refuse to start on this node's live
50870
+ * store (D877), present when the pre-flight refused the update
50871
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50872
+ */
50873
+ blockers: array(UpdateBlockerSchema).optional()
49721
50874
  });
49722
50875
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49723
50876
  kind: "mutation",
49724
50877
  auth: "admin"
49725
- }), method(object({
49726
- /** Explicit target version; omitted = latest from the registry. */
49727
- version: string().optional() }), ServerUpdateActionResultSchema, {
50878
+ }), method(object({
50879
+ /** Explicit target version; omitted = latest from the registry. */
50880
+ version: string().optional(),
50881
+ /**
50882
+ * Apply even though the pre-flight (D877) found addons the target would
50883
+ * refuse to start. Off by default: those addons stay down until the
50884
+ * remedy is run, which is the incident this gate exists to prevent.
50885
+ */
50886
+ acknowledgeRefusals: boolean().optional()
50887
+ }), ServerUpdateActionResultSchema, {
49728
50888
  kind: "mutation",
49729
50889
  auth: "admin",
49730
50890
  timeoutMs: 16 * 6e4
@@ -52172,7 +53332,9 @@ var ManifestShapeSchema = object({
52172
53332
  var AddonProcessSchema = object({
52173
53333
  pid: number().optional(),
52174
53334
  mode: string(),
52175
- state: string()
53335
+ state: string(),
53336
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53337
+ reason: string().optional()
52176
53338
  });
52177
53339
  /**
52178
53340
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53175,6 +54337,12 @@ object({
53175
54337
  /** Horizontal louver swing on/off. Null when the device has no
53176
54338
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53177
54339
  swingHorizontal: boolean().nullable(),
54340
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54341
+ minTemp: number().nullable().optional(),
54342
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54343
+ maxTemp: number().nullable().optional(),
54344
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54345
+ tempStep: number().positive().nullable().optional(),
53178
54346
  /** Ms epoch when the slice was last updated (push or command). */
53179
54347
  lastFetchedAt: number()
53180
54348
  });
@@ -54995,7 +56163,19 @@ var TlsStatusSchema = object({
54995
56163
  sans: array(string()),
54996
56164
  caCertPem: string().nullable(),
54997
56165
  reissueError: string().nullable(),
54998
- restartRequired: boolean()
56166
+ restartRequired: boolean(),
56167
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
56168
+ caMissing: boolean(),
56169
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
56170
+ localCaConstrained: boolean().nullable(),
56171
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
56172
+ caReplacedAt: string().nullable(),
56173
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
56174
+ storedUpload: object({
56175
+ leafFingerprintSha256: string(),
56176
+ validTo: string(),
56177
+ hasCa: boolean()
56178
+ }).nullable()
54999
56179
  });
55000
56180
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
55001
56181
  /**
@@ -55051,6 +56231,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
55051
56231
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
55052
56232
  kind: "mutation",
55053
56233
  auth: "admin"
56234
+ }), method(_void(), TlsStatusSchema, {
56235
+ kind: "mutation",
56236
+ auth: "admin"
55054
56237
  });
55055
56238
  object({
55056
56239
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -60180,7 +61363,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
60180
61363
  kind: "mutation",
60181
61364
  auth: "admin",
60182
61365
  access: "delete"
60183
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
61366
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
61367
+ kind: "mutation",
61368
+ auth: "admin",
61369
+ access: "create"
61370
+ }), method(object({
60184
61371
  userId: string(),
60185
61372
  code: string()
60186
61373
  }), object({ valid: boolean() }), {
@@ -62381,6 +63568,12 @@ Object.freeze({
62381
63568
  addonId: null,
62382
63569
  access: "view"
62383
63570
  },
63571
+ "coreBlocks.migrateRawSecrets": {
63572
+ capName: "core-blocks",
63573
+ capScope: "system",
63574
+ addonId: null,
63575
+ access: "create"
63576
+ },
62384
63577
  "coreBlocks.restart": {
62385
63578
  capName: "core-blocks",
62386
63579
  capScope: "system",
@@ -62975,6 +64168,12 @@ Object.freeze({
62975
64168
  addonId: null,
62976
64169
  access: "create"
62977
64170
  },
64171
+ "deviceManager.cleanupDeletedDevicesData": {
64172
+ capName: "device-manager",
64173
+ capScope: "system",
64174
+ addonId: null,
64175
+ access: "create"
64176
+ },
62978
64177
  "deviceManager.createDevice": {
62979
64178
  capName: "device-manager",
62980
64179
  capScope: "system",
@@ -63155,6 +64354,12 @@ Object.freeze({
63155
64354
  addonId: null,
63156
64355
  access: "view"
63157
64356
  },
64357
+ "deviceManager.listDeletedSince": {
64358
+ capName: "device-manager",
64359
+ capScope: "system",
64360
+ addonId: null,
64361
+ access: "view"
64362
+ },
63158
64363
  "deviceManager.listDeviceIdsByCaps": {
63159
64364
  capName: "device-manager",
63160
64365
  capScope: "system",
@@ -63563,6 +64768,18 @@ Object.freeze({
63563
64768
  addonId: null,
63564
64769
  access: "create"
63565
64770
  },
64771
+ "deviceRemovalHook.listDeviceData": {
64772
+ capName: "device-removal-hook",
64773
+ capScope: "system",
64774
+ addonId: null,
64775
+ access: "view"
64776
+ },
64777
+ "deviceRemovalHook.onDeviceRemoved": {
64778
+ capName: "device-removal-hook",
64779
+ capScope: "system",
64780
+ addonId: null,
64781
+ access: "create"
64782
+ },
63566
64783
  "deviceState.claimFields": {
63567
64784
  capName: "device-state",
63568
64785
  capScope: "system",
@@ -63995,6 +65212,12 @@ Object.freeze({
63995
65212
  addonId: null,
63996
65213
  access: "delete"
63997
65214
  },
65215
+ "keychain.deleteDeviceScope": {
65216
+ capName: "keychain",
65217
+ capScope: "system",
65218
+ addonId: null,
65219
+ access: "delete"
65220
+ },
63998
65221
  "keychain.getState": {
63999
65222
  capName: "keychain",
64000
65223
  capScope: "system",
@@ -64037,6 +65260,12 @@ Object.freeze({
64037
65260
  addonId: null,
64038
65261
  access: "create"
64039
65262
  },
65263
+ "keychainAdmin.importSecret": {
65264
+ capName: "keychain-admin",
65265
+ capScope: "system",
65266
+ addonId: null,
65267
+ access: "create"
65268
+ },
64040
65269
  "keychainAdmin.listAudit": {
64041
65270
  capName: "keychain-admin",
64042
65271
  capScope: "system",
@@ -64205,6 +65434,12 @@ Object.freeze({
64205
65434
  addonId: null,
64206
65435
  access: "view"
64207
65436
  },
65437
+ "llm.migrateRawSecrets": {
65438
+ capName: "llm",
65439
+ capScope: "system",
65440
+ addonId: null,
65441
+ access: "create"
65442
+ },
64208
65443
  "llm.resolveModelRef": {
64209
65444
  capName: "llm",
64210
65445
  capScope: "system",
@@ -64433,6 +65668,12 @@ Object.freeze({
64433
65668
  addonId: null,
64434
65669
  access: "create"
64435
65670
  },
65671
+ "localNetwork.useStoredUploadedCertificate": {
65672
+ capName: "local-network",
65673
+ capScope: "system",
65674
+ addonId: null,
65675
+ access: "create"
65676
+ },
64436
65677
  "lockControl.getStatus": {
64437
65678
  capName: "lock-control",
64438
65679
  capScope: "device",
@@ -67085,6 +68326,30 @@ Object.freeze({
67085
68326
  addonId: null,
67086
68327
  access: "create"
67087
68328
  },
68329
+ "recordEntries.deleteEntry": {
68330
+ capName: "record-entries",
68331
+ capScope: "system",
68332
+ addonId: null,
68333
+ access: "delete"
68334
+ },
68335
+ "recordEntries.listEntries": {
68336
+ capName: "record-entries",
68337
+ capScope: "system",
68338
+ addonId: null,
68339
+ access: "view"
68340
+ },
68341
+ "recordEntries.listEntryKinds": {
68342
+ capName: "record-entries",
68343
+ capScope: "system",
68344
+ addonId: null,
68345
+ access: "view"
68346
+ },
68347
+ "recordEntries.putEntry": {
68348
+ capName: "record-entries",
68349
+ capScope: "system",
68350
+ addonId: null,
68351
+ access: "create"
68352
+ },
67088
68353
  "recording.getAvailability": {
67089
68354
  capName: "recording",
67090
68355
  capScope: "device",
@@ -67385,6 +68650,102 @@ Object.freeze({
67385
68650
  addonId: null,
67386
68651
  access: "view"
67387
68652
  },
68653
+ "records.aggregate": {
68654
+ capName: "records",
68655
+ capScope: "system",
68656
+ addonId: null,
68657
+ access: "view"
68658
+ },
68659
+ "records.allocateId": {
68660
+ capName: "records",
68661
+ capScope: "system",
68662
+ addonId: null,
68663
+ access: "create"
68664
+ },
68665
+ "records.count": {
68666
+ capName: "records",
68667
+ capScope: "system",
68668
+ addonId: null,
68669
+ access: "view"
68670
+ },
68671
+ "records.declareKinds": {
68672
+ capName: "records",
68673
+ capScope: "system",
68674
+ addonId: null,
68675
+ access: "create"
68676
+ },
68677
+ "records.delete": {
68678
+ capName: "records",
68679
+ capScope: "system",
68680
+ addonId: null,
68681
+ access: "delete"
68682
+ },
68683
+ "records.deleteDevice": {
68684
+ capName: "records",
68685
+ capScope: "system",
68686
+ addonId: null,
68687
+ access: "delete"
68688
+ },
68689
+ "records.deleteMany": {
68690
+ capName: "records",
68691
+ capScope: "system",
68692
+ addonId: null,
68693
+ access: "delete"
68694
+ },
68695
+ "records.deleteWhere": {
68696
+ capName: "records",
68697
+ capScope: "system",
68698
+ addonId: null,
68699
+ access: "delete"
68700
+ },
68701
+ "records.get": {
68702
+ capName: "records",
68703
+ capScope: "system",
68704
+ addonId: null,
68705
+ access: "view"
68706
+ },
68707
+ "records.getMany": {
68708
+ capName: "records",
68709
+ capScope: "system",
68710
+ addonId: null,
68711
+ access: "view"
68712
+ },
68713
+ "records.histogram": {
68714
+ capName: "records",
68715
+ capScope: "system",
68716
+ addonId: null,
68717
+ access: "view"
68718
+ },
68719
+ "records.patch": {
68720
+ capName: "records",
68721
+ capScope: "system",
68722
+ addonId: null,
68723
+ access: "create"
68724
+ },
68725
+ "records.put": {
68726
+ capName: "records",
68727
+ capScope: "system",
68728
+ addonId: null,
68729
+ access: "create"
68730
+ },
68731
+ "records.putMany": {
68732
+ capName: "records",
68733
+ capScope: "system",
68734
+ addonId: null,
68735
+ access: "create"
68736
+ },
68737
+ "records.query": {
68738
+ capName: "records",
68739
+ capScope: "system",
68740
+ addonId: null,
68741
+ access: "view"
68742
+ },
68743
+ "records.secretRefs": {
68744
+ capName: "records",
68745
+ capScope: "system",
68746
+ addonId: null,
68747
+ access: "view"
68748
+ },
67388
68749
  "sceneMonitor.captureReference": {
67389
68750
  capName: "scene-monitor",
67390
68751
  capScope: "device",
@@ -67817,6 +69178,48 @@ Object.freeze({
67817
69178
  addonId: null,
67818
69179
  access: "create"
67819
69180
  },
69181
+ "storageAdmin.adoptRecords": {
69182
+ capName: "storage-admin",
69183
+ capScope: "system",
69184
+ addonId: null,
69185
+ access: "create"
69186
+ },
69187
+ "storageAdmin.dropCollection": {
69188
+ capName: "storage-admin",
69189
+ capScope: "system",
69190
+ addonId: null,
69191
+ access: "delete"
69192
+ },
69193
+ "storageAdmin.isAdoptedLegacyTable": {
69194
+ capName: "storage-admin",
69195
+ capScope: "system",
69196
+ addonId: null,
69197
+ access: "view"
69198
+ },
69199
+ "storageAdmin.listKinds": {
69200
+ capName: "storage-admin",
69201
+ capScope: "system",
69202
+ addonId: null,
69203
+ access: "view"
69204
+ },
69205
+ "storageAdmin.listTables": {
69206
+ capName: "storage-admin",
69207
+ capScope: "system",
69208
+ addonId: null,
69209
+ access: "view"
69210
+ },
69211
+ "storageAdmin.readLegacyCollection": {
69212
+ capName: "storage-admin",
69213
+ capScope: "system",
69214
+ addonId: null,
69215
+ access: "view"
69216
+ },
69217
+ "storageAdmin.readRecords": {
69218
+ capName: "storage-admin",
69219
+ capScope: "system",
69220
+ addonId: null,
69221
+ access: "view"
69222
+ },
67820
69223
  "storageEvictable.evict": {
67821
69224
  capName: "storage-evictable",
67822
69225
  capScope: "system",
@@ -68729,6 +70132,12 @@ Object.freeze({
68729
70132
  addonId: null,
68730
70133
  access: "view"
68731
70134
  },
70135
+ "userManagement.migrateRawSecrets": {
70136
+ capName: "user-management",
70137
+ capScope: "system",
70138
+ addonId: null,
70139
+ access: "create"
70140
+ },
68732
70141
  "userManagement.oauthExchangeCode": {
68733
70142
  capName: "user-management",
68734
70143
  capScope: "system",
@@ -70007,6 +71416,11 @@ Object.freeze({
70007
71416
  form: "single",
70008
71417
  optional: false
70009
71418
  }],
71419
+ "deviceRemovalHook.onDeviceRemoved": [{
71420
+ name: "deviceId",
71421
+ form: "single",
71422
+ optional: false
71423
+ }],
70010
71424
  "deviceState.claimFields": [{
70011
71425
  name: "deviceId",
70012
71426
  form: "single",
@@ -70196,6 +71610,11 @@ Object.freeze({
70196
71610
  form: "single",
70197
71611
  optional: false
70198
71612
  }],
71613
+ "keychain.deleteDeviceScope": [{
71614
+ name: "deviceId",
71615
+ form: "single",
71616
+ optional: false
71617
+ }],
70199
71618
  "lawnMowerControl.dock": [{
70200
71619
  name: "deviceId",
70201
71620
  form: "single",
@@ -71395,6 +72814,37 @@ Object.freeze({
71395
72814
  form: "single",
71396
72815
  optional: false
71397
72816
  }],
72817
+ "records.count": [{
72818
+ name: "deviceId",
72819
+ form: "single",
72820
+ optional: true
72821
+ }],
72822
+ "records.deleteDevice": [{
72823
+ name: "deviceId",
72824
+ form: "single",
72825
+ optional: false
72826
+ }],
72827
+ "records.deleteWhere": [{
72828
+ name: "deviceId",
72829
+ form: "single",
72830
+ optional: true
72831
+ }],
72832
+ "records.histogram": [{
72833
+ name: "deviceId",
72834
+ form: "single",
72835
+ optional: true
72836
+ }],
72837
+ "records.putMany": [{
72838
+ name: "records",
72839
+ form: "object-array",
72840
+ optional: false,
72841
+ itemField: "deviceId"
72842
+ }],
72843
+ "records.query": [{
72844
+ name: "deviceId",
72845
+ form: "single",
72846
+ optional: true
72847
+ }],
71398
72848
  "sceneMonitor.captureReference": [{
71399
72849
  name: "deviceId",
71400
72850
  form: "single",
@@ -71511,6 +72961,17 @@ Object.freeze({
71511
72961
  form: "single",
71512
72962
  optional: false
71513
72963
  }],
72964
+ "storageAdmin.adoptRecords": [{
72965
+ name: "records",
72966
+ form: "object-array",
72967
+ optional: false,
72968
+ itemField: "deviceId"
72969
+ }],
72970
+ "storageAdmin.readRecords": [{
72971
+ name: "deviceId",
72972
+ form: "single",
72973
+ optional: true
72974
+ }],
71514
72975
  "streamBroker.acquireEgressTranscode": [{
71515
72976
  name: "deviceId",
71516
72977
  form: "single",
@@ -72544,6 +74005,8 @@ new Set([
72544
74005
  "audio-tools",
72545
74006
  "audio-silence"
72546
74007
  ]);
74008
+ AppPageLangSchema.options;
74009
+ record(string().min(1), string());
72547
74010
  /**
72548
74011
  * TimelapseRule — the STANDALONE scheduled timelapse producer's rule model.
72549
74012
  *
@@ -72977,6 +74440,12 @@ Object.defineProperty(exports, "BaseAddon", {
72977
74440
  return BaseAddon;
72978
74441
  }
72979
74442
  });
74443
+ Object.defineProperty(exports, "RecordSecretUnavailableError", {
74444
+ enumerable: true,
74445
+ get: function() {
74446
+ return RecordSecretUnavailableError;
74447
+ }
74448
+ });
72980
74449
  Object.defineProperty(exports, "SECRET_CLEAR", {
72981
74450
  enumerable: true,
72982
74451
  get: function() {
@@ -73019,6 +74488,12 @@ Object.defineProperty(exports, "__toESM", {
73019
74488
  return __toESM;
73020
74489
  }
73021
74490
  });
74491
+ Object.defineProperty(exports, "_enum", {
74492
+ enumerable: true,
74493
+ get: function() {
74494
+ return _enum;
74495
+ }
74496
+ });
73022
74497
  Object.defineProperty(exports, "addonRoutesCapability", {
73023
74498
  enumerable: true,
73024
74499
  get: function() {
@@ -73079,6 +74554,18 @@ Object.defineProperty(exports, "claimedRequestOrigins", {
73079
74554
  return claimedRequestOrigins;
73080
74555
  }
73081
74556
  });
74557
+ Object.defineProperty(exports, "defineEntryKind", {
74558
+ enumerable: true,
74559
+ get: function() {
74560
+ return defineEntryKind;
74561
+ }
74562
+ });
74563
+ Object.defineProperty(exports, "defineRecordKinds", {
74564
+ enumerable: true,
74565
+ get: function() {
74566
+ return defineRecordKinds;
74567
+ }
74568
+ });
73082
74569
  Object.defineProperty(exports, "errMsg", {
73083
74570
  enumerable: true,
73084
74571
  get: function() {
@@ -73163,6 +74650,12 @@ Object.defineProperty(exports, "resolveIconKey", {
73163
74650
  return resolveIconKey;
73164
74651
  }
73165
74652
  });
74653
+ Object.defineProperty(exports, "settingsArrayAdoptsFrom", {
74654
+ enumerable: true,
74655
+ get: function() {
74656
+ return settingsArrayAdoptsFrom;
74657
+ }
74658
+ });
73166
74659
  Object.defineProperty(exports, "string", {
73167
74660
  enumerable: true,
73168
74661
  get: function() {