@camstack/addon-google-services 0.2.8 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { randomBytes } from "node:crypto";
2
- //#region ../types/dist/event-category-C4hVnRo8.mjs
2
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
3
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
4
  EventCategory["SystemBoot"] = "system.boot";
5
5
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -63,6 +63,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
63
63
  * consumes this category and maps it to the `addon-crash-loop` kind.
64
64
  */
65
65
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
66
+ /**
67
+ * A runner whose addon refused to start with a typed reason (D877) - parked
68
+ * in `refused`, never counted by the crash breaker, retried on operator
69
+ * action. One event per refusal.
70
+ */
71
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
72
+ /**
73
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
74
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
75
+ * runner is still pending) and the alert centre (close a recovered runner).
76
+ */
77
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
78
+ /**
79
+ * The node's one-shot runner boot check (D877): planned runners against the
80
+ * process service, `degraded` when any is failed, refused or missing. The
81
+ * alert centre turns it into one alert and a direct critical push.
82
+ */
83
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
66
84
  EventCategory["AddonError"] = "addon.error";
67
85
  EventCategory["AddonPageReady"] = "addon.page-ready";
68
86
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -4105,6 +4123,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4105
4123
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4106
4124
  json.type = "boolean";
4107
4125
  };
4126
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4127
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4128
+ };
4129
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4130
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4131
+ };
4108
4132
  var nullProcessor = (_schema, ctx, json, _params) => {
4109
4133
  if (ctx.target === "openapi-3.0") {
4110
4134
  json.type = "string";
@@ -4112,12 +4136,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4112
4136
  json.enum = [null];
4113
4137
  } else json.type = "null";
4114
4138
  };
4139
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4140
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4141
+ };
4115
4142
  var voidProcessor = (_schema, ctx, _json, _params) => {
4116
4143
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4117
4144
  };
4118
4145
  var neverProcessor = (_schema, _ctx, json, _params) => {
4119
4146
  json.not = {};
4120
4147
  };
4148
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4149
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4121
4150
  var dateProcessor = (_schema, ctx, _json, _params) => {
4122
4151
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4123
4152
  };
@@ -4149,12 +4178,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4149
4178
  json.enum = vals;
4150
4179
  }
4151
4180
  };
4181
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4182
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4183
+ };
4184
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4185
+ const _json = json;
4186
+ const pattern = schema._zod.pattern;
4187
+ if (!pattern) throw new Error("Pattern not found in template literal");
4188
+ _json.type = "string";
4189
+ _json.pattern = pattern.source;
4190
+ };
4191
+ var fileProcessor = (schema, _ctx, json, _params) => {
4192
+ const _json = json;
4193
+ const file = {
4194
+ type: "string",
4195
+ format: "binary",
4196
+ contentEncoding: "binary"
4197
+ };
4198
+ const { minimum, maximum, mime } = schema._zod.bag;
4199
+ if (minimum !== void 0) file.minLength = minimum;
4200
+ if (maximum !== void 0) file.maxLength = maximum;
4201
+ if (mime) if (mime.length === 1) {
4202
+ file.contentMediaType = mime[0];
4203
+ Object.assign(_json, file);
4204
+ } else {
4205
+ Object.assign(_json, file);
4206
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4207
+ }
4208
+ else Object.assign(_json, file);
4209
+ };
4210
+ var successProcessor = (_schema, _ctx, json, _params) => {
4211
+ json.type = "boolean";
4212
+ };
4152
4213
  var customProcessor = (_schema, ctx, _json, _params) => {
4153
4214
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4154
4215
  };
4216
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4217
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4218
+ };
4155
4219
  var transformProcessor = (_schema, ctx, _json, _params) => {
4156
4220
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4157
4221
  };
4222
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4223
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4224
+ };
4225
+ var setProcessor = (_schema, ctx, _json, _params) => {
4226
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4227
+ };
4158
4228
  var arrayProcessor = (schema, ctx, _json, params) => {
4159
4229
  const json = _json;
4160
4230
  const def = schema._zod.def;
@@ -4359,6 +4429,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4359
4429
  seen.ref = def.innerType;
4360
4430
  json.readOnly = true;
4361
4431
  };
4432
+ var promiseProcessor = (schema, ctx, _json, params) => {
4433
+ const def = schema._zod.def;
4434
+ process(def.innerType, ctx, params);
4435
+ const seen = ctx.seen.get(schema);
4436
+ seen.ref = def.innerType;
4437
+ };
4362
4438
  var optionalProcessor = (schema, ctx, _json, params) => {
4363
4439
  const def = schema._zod.def;
4364
4440
  process(def.innerType, ctx, params);
@@ -4371,6 +4447,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4371
4447
  const seen = ctx.seen.get(schema);
4372
4448
  seen.ref = innerType;
4373
4449
  };
4450
+ var allProcessors = {
4451
+ string: stringProcessor,
4452
+ number: numberProcessor,
4453
+ boolean: booleanProcessor,
4454
+ bigint: bigintProcessor,
4455
+ symbol: symbolProcessor,
4456
+ null: nullProcessor,
4457
+ undefined: undefinedProcessor,
4458
+ void: voidProcessor,
4459
+ never: neverProcessor,
4460
+ any: anyProcessor,
4461
+ unknown: unknownProcessor,
4462
+ date: dateProcessor,
4463
+ enum: enumProcessor,
4464
+ literal: literalProcessor,
4465
+ nan: nanProcessor,
4466
+ template_literal: templateLiteralProcessor,
4467
+ file: fileProcessor,
4468
+ success: successProcessor,
4469
+ custom: customProcessor,
4470
+ function: functionProcessor,
4471
+ transform: transformProcessor,
4472
+ map: mapProcessor,
4473
+ set: setProcessor,
4474
+ array: arrayProcessor,
4475
+ object: objectProcessor,
4476
+ union: unionProcessor,
4477
+ intersection: intersectionProcessor,
4478
+ tuple: tupleProcessor,
4479
+ record: recordProcessor,
4480
+ nullable: nullableProcessor,
4481
+ nonoptional: nonoptionalProcessor,
4482
+ default: defaultProcessor,
4483
+ prefault: prefaultProcessor,
4484
+ catch: catchProcessor,
4485
+ pipe: pipeProcessor,
4486
+ readonly: readonlyProcessor,
4487
+ promise: promiseProcessor,
4488
+ optional: optionalProcessor,
4489
+ lazy: lazyProcessor
4490
+ };
4491
+ function toJSONSchema(input, params) {
4492
+ if ("_idmap" in input) {
4493
+ const registry = input;
4494
+ const ctx = initializeContext({
4495
+ ...params,
4496
+ processors: allProcessors
4497
+ });
4498
+ const defs = {};
4499
+ for (const entry of registry._idmap.entries()) {
4500
+ const [_, schema] = entry;
4501
+ process(schema, ctx);
4502
+ }
4503
+ const schemas = {};
4504
+ ctx.external = {
4505
+ registry,
4506
+ uri: params?.uri,
4507
+ defs
4508
+ };
4509
+ for (const entry of registry._idmap.entries()) {
4510
+ const [key, schema] = entry;
4511
+ extractDefs(ctx, schema);
4512
+ schemas[key] = finalize(ctx, schema);
4513
+ }
4514
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4515
+ return { schemas };
4516
+ }
4517
+ const ctx = initializeContext({
4518
+ ...params,
4519
+ processors: allProcessors
4520
+ });
4521
+ process(input, ctx);
4522
+ extractDefs(ctx, input);
4523
+ return finalize(ctx, input);
4524
+ }
4374
4525
  //#endregion
4375
4526
  //#region ../../node_modules/zod/v4/classic/iso.js
4376
4527
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5387,7 +5538,7 @@ var ZodIssueCode = {
5387
5538
  var ZodFirstPartyTypeKind;
5388
5539
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5389
5540
  //#endregion
5390
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5541
+ //#region ../types/dist/sleep-bZIhUvjd.mjs
5391
5542
  /**
5392
5543
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5393
5544
  * window to float samples (D455).
@@ -5504,7 +5655,7 @@ function isKeychainStoredField(field) {
5504
5655
  var SECRET_CLEAR = { $secretClear: true };
5505
5656
  /** The `'***'` token D634 redaction writes for non-admins. */
5506
5657
  var LEGACY_DEVICE_REDACTION = "***";
5507
- function isRecord$2(value) {
5658
+ function isRecord$5(value) {
5508
5659
  return typeof value === "object" && value !== null && !Array.isArray(value);
5509
5660
  }
5510
5661
  function makeSecretMarker(ref) {
@@ -5515,12 +5666,12 @@ function makeSecretMarker(ref) {
5515
5666
  }
5516
5667
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5517
5668
  function isSecretMarker(value) {
5518
- if (!isRecord$2(value)) return false;
5669
+ if (!isRecord$5(value)) return false;
5519
5670
  const ref = value["$secret"];
5520
5671
  return typeof ref === "string" && ref.length > 0;
5521
5672
  }
5522
5673
  function isSecretClear(value) {
5523
- return isRecord$2(value) && value["$secretClear"] === true;
5674
+ return isRecord$5(value) && value["$secretClear"] === true;
5524
5675
  }
5525
5676
  /**
5526
5677
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6130,7 +6281,7 @@ var KeychainWriteRefusedError = class extends Error {
6130
6281
  }
6131
6282
  };
6132
6283
  var KEEP = { kind: "keep" };
6133
- function isRecord$1(value) {
6284
+ function isRecord$4(value) {
6134
6285
  return typeof value === "object" && value !== null && !Array.isArray(value);
6135
6286
  }
6136
6287
  function defaultMintId() {
@@ -6143,7 +6294,7 @@ function collectSecretMarkerRefs(value, out = []) {
6143
6294
  return out;
6144
6295
  }
6145
6296
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6146
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6297
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6147
6298
  return out;
6148
6299
  }
6149
6300
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6198,7 +6349,7 @@ function rowId(row, idKey) {
6198
6349
  return null;
6199
6350
  }
6200
6351
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6201
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6352
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6202
6353
  if (!Array.isArray(incoming)) {
6203
6354
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6204
6355
  return {
@@ -6214,7 +6365,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6214
6365
  const kept = /* @__PURE__ */ new Set();
6215
6366
  const rows = [];
6216
6367
  for (const row of incoming) {
6217
- if (!isRecord$1(row)) {
6368
+ if (!isRecord$4(row)) {
6218
6369
  rows.push(row);
6219
6370
  continue;
6220
6371
  }
@@ -6239,7 +6390,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6239
6390
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6240
6391
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6241
6392
  case "object": {
6242
- if (!isRecord$1(incoming)) {
6393
+ if (!isRecord$4(incoming)) {
6243
6394
  if (incoming === void 0) return KEEP;
6244
6395
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6245
6396
  return {
@@ -6247,7 +6398,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6247
6398
  value: incoming
6248
6399
  };
6249
6400
  }
6250
- const storedObj = isRecord$1(stored) ? stored : {};
6401
+ const storedObj = isRecord$4(stored) ? stored : {};
6251
6402
  return {
6252
6403
  kind: "value",
6253
6404
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6370,7 +6521,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6370
6521
  value: items
6371
6522
  };
6372
6523
  }
6373
- if (isRecord$1(v)) {
6524
+ if (isRecord$4(v)) {
6374
6525
  const out = {};
6375
6526
  for (const [k, child] of Object.entries(v)) {
6376
6527
  const s = substitute(child);
@@ -6402,7 +6553,7 @@ var SecretOverwriteRefusedError = class extends Error {
6402
6553
  this.name = "SecretOverwriteRefusedError";
6403
6554
  }
6404
6555
  };
6405
- function isRecord(value) {
6556
+ function isRecord$3(value) {
6406
6557
  return typeof value === "object" && value !== null && !Array.isArray(value);
6407
6558
  }
6408
6559
  function resolvedValue(pass, marker) {
@@ -6431,7 +6582,7 @@ function inArray(pass, incoming, stored) {
6431
6582
  return incoming.map((item, index) => {
6432
6583
  const twin = stored[index];
6433
6584
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6434
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6585
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6435
6586
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6436
6587
  return item;
6437
6588
  });
@@ -6442,7 +6593,7 @@ function inArrayRow(pass, incoming, stored) {
6442
6593
  const twin = stored[key];
6443
6594
  if (isSecretMarker(twin)) {
6444
6595
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6445
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6596
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6446
6597
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6447
6598
  }
6448
6599
  return out;
@@ -6450,7 +6601,7 @@ function inArrayRow(pass, incoming, stored) {
6450
6601
  async function walk(pass, incoming, stored) {
6451
6602
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6452
6603
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6453
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6604
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6454
6605
  const out = { ...incoming };
6455
6606
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6456
6607
  return out;
@@ -6481,7 +6632,7 @@ async function restoreUnchangedSecrets(input) {
6481
6632
  function isJsonEqual(a, b) {
6482
6633
  if (Object.is(a, b)) return true;
6483
6634
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6484
- if (isRecord(a) && isRecord(b)) {
6635
+ if (isRecord$3(a) && isRecord$3(b)) {
6485
6636
  const keys = Object.keys(a);
6486
6637
  if (keys.length !== Object.keys(b).length) return false;
6487
6638
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6505,7 +6656,7 @@ function markerKeysOf(blob, owner) {
6505
6656
  }
6506
6657
  function nodeFromStored(value, owner) {
6507
6658
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6508
- if (!isRecord(value)) return null;
6659
+ if (!isRecord$3(value)) return null;
6509
6660
  const children = /* @__PURE__ */ new Map();
6510
6661
  for (const [key, child] of Object.entries(value)) {
6511
6662
  const node = nodeFromStored(child, owner);
@@ -6638,7 +6789,6 @@ function createHandle(raw, opts) {
6638
6789
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6639
6790
  const readAddonStoreResult = raw.readAddonStoreResult;
6640
6791
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6641
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6642
6792
  const overrides = {
6643
6793
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6644
6794
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6662,12 +6812,12 @@ function createHandle(raw, opts) {
6662
6812
  };
6663
6813
  } } : {},
6664
6814
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6665
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6666
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6815
+ readDeviceStoreBatch: async (deviceIds) => {
6816
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6667
6817
  const out = /* @__PURE__ */ new Map();
6668
6818
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6669
6819
  return out;
6670
- } } : {},
6820
+ },
6671
6821
  writeAddonStore: async (patch) => {
6672
6822
  await writeAddon(patch);
6673
6823
  },
@@ -7294,7 +7444,7 @@ var BaseAddon = class {
7294
7444
  if (!ctx) return;
7295
7445
  const addonId = ctx.id;
7296
7446
  setImmediate(() => {
7297
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7447
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7298
7448
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7299
7449
  }).catch((err) => {
7300
7450
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7494,7 +7644,7 @@ var BaseAddon = class {
7494
7644
  return this._addonSecretTree;
7495
7645
  }
7496
7646
  deviceSecretTree() {
7497
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7647
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7498
7648
  return this._deviceSecretTree;
7499
7649
  }
7500
7650
  /**
@@ -7570,42 +7720,135 @@ var BaseAddon = class {
7570
7720
  this[timerOf] = timer;
7571
7721
  }
7572
7722
  /**
7573
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7574
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7575
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7576
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7723
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7724
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7577
7725
  * addon permanently broken.
7578
7726
  *
7579
- * Retry only the two known infra fingerprints. Anything else propagates so
7580
- * real bugs surface immediately. After the budget expires we fall back to
7581
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7727
+ * Two kinds of outage, two budgets:
7728
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7729
+ * initialized`, `provider not available`): a short budget, then the addon
7730
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7731
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7732
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7733
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7734
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7735
+ * loop. A long, bounded budget; only after it the error propagates - the
7736
+ * addon never runs on defaults for a store it could not ask.
7737
+ * Anything else propagates immediately so real bugs surface.
7582
7738
  */
7583
7739
  async readAddonStoreWithRetry() {
7584
7740
  const settings = this.rawSettings();
7585
7741
  if (!settings) return {};
7586
- const delaysMs = [
7587
- 150,
7588
- 350,
7589
- 600,
7590
- 900
7591
- ];
7592
7742
  let lastErr;
7593
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7743
+ for (let attempt = 0;; attempt++) try {
7594
7744
  const stored = await settings.readAddonStore() ?? {};
7595
7745
  this.settingsStoreReady = true;
7596
7746
  return stored;
7597
7747
  } catch (err) {
7598
7748
  lastErr = err;
7599
- const msg = err instanceof Error ? err.message : String(err);
7600
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7601
- if (attempt === delaysMs.length) break;
7602
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7749
+ const kind = classifyStoreError(err);
7750
+ if (kind === "permanent") throw err;
7751
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7752
+ if (delay === void 0) {
7753
+ if (kind === "transport") throw err;
7754
+ break;
7755
+ }
7756
+ await new Promise((r) => setTimeout(r, delay));
7603
7757
  }
7604
7758
  this.settingsStoreReady = false;
7605
7759
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7606
7760
  return {};
7607
7761
  }
7608
7762
  };
7763
+ /** The settings store's own restart fingerprints. */
7764
+ var RESTART_RETRY_DELAYS_MS = [
7765
+ 150,
7766
+ 350,
7767
+ 600,
7768
+ 900
7769
+ ];
7770
+ /** A hub restarting under a booting runner: ~100 s in total. */
7771
+ var TRANSPORT_RETRY_DELAYS_MS = [
7772
+ 150,
7773
+ 350,
7774
+ 600,
7775
+ 900,
7776
+ 2e3,
7777
+ 5e3,
7778
+ 1e4,
7779
+ 2e4,
7780
+ 3e4,
7781
+ 3e4
7782
+ ];
7783
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7784
+ /** Node / socket error codes of a connection that did not happen or broke. */
7785
+ var TRANSPORT_CODES = new Set([
7786
+ "ECONNREFUSED",
7787
+ "ECONNRESET",
7788
+ "ETIMEDOUT",
7789
+ "EPIPE",
7790
+ "EHOSTUNREACH",
7791
+ "ENETUNREACH"
7792
+ ]);
7793
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7794
+ var UNAVAILABLE_TRPC_CODES = new Set([
7795
+ "TIMEOUT",
7796
+ "SERVICE_UNAVAILABLE",
7797
+ "BAD_GATEWAY",
7798
+ "GATEWAY_TIMEOUT"
7799
+ ]);
7800
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7801
+ var TRANSPORT_PHRASES = [
7802
+ "discovery deadline exceeded",
7803
+ "parent could not route child unowned cap call",
7804
+ "UDS request timed out after",
7805
+ "channel closed"
7806
+ ];
7807
+ /** Moleculer error `type`s of a call that could not be served right now. */
7808
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7809
+ "REQUEST_TIMEOUT",
7810
+ "SERVICE_NOT_FOUND",
7811
+ "SERVICE_NOT_AVAILABLE",
7812
+ "REQUEST_REJECTED",
7813
+ "BROKER_DISCONNECTED"
7814
+ ]);
7815
+ function stringProp(value, key) {
7816
+ if (typeof value !== "object" || value === null) return void 0;
7817
+ const found = Reflect.get(value, key);
7818
+ return typeof found === "string" ? found : void 0;
7819
+ }
7820
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7821
+ function errorCode(err) {
7822
+ const out = {};
7823
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7824
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7825
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7826
+ if (node !== void 0) out.node = node;
7827
+ const trpc = stringProp(data, "code");
7828
+ if (trpc !== void 0) out.trpc = trpc;
7829
+ return out;
7830
+ }
7831
+ /**
7832
+ * Is a settings read failure worth retrying, and with which budget? Only
7833
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7834
+ * one of the exact phrases our own transport raises. A message that merely
7835
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7836
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7837
+ */
7838
+ function classifyStoreError(err) {
7839
+ const message = err instanceof Error ? err.message : String(err);
7840
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7841
+ const code = errorCode(err);
7842
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7843
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7844
+ if (typeof err === "object" && err !== null) {
7845
+ if (Reflect.get(err, "retryable") === true) return "transport";
7846
+ const type = stringProp(err, "type");
7847
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7848
+ }
7849
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7850
+ return "permanent";
7851
+ }
7609
7852
  /**
7610
7853
  * Collect the keys of every field marked `perNode: true`, recursing into
7611
7854
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7695,6 +7938,356 @@ var PeerBytesTicketSchema = object({
7695
7938
  */
7696
7939
  declaredBytes: number().int().nonnegative().nullable()
7697
7940
  });
7941
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7942
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7943
+ var RECORD_DATABASES = ["settings", "events"];
7944
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7945
+ var RECORD_CLASSES = [
7946
+ "config",
7947
+ "ledger",
7948
+ "audit",
7949
+ "mirror",
7950
+ "ephemeral"
7951
+ ];
7952
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7953
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7954
+ var RECORD_BATCH_MAX = 1e3;
7955
+ var RECORD_QUERY_MAX = 1e3;
7956
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
7957
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
7958
+ var PREFIX = "records/";
7959
+ /** The base of every records failure. `detail` is the human part of the message. */
7960
+ var RecordsError = class extends Error {
7961
+ code;
7962
+ detail;
7963
+ constructor(code, detail) {
7964
+ super(`${PREFIX}${code}: ${detail}`);
7965
+ this.name = "RecordsError";
7966
+ this.code = code;
7967
+ this.detail = detail;
7968
+ }
7969
+ };
7970
+ /** The keychain could not store or serve a value: explicit, never an empty string. */
7971
+ var RecordSecretUnavailableError = class extends RecordsError {
7972
+ constructor(detail) {
7973
+ super("secret-unavailable", detail);
7974
+ this.name = "RecordSecretUnavailableError";
7975
+ }
7976
+ };
7977
+ var InvalidRecordError = class extends RecordsError {
7978
+ constructor(detail) {
7979
+ super("invalid-record", detail);
7980
+ this.name = "InvalidRecordError";
7981
+ }
7982
+ };
7983
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
7984
+ var DeclarationRefusedError = class extends RecordsError {
7985
+ constructor(detail) {
7986
+ super("declaration-refused", detail);
7987
+ this.name = "DeclarationRefusedError";
7988
+ }
7989
+ };
7990
+ function defOf(schema) {
7991
+ const zodBag = Reflect.get(schema, "_zod");
7992
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7993
+ const def = Reflect.get(zodBag, "def");
7994
+ if (typeof def !== "object" || def === null) return {};
7995
+ return def;
7996
+ }
7997
+ function declaredHere(schema) {
7998
+ return globalRegistry.get(schema)?.secret === true;
7999
+ }
8000
+ /** Wrapper kinds whose `innerType` is the field itself. */
8001
+ var WRAPPERS = new Set([
8002
+ "optional",
8003
+ "nullable",
8004
+ "default",
8005
+ "prefault",
8006
+ "catch",
8007
+ "readonly",
8008
+ "nonoptional"
8009
+ ]);
8010
+ /**
8011
+ * The schema layers that make up ONE field: the schema itself and every
8012
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8013
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8014
+ * `.transform` on `in`).
8015
+ */
8016
+ function layersOf(schema) {
8017
+ const out = [];
8018
+ const queue = [schema];
8019
+ while (queue.length > 0) {
8020
+ const s = queue.shift();
8021
+ if (!s || out.includes(s)) continue;
8022
+ out.push(s);
8023
+ const def = defOf(s);
8024
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8025
+ if (def.type === "pipe") {
8026
+ if (def.in) queue.push(def.in);
8027
+ if (def.out) queue.push(def.out);
8028
+ }
8029
+ }
8030
+ return out;
8031
+ }
8032
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8033
+ function isZodSecret(schema) {
8034
+ return layersOf(schema).some(declaredHere);
8035
+ }
8036
+ /**
8037
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8038
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8039
+ * object or array is reported as one path and not descended into — everything
8040
+ * under it is secret.
8041
+ */
8042
+ function collectZodSecretPaths(schema, prefix = "") {
8043
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8044
+ const paths = [];
8045
+ for (const layer of layersOf(schema)) {
8046
+ const def = defOf(layer);
8047
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8048
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8049
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8050
+ else if (def.type === "intersection") {
8051
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8052
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8053
+ }
8054
+ }
8055
+ return [...new Set(paths)];
8056
+ }
8057
+ /**
8058
+ * Secret fields of a record, addressed the way a Zod schema declares them
8059
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8060
+ * (`auth.accessToken`, `headers[].value`).
8061
+ *
8062
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8063
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8064
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8065
+ * leaf names its element: `headers[X-Api].value`.
8066
+ *
8067
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8068
+ */
8069
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8070
+ function parseSecretPath(path) {
8071
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8072
+ return path.split(".").map((raw) => {
8073
+ const each = raw.endsWith("[]");
8074
+ const key = each ? raw.slice(0, -2) : raw;
8075
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8076
+ return {
8077
+ key,
8078
+ each
8079
+ };
8080
+ });
8081
+ }
8082
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8083
+ function secretArrayPrefixes(path) {
8084
+ const segments = parseSecretPath(path);
8085
+ const prefixes = [];
8086
+ const walked = [];
8087
+ for (const segment of segments) {
8088
+ walked.push(segment.key);
8089
+ if (segment.each) prefixes.push(walked.join("."));
8090
+ }
8091
+ return prefixes;
8092
+ }
8093
+ /**
8094
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8095
+ * Zod row schema that describes it, and the helper that turns the two into the
8096
+ * JSON the engine stores.
8097
+ *
8098
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8099
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8100
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
8101
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
8102
+ * never a field name (D879).
8103
+ */
8104
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
8105
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
8106
+ var RecordIndexSchema = object({
8107
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
8108
+ fields: array(RecordFieldPathSchema).min(1).max(4),
8109
+ unique: boolean().optional()
8110
+ }).strict();
8111
+ var RecordRetentionSchema = union([
8112
+ object({
8113
+ ttlMs: number().int().positive(),
8114
+ from: _enum(["at", "write"])
8115
+ }).strict(),
8116
+ object({
8117
+ maxRows: number().int().positive().optional(),
8118
+ maxRowsPerDevice: number().int().positive().optional()
8119
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
8120
+ object({
8121
+ owner: string().min(1),
8122
+ reason: string().min(1)
8123
+ }).strict(),
8124
+ object({ none: string().min(1) }).strict()
8125
+ ]);
8126
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
8127
+ var EntryDescriptorSchema = object({
8128
+ title: string().min(1),
8129
+ /** The record body field shown as the entry's name. */
8130
+ nameField: string().min(1),
8131
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
8132
+ fields: record(string(), unknown())
8133
+ }).strict();
8134
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
8135
+ var RecordKindDeclarationSchema = object({
8136
+ database: _enum(RECORD_DATABASES).default("settings"),
8137
+ class: _enum(RECORD_CLASSES),
8138
+ writeTrigger: string().min(1),
8139
+ device: _enum([
8140
+ "required",
8141
+ "optional",
8142
+ "none"
8143
+ ]).default("none"),
8144
+ at: _enum(["required", "none"]).default("none"),
8145
+ indexes: array(RecordIndexSchema).max(8).default([]),
8146
+ retention: RecordRetentionSchema,
8147
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
8148
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
8149
+ /** Derived from the Zod schema; never written by hand. */
8150
+ secretPaths: array(string().min(1)).default([]),
8151
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
8152
+ secretArrayKeys: record(string(), string()).default({}),
8153
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
8154
+ adoptsFrom: string().min(1).optional(),
8155
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
8156
+ transactFamily: string().min(1).optional(),
8157
+ entry: EntryDescriptorSchema.optional()
8158
+ }).strict();
8159
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8160
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8161
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8162
+ function assertValidDeclaration(name, decl) {
8163
+ const refuse = (why) => {
8164
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8165
+ };
8166
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8167
+ const seen = /* @__PURE__ */ new Set();
8168
+ for (const index of decl.indexes) {
8169
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8170
+ seen.add(index.name);
8171
+ }
8172
+ const { retention } = decl;
8173
+ const hasSecrets = decl.secretPaths.length > 0;
8174
+ if ("ttlMs" in retention) {
8175
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8176
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8177
+ }
8178
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8179
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8180
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8181
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8182
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8183
+ if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
8184
+ }
8185
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8186
+ for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
8187
+ }
8188
+ function bodyFieldsOf(schema) {
8189
+ return { ...toJSONSchema(schema, {
8190
+ unrepresentable: "any",
8191
+ io: "input"
8192
+ }) };
8193
+ }
8194
+ function isRecordLike(value) {
8195
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8196
+ }
8197
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8198
+ function hasNameField(json, field) {
8199
+ const branches = json["oneOf"] ?? json["anyOf"];
8200
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8201
+ const properties = json["properties"];
8202
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8203
+ }
8204
+ /**
8205
+ * Declare the kinds of a package. The keys are the kind names. The result is
8206
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8207
+ * types its handle from.
8208
+ */
8209
+ function defineRecordKinds(specs) {
8210
+ const out = {};
8211
+ for (const [name, spec] of Object.entries(specs)) {
8212
+ const secretPaths = collectZodSecretPaths(spec.schema);
8213
+ const nameField = spec.entry?.nameField ?? "name";
8214
+ const fields = bodyFieldsOf(spec.schema);
8215
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8216
+ const parsed = RecordKindDeclarationSchema.parse({
8217
+ database: spec.database,
8218
+ class: spec.class,
8219
+ writeTrigger: spec.writeTrigger,
8220
+ device: spec.device,
8221
+ at: spec.at,
8222
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8223
+ retention: spec.retention,
8224
+ deviceRemoval: spec.deviceRemoval,
8225
+ maxDataBytes: spec.maxDataBytes,
8226
+ secretPaths: [...secretPaths],
8227
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8228
+ adoptsFrom: spec.adoptsFrom,
8229
+ transactFamily: spec.transactFamily,
8230
+ entry: spec.entry === void 0 ? void 0 : {
8231
+ title: spec.entry.title,
8232
+ nameField,
8233
+ fields
8234
+ }
8235
+ });
8236
+ assertValidDeclaration(name, parsed);
8237
+ out[name] = {
8238
+ name,
8239
+ schema: spec.schema,
8240
+ declaration: parsed
8241
+ };
8242
+ }
8243
+ return out;
8244
+ }
8245
+ /**
8246
+ * Entry kinds (D881): every list of user-created entries (notification
8247
+ * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
8248
+ * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
8249
+ * through the `record-entries` capability with password fields derived from
8250
+ * the schema (`.meta({ secret: true })`).
8251
+ */
8252
+ /** The body of a plain entry: a name and the fields the kind adds. */
8253
+ function entryBody(shape) {
8254
+ return object({
8255
+ name: string().min(1),
8256
+ ...shape
8257
+ });
8258
+ }
8259
+ /**
8260
+ * Declare one entry kind. An entry is configuration: never trimmed by the
8261
+ * engine, never aged, belonging to no device.
8262
+ */
8263
+ function defineEntryKind(name, spec) {
8264
+ const defined = defineRecordKinds({ [name]: {
8265
+ schema: spec.schema,
8266
+ class: "config",
8267
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
8268
+ retention: { none: "an entry goes only when the operator deletes it" },
8269
+ ...spec.database === void 0 ? {} : { database: spec.database },
8270
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
8271
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
8272
+ ...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
8273
+ entry: {
8274
+ title: spec.title,
8275
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
8276
+ }
8277
+ } })[name];
8278
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
8279
+ return defined;
8280
+ }
8281
+ /**
8282
+ * Legacy source for broker entry adoption (B2): brokers live in addon-settings
8283
+ * as one row `<addonId>.brokers` whose value is an array until records-adopt
8284
+ * copies them into the entry kind.
8285
+ */
8286
+ var SETTINGS_BROKERS_ADOPTS_PREFIX = "@settings-brokers/";
8287
+ /** The `adoptsFrom` value for an addon's broker entry kind. */
8288
+ function settingsBrokersAdoptsFrom(addonId) {
8289
+ return `${SETTINGS_BROKERS_ADOPTS_PREFIX}${addonId}`;
8290
+ }
7698
8291
  /** Shared Zod schemas used across streaming capabilities. */
7699
8292
  var CamProfileSchema = _enum([
7700
8293
  "high",
@@ -8174,7 +8767,7 @@ function userError(code, params, englishFallback) {
8174
8767
  return new CamstackError(code, params, englishFallback);
8175
8768
  }
8176
8769
  //#endregion
8177
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8770
+ //#region ../types/dist/err-msg--2RrYiLO.mjs
8178
8771
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8179
8772
  DeviceType["Camera"] = "camera";
8180
8773
  DeviceType["Hub"] = "hub";
@@ -8443,6 +9036,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8443
9036
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8444
9037
  * real Switch device for UI rendering / export adapters. */
8445
9038
  DeviceRole["BinaryHelper"] = "binary-helper";
9039
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
9040
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
9041
+ DeviceRole["Outlet"] = "outlet";
8446
9042
  /** Generic motion / occupancy / moving event source. Distinct from
8447
9043
  * the camera accessory PirSensor role: that one is a camera child;
8448
9044
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8510,7 +9106,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8510
9106
  return DeviceRole;
8511
9107
  }({});
8512
9108
  //#endregion
8513
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
9109
+ //#region ../types/dist/composition-DOwQB_Ua.mjs
8514
9110
  /**
8515
9111
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8516
9112
  *
@@ -11831,11 +12427,10 @@ var ClipModelMetaSchema = object({
11831
12427
  /**
11832
12428
  * The `vector-store` index this model's vectors live in. ONE feature space
11833
12429
  * per index: two models share an index only when their vectors are ranked
11834
- * against each other, which for CLIP means never across families. MobileCLIP
11835
- * S1 and S2 share `object-clip` for history (separated by the row's
11836
- * `modelId`); any other model gets its own.
12430
+ * against each other, which for CLIP means never across families. Every
12431
+ * model gets its own.
11837
12432
  */
11838
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12433
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11839
12434
  /**
11840
12435
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11841
12436
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -15530,6 +16125,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15530
16125
  keyField: string()
15531
16126
  }).optional()
15532
16127
  })) });
16128
+ /**
16129
+ * The report of a one-shot "move this owner's plaintext secrets into the
16130
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16131
+ *
16132
+ * The owner runs it on its own rows, through its own write path; an operator
16133
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16134
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16135
+ */
16136
+ var RawSecretMigrationInputSchema = object({
16137
+ /** `false` (the default of the script) = report only. */
16138
+ apply: boolean() });
16139
+ var RawSecretMigrationReportSchema = object({
16140
+ apply: boolean(),
16141
+ /** Rows that can carry a secret (a profile, an enrolment). */
16142
+ rows: number().int(),
16143
+ /** Rows whose secret was plaintext when the run started. */
16144
+ raw: number().int(),
16145
+ /** Rows that already held a keychain marker when the run started. */
16146
+ markers: number().int(),
16147
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16148
+ migrated: number().int(),
16149
+ /** Plaintext rows left in place because the move or its read-back failed. */
16150
+ failed: number().int(),
16151
+ /** After the run: rows still holding plaintext. */
16152
+ remainingRaw: number().int(),
16153
+ /** After the run: markers the keychain could not resolve right now. */
16154
+ unresolvedMarkers: number().int(),
16155
+ /**
16156
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16157
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16158
+ */
16159
+ redundantCopies: number().int().optional(),
16160
+ /** True when nothing is raw and every marker resolves. */
16161
+ verified: boolean()
16162
+ });
15533
16163
  /** Where a block runs. The operator chooses — a block driving a device on an
15534
16164
  * agent is the reason placement is not fixed to the hub. */
15535
16165
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15756,6 +16386,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15756
16386
  }), SettingsUpdateResultSchema, {
15757
16387
  kind: "mutation",
15758
16388
  auth: "admin"
16389
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16390
+ kind: "mutation",
16391
+ auth: "admin"
15759
16392
  }), method(object({}), object({ libs: array(object({
15760
16393
  filePath: string(),
15761
16394
  content: string()
@@ -16019,6 +16652,347 @@ id: union([string(), number()]) }), {
16019
16652
  auth: "admin"
16020
16653
  });
16021
16654
  /**
16655
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16656
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16657
+ * (operator intent, D870) and device-history (numbers over time, D850).
16658
+ *
16659
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16660
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16661
+ * that with the addon id closed over). It is deliberately NOT in any input
16662
+ * schema, so a session can never supply it, and a call with no stamp is refused
16663
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16664
+ * addons go through the owner's capability.
16665
+ *
16666
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16667
+ * never `[]`. Secret fields are never on the wire: a read shows the
16668
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16669
+ * resolves itself, and a write may carry only a keychain marker bound to the
16670
+ * row's own ref.
16671
+ *
16672
+ * Internal: addons reach it through `ctx.records`, never directly.
16673
+ */
16674
+ var RecordIdSchema = string().min(1).max(256);
16675
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16676
+ var RecordBodySchema = record(string(), unknown());
16677
+ var RecordInputSchema = object({
16678
+ id: RecordIdSchema,
16679
+ /** The device this row belongs to (D865 removal, per-device reads). */
16680
+ deviceId: number().int().optional(),
16681
+ /** The domain clock, ms: observed / created / opened. */
16682
+ at: number().int().optional(),
16683
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16684
+ expiresAt: number().int().optional(),
16685
+ data: RecordBodySchema
16686
+ });
16687
+ var RecordViewSchema = object({
16688
+ id: string(),
16689
+ deviceId: number().int().nullable(),
16690
+ at: number().nullable(),
16691
+ expiresAt: number().nullable(),
16692
+ rev: number().int(),
16693
+ updatedAt: number(),
16694
+ data: RecordBodySchema
16695
+ });
16696
+ /** Declared index fields only. Anything else does not compile, by design. */
16697
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16698
+ string(),
16699
+ number(),
16700
+ boolean(),
16701
+ object({ in: array(union([
16702
+ string(),
16703
+ number(),
16704
+ boolean()
16705
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16706
+ object({
16707
+ gt: union([string(), number()]).optional(),
16708
+ gte: union([string(), number()]).optional(),
16709
+ lt: union([string(), number()]).optional(),
16710
+ lte: union([string(), number()]).optional()
16711
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16712
+ ]));
16713
+ var KindShape = { kind: RecordKindNameSchema };
16714
+ var TimeWindowShape = {
16715
+ deviceId: number().int().optional(),
16716
+ atFrom: number().optional(),
16717
+ atTo: number().optional()
16718
+ };
16719
+ var RecordQueryInputSchema = object({
16720
+ ...KindShape,
16721
+ ...TimeWindowShape,
16722
+ where: RecordWhereSchema.optional(),
16723
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16724
+ order: _enum(["at", "id"]).optional(),
16725
+ desc: boolean().optional(),
16726
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16727
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16728
+ cursor: string().min(1).optional()
16729
+ });
16730
+ var RecordQueryResultSchema = object({
16731
+ records: array(RecordViewSchema),
16732
+ nextCursor: string().nullable()
16733
+ });
16734
+ var RecordKindStateSchema = _enum([
16735
+ "created",
16736
+ "unchanged",
16737
+ "updated"
16738
+ ]);
16739
+ var DeclareKindResultSchema = object({
16740
+ kindId: number().int(),
16741
+ state: RecordKindStateSchema,
16742
+ createdIndexes: array(string()),
16743
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16744
+ adoptionPending: object({
16745
+ legacyTable: string(),
16746
+ legacyRows: number().int()
16747
+ }).nullable()
16748
+ });
16749
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16750
+ var SecretRefsList = array(string());
16751
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16752
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16753
+ kind: "mutation",
16754
+ auth: "admin"
16755
+ }), method(object({
16756
+ ...KindShape,
16757
+ id: RecordIdSchema
16758
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16759
+ ...KindShape,
16760
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16761
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16762
+ ...KindShape,
16763
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16764
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16765
+ ...KindShape,
16766
+ record: RecordInputSchema,
16767
+ /** Compare-and-set. `0` means "the row must not exist". */
16768
+ ifRev: number().int().min(0).optional()
16769
+ }), object({
16770
+ rev: number().int(),
16771
+ releasedRefs: SecretRefsList
16772
+ }), {
16773
+ kind: "mutation",
16774
+ auth: "admin"
16775
+ }), method(object({
16776
+ ...KindShape,
16777
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16778
+ }), object({
16779
+ count: number().int(),
16780
+ releasedRefs: SecretRefsList
16781
+ }), {
16782
+ kind: "mutation",
16783
+ auth: "admin"
16784
+ }), method(object({
16785
+ ...KindShape,
16786
+ id: RecordIdSchema,
16787
+ data: RecordBodySchema,
16788
+ at: number().int().nullable().optional(),
16789
+ expiresAt: number().int().nullable().optional(),
16790
+ ifRev: number().int().min(1).optional()
16791
+ }), object({
16792
+ rev: number().int(),
16793
+ releasedRefs: SecretRefsList
16794
+ }), {
16795
+ kind: "mutation",
16796
+ auth: "admin"
16797
+ }), method(object({
16798
+ ...KindShape,
16799
+ id: RecordIdSchema
16800
+ }), object({
16801
+ deleted: boolean(),
16802
+ secretRefs: SecretRefsList
16803
+ }), {
16804
+ kind: "mutation",
16805
+ auth: "admin"
16806
+ }), method(object({
16807
+ ...KindShape,
16808
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16809
+ }), object({
16810
+ deleted: number().int(),
16811
+ secretRefs: SecretRefsList
16812
+ }), {
16813
+ kind: "mutation",
16814
+ auth: "admin"
16815
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16816
+ ...KindShape,
16817
+ ...TimeWindowShape,
16818
+ where: RecordWhereSchema.optional()
16819
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16820
+ ...KindShape,
16821
+ deviceId: number().int().optional(),
16822
+ from: number(),
16823
+ to: number(),
16824
+ bucketMs: number().int().positive()
16825
+ }), object({ buckets: array(object({
16826
+ bucketStart: number(),
16827
+ count: number().int()
16828
+ })) }), { auth: "admin" }), method(object({
16829
+ ...KindShape,
16830
+ op: _enum([
16831
+ "sum",
16832
+ "min",
16833
+ "max",
16834
+ "count"
16835
+ ]),
16836
+ field: RecordFieldPathSchema.optional(),
16837
+ groupBy: RecordFieldPathSchema.optional(),
16838
+ where: RecordWhereSchema.optional()
16839
+ }), object({ rows: array(object({
16840
+ group: union([
16841
+ string(),
16842
+ number(),
16843
+ _null()
16844
+ ]),
16845
+ value: number().nullable()
16846
+ })) }), { auth: "admin" }), method(object({
16847
+ ...KindShape,
16848
+ deviceId: number().int().optional(),
16849
+ atBefore: number().optional(),
16850
+ where: RecordWhereSchema.optional()
16851
+ }), object({
16852
+ deleted: number().int(),
16853
+ secretRefs: SecretRefsList
16854
+ }), {
16855
+ kind: "mutation",
16856
+ auth: "admin"
16857
+ }), method(object({
16858
+ deviceId: number().int(),
16859
+ kinds: array(RecordKindNameSchema).optional()
16860
+ }), object({
16861
+ deleted: record(string(), number().int()),
16862
+ secretRefs: SecretRefsList
16863
+ }), {
16864
+ kind: "mutation",
16865
+ auth: "admin"
16866
+ }), method(object(KindShape), object({ id: number().int() }), {
16867
+ kind: "mutation",
16868
+ auth: "admin"
16869
+ });
16870
+ /** One table of the settings database. */
16871
+ var StorageTableSchema = object({
16872
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16873
+ name: string(),
16874
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16875
+ owner: string().nullable(),
16876
+ rows: number().int().nonnegative(),
16877
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16878
+ bytes: number().int().nonnegative().nullable(),
16879
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16880
+ declaredThisBoot: boolean()
16881
+ });
16882
+ /** One declared record kind (D881) as System -> Data shows it. */
16883
+ var StorageKindSchema = object({
16884
+ owner: string(),
16885
+ kind: string(),
16886
+ database: _enum(["settings", "events"]),
16887
+ class: string(),
16888
+ state: _enum([
16889
+ "declared",
16890
+ "orphaned",
16891
+ "dropped"
16892
+ ]),
16893
+ /** `null` when the caller asked for no counts (`counts: false`). */
16894
+ rows: number().int().nonnegative().nullable(),
16895
+ /** Rows x the average size of a sample; null for an empty kind. */
16896
+ bytesEstimate: number().int().nonnegative().nullable(),
16897
+ writeTrigger: string(),
16898
+ retention: RecordRetentionSchema,
16899
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
16900
+ entry: boolean(),
16901
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
16902
+ declaration: RecordKindDeclarationSchema
16903
+ });
16904
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
16905
+ collection: string().min(1),
16906
+ expectRows: number().int().nonnegative()
16907
+ }), object({
16908
+ dropped: literal(true),
16909
+ rows: number().int().nonnegative()
16910
+ }), {
16911
+ kind: "mutation",
16912
+ auth: "admin"
16913
+ }), method(object({
16914
+ owner: string().min(1).optional(),
16915
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
16916
+ counts: boolean().optional()
16917
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
16918
+ owner: string().min(1),
16919
+ kind: RecordKindNameSchema
16920
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
16921
+ owner: string().min(1),
16922
+ kind: RecordKindNameSchema,
16923
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
16924
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
16925
+ complete: boolean().optional()
16926
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
16927
+ kind: "mutation",
16928
+ auth: "admin"
16929
+ }), method(object({
16930
+ collection: string().min(1),
16931
+ cursor: string().optional(),
16932
+ limit: number().int().min(1).max(1e3).optional()
16933
+ }), object({
16934
+ rows: array(object({
16935
+ id: string(),
16936
+ data: record(string(), unknown())
16937
+ })),
16938
+ nextCursor: string().nullable()
16939
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
16940
+ /**
16941
+ * record-entries - the ONE admin surface for every list of user-created entries
16942
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
16943
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
16944
+ *
16945
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
16946
+ * the entry body with `secret: true` on every credential field, so a password
16947
+ * field is derived from the schema and never from a name. `putEntry` takes the
16948
+ * redaction token for an untouched secret (the stored value is kept), a string
16949
+ * for a new one, and the clear instruction to remove one. A read never carries
16950
+ * a secret value, and a locked keychain refuses the write with
16951
+ * `records/secret-unavailable` instead of storing plaintext.
16952
+ *
16953
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
16954
+ */
16955
+ var EntryKindInfoSchema = object({
16956
+ owner: string(),
16957
+ kind: RecordKindNameSchema,
16958
+ title: string(),
16959
+ nameField: string(),
16960
+ /** JSON Schema of the body; `secret: true` marks a password field. */
16961
+ fields: record(string(), unknown()),
16962
+ secretPaths: array(string()),
16963
+ rows: number().int().nonnegative()
16964
+ });
16965
+ var EntryViewSchema = object({
16966
+ id: RecordIdSchema,
16967
+ name: string(),
16968
+ rev: number().int(),
16969
+ updatedAt: number(),
16970
+ /** Secret fields hold the redaction token. */
16971
+ data: RecordBodySchema
16972
+ });
16973
+ var EntryAddress = {
16974
+ owner: string().min(1),
16975
+ kind: RecordKindNameSchema
16976
+ };
16977
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
16978
+ ...EntryAddress,
16979
+ id: RecordIdSchema.optional(),
16980
+ data: RecordBodySchema,
16981
+ ifRev: number().int().min(1).optional()
16982
+ }), object({
16983
+ id: string(),
16984
+ rev: number().int()
16985
+ }), {
16986
+ kind: "mutation",
16987
+ auth: "admin"
16988
+ }), method(object({
16989
+ ...EntryAddress,
16990
+ id: RecordIdSchema
16991
+ }), object({ deleted: boolean() }), {
16992
+ kind: "mutation",
16993
+ auth: "admin"
16994
+ });
16995
+ /**
16022
16996
  * `keychain` — the hub's encrypted store of secret values (D787).
16023
16997
  *
16024
16998
  * Settings blobs never hold a secret: they hold a marker
@@ -16559,6 +17533,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16559
17533
  kind: "mutation",
16560
17534
  auth: "admin",
16561
17535
  caller: "required"
17536
+ }), method(object({
17537
+ ref: string().min(1),
17538
+ value: string().min(1)
17539
+ }), object({
17540
+ ref: string(),
17541
+ version: number().int()
17542
+ }), {
17543
+ kind: "mutation",
17544
+ auth: "admin",
17545
+ caller: "required"
16562
17546
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16563
17547
  deleted: array(string()).readonly(),
16564
17548
  kept: array(object({
@@ -39028,6 +40012,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39028
40012
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39029
40013
  kind: "mutation",
39030
40014
  auth: "admin"
40015
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40016
+ kind: "mutation",
40017
+ auth: "admin"
39031
40018
  }), method(ProfileRefInputSchema, _void(), {
39032
40019
  kind: "mutation",
39033
40020
  auth: "admin"
@@ -49451,6 +50438,41 @@ var ServerRollbackInfoSchema = object({
49451
50438
  atMs: number(),
49452
50439
  reason: string()
49453
50440
  });
50441
+ /**
50442
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50443
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50444
+ * service holds, because only the hub plans) against the states the process
50445
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50446
+ * every boot, served on `getServerPackageStatus`.
50447
+ *
50448
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50449
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50450
+ * planned runner the process service has no entry for.
50451
+ */
50452
+ var RunnerRefusalSchema = object({
50453
+ runnerId: string(),
50454
+ addonIds: array(string()),
50455
+ reason: string()
50456
+ });
50457
+ var RunnerBootCheckSchema = object({
50458
+ checkedAtMs: number(),
50459
+ /** Runners planned for this node. */
50460
+ expected: number(),
50461
+ /** Planned runners whose process is `running`. */
50462
+ running: number(),
50463
+ failed: array(string()),
50464
+ refused: array(RunnerRefusalSchema),
50465
+ missing: array(string()),
50466
+ /**
50467
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50468
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50469
+ * pushed and the verdict is re-evaluated on the next runner state change.
50470
+ * Optional for version skew (absent = settled).
50471
+ */
50472
+ pending: array(string()).optional(),
50473
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50474
+ planKnown: boolean()
50475
+ });
49454
50476
  var ServerPackageStatusSchema = object({
49455
50477
  /** Root package name (`@camstack/server` on the hub). */
49456
50478
  packageName: string(),
@@ -49513,7 +50535,14 @@ var ServerPackageStatusSchema = object({
49513
50535
  * for version skew: an older provider's payload simply omits it, and an
49514
50536
  * absent wrapper is unknown — never `native`.
49515
50537
  */
49516
- wrapper: WrapperIdentitySchema.optional()
50538
+ wrapper: WrapperIdentitySchema.optional(),
50539
+ /**
50540
+ * What this node PLANNED to run against what its process service reports
50541
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50542
+ * on a provider that predates it. Absent is "not checked yet", never "all
50543
+ * well": a consumer that needs the answer treats it as pending.
50544
+ */
50545
+ runners: RunnerBootCheckSchema.optional()
49517
50546
  });
49518
50547
  var ServerUpdateCheckResultSchema = object({
49519
50548
  packageName: string(),
@@ -49564,6 +50593,13 @@ var ServerUpdateOutcomeSchema = _enum([
49564
50593
  "refused",
49565
50594
  "failed"
49566
50595
  ]);
50596
+ /** One addon the pre-flight found the target version would refuse (D877). */
50597
+ var UpdateBlockerSchema = object({
50598
+ addonId: string(),
50599
+ reason: string(),
50600
+ /** What the operator does about it. */
50601
+ remedy: string()
50602
+ });
49567
50603
  var ServerUpdateActionResultSchema = object({
49568
50604
  accepted: boolean(),
49569
50605
  targetVersion: string().nullable(),
@@ -49581,14 +50617,27 @@ var ServerUpdateActionResultSchema = object({
49581
50617
  * The failure itself, verbatim enough to act on (the npm output for a
49582
50618
  * staging install). Non-null only for `failed`.
49583
50619
  */
49584
- error: string().nullable().optional()
50620
+ error: string().nullable().optional(),
50621
+ /**
50622
+ * The addons the target version would refuse to start on this node's live
50623
+ * store (D877), present when the pre-flight refused the update
50624
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50625
+ */
50626
+ blockers: array(UpdateBlockerSchema).optional()
49585
50627
  });
49586
50628
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49587
50629
  kind: "mutation",
49588
50630
  auth: "admin"
49589
- }), method(object({
49590
- /** Explicit target version; omitted = latest from the registry. */
49591
- version: string().optional() }), ServerUpdateActionResultSchema, {
50631
+ }), method(object({
50632
+ /** Explicit target version; omitted = latest from the registry. */
50633
+ version: string().optional(),
50634
+ /**
50635
+ * Apply even though the pre-flight (D877) found addons the target would
50636
+ * refuse to start. Off by default: those addons stay down until the
50637
+ * remedy is run, which is the incident this gate exists to prevent.
50638
+ */
50639
+ acknowledgeRefusals: boolean().optional()
50640
+ }), ServerUpdateActionResultSchema, {
49592
50641
  kind: "mutation",
49593
50642
  auth: "admin",
49594
50643
  timeoutMs: 16 * 6e4
@@ -52014,7 +53063,9 @@ var ManifestShapeSchema = object({
52014
53063
  var AddonProcessSchema = object({
52015
53064
  pid: number().optional(),
52016
53065
  mode: string(),
52017
- state: string()
53066
+ state: string(),
53067
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53068
+ reason: string().optional()
52018
53069
  });
52019
53070
  /**
52020
53071
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53027,6 +54078,12 @@ object({
53027
54078
  /** Horizontal louver swing on/off. Null when the device has no
53028
54079
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53029
54080
  swingHorizontal: boolean().nullable(),
54081
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54082
+ minTemp: number().nullable().optional(),
54083
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54084
+ maxTemp: number().nullable().optional(),
54085
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54086
+ tempStep: number().positive().nullable().optional(),
53030
54087
  /** Ms epoch when the slice was last updated (push or command). */
53031
54088
  lastFetchedAt: number()
53032
54089
  });
@@ -54847,7 +55904,19 @@ var TlsStatusSchema = object({
54847
55904
  sans: array(string()),
54848
55905
  caCertPem: string().nullable(),
54849
55906
  reissueError: string().nullable(),
54850
- restartRequired: boolean()
55907
+ restartRequired: boolean(),
55908
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
55909
+ caMissing: boolean(),
55910
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
55911
+ localCaConstrained: boolean().nullable(),
55912
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
55913
+ caReplacedAt: string().nullable(),
55914
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
55915
+ storedUpload: object({
55916
+ leafFingerprintSha256: string(),
55917
+ validTo: string(),
55918
+ hasCa: boolean()
55919
+ }).nullable()
54851
55920
  });
54852
55921
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
54853
55922
  /**
@@ -54903,6 +55972,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
54903
55972
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
54904
55973
  kind: "mutation",
54905
55974
  auth: "admin"
55975
+ }), method(_void(), TlsStatusSchema, {
55976
+ kind: "mutation",
55977
+ auth: "admin"
54906
55978
  });
54907
55979
  object({
54908
55980
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -60032,7 +61104,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
60032
61104
  kind: "mutation",
60033
61105
  auth: "admin",
60034
61106
  access: "delete"
60035
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
61107
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
61108
+ kind: "mutation",
61109
+ auth: "admin",
61110
+ access: "create"
61111
+ }), method(object({
60036
61112
  userId: string(),
60037
61113
  code: string()
60038
61114
  }), object({ valid: boolean() }), {
@@ -62233,6 +63309,12 @@ Object.freeze({
62233
63309
  addonId: null,
62234
63310
  access: "view"
62235
63311
  },
63312
+ "coreBlocks.migrateRawSecrets": {
63313
+ capName: "core-blocks",
63314
+ capScope: "system",
63315
+ addonId: null,
63316
+ access: "create"
63317
+ },
62236
63318
  "coreBlocks.restart": {
62237
63319
  capName: "core-blocks",
62238
63320
  capScope: "system",
@@ -63919,6 +65001,12 @@ Object.freeze({
63919
65001
  addonId: null,
63920
65002
  access: "create"
63921
65003
  },
65004
+ "keychainAdmin.importSecret": {
65005
+ capName: "keychain-admin",
65006
+ capScope: "system",
65007
+ addonId: null,
65008
+ access: "create"
65009
+ },
63922
65010
  "keychainAdmin.listAudit": {
63923
65011
  capName: "keychain-admin",
63924
65012
  capScope: "system",
@@ -64087,6 +65175,12 @@ Object.freeze({
64087
65175
  addonId: null,
64088
65176
  access: "view"
64089
65177
  },
65178
+ "llm.migrateRawSecrets": {
65179
+ capName: "llm",
65180
+ capScope: "system",
65181
+ addonId: null,
65182
+ access: "create"
65183
+ },
64090
65184
  "llm.resolveModelRef": {
64091
65185
  capName: "llm",
64092
65186
  capScope: "system",
@@ -64315,6 +65409,12 @@ Object.freeze({
64315
65409
  addonId: null,
64316
65410
  access: "create"
64317
65411
  },
65412
+ "localNetwork.useStoredUploadedCertificate": {
65413
+ capName: "local-network",
65414
+ capScope: "system",
65415
+ addonId: null,
65416
+ access: "create"
65417
+ },
64318
65418
  "lockControl.getStatus": {
64319
65419
  capName: "lock-control",
64320
65420
  capScope: "device",
@@ -66967,6 +68067,30 @@ Object.freeze({
66967
68067
  addonId: null,
66968
68068
  access: "create"
66969
68069
  },
68070
+ "recordEntries.deleteEntry": {
68071
+ capName: "record-entries",
68072
+ capScope: "system",
68073
+ addonId: null,
68074
+ access: "delete"
68075
+ },
68076
+ "recordEntries.listEntries": {
68077
+ capName: "record-entries",
68078
+ capScope: "system",
68079
+ addonId: null,
68080
+ access: "view"
68081
+ },
68082
+ "recordEntries.listEntryKinds": {
68083
+ capName: "record-entries",
68084
+ capScope: "system",
68085
+ addonId: null,
68086
+ access: "view"
68087
+ },
68088
+ "recordEntries.putEntry": {
68089
+ capName: "record-entries",
68090
+ capScope: "system",
68091
+ addonId: null,
68092
+ access: "create"
68093
+ },
66970
68094
  "recording.getAvailability": {
66971
68095
  capName: "recording",
66972
68096
  capScope: "device",
@@ -67267,6 +68391,102 @@ Object.freeze({
67267
68391
  addonId: null,
67268
68392
  access: "view"
67269
68393
  },
68394
+ "records.aggregate": {
68395
+ capName: "records",
68396
+ capScope: "system",
68397
+ addonId: null,
68398
+ access: "view"
68399
+ },
68400
+ "records.allocateId": {
68401
+ capName: "records",
68402
+ capScope: "system",
68403
+ addonId: null,
68404
+ access: "create"
68405
+ },
68406
+ "records.count": {
68407
+ capName: "records",
68408
+ capScope: "system",
68409
+ addonId: null,
68410
+ access: "view"
68411
+ },
68412
+ "records.declareKinds": {
68413
+ capName: "records",
68414
+ capScope: "system",
68415
+ addonId: null,
68416
+ access: "create"
68417
+ },
68418
+ "records.delete": {
68419
+ capName: "records",
68420
+ capScope: "system",
68421
+ addonId: null,
68422
+ access: "delete"
68423
+ },
68424
+ "records.deleteDevice": {
68425
+ capName: "records",
68426
+ capScope: "system",
68427
+ addonId: null,
68428
+ access: "delete"
68429
+ },
68430
+ "records.deleteMany": {
68431
+ capName: "records",
68432
+ capScope: "system",
68433
+ addonId: null,
68434
+ access: "delete"
68435
+ },
68436
+ "records.deleteWhere": {
68437
+ capName: "records",
68438
+ capScope: "system",
68439
+ addonId: null,
68440
+ access: "delete"
68441
+ },
68442
+ "records.get": {
68443
+ capName: "records",
68444
+ capScope: "system",
68445
+ addonId: null,
68446
+ access: "view"
68447
+ },
68448
+ "records.getMany": {
68449
+ capName: "records",
68450
+ capScope: "system",
68451
+ addonId: null,
68452
+ access: "view"
68453
+ },
68454
+ "records.histogram": {
68455
+ capName: "records",
68456
+ capScope: "system",
68457
+ addonId: null,
68458
+ access: "view"
68459
+ },
68460
+ "records.patch": {
68461
+ capName: "records",
68462
+ capScope: "system",
68463
+ addonId: null,
68464
+ access: "create"
68465
+ },
68466
+ "records.put": {
68467
+ capName: "records",
68468
+ capScope: "system",
68469
+ addonId: null,
68470
+ access: "create"
68471
+ },
68472
+ "records.putMany": {
68473
+ capName: "records",
68474
+ capScope: "system",
68475
+ addonId: null,
68476
+ access: "create"
68477
+ },
68478
+ "records.query": {
68479
+ capName: "records",
68480
+ capScope: "system",
68481
+ addonId: null,
68482
+ access: "view"
68483
+ },
68484
+ "records.secretRefs": {
68485
+ capName: "records",
68486
+ capScope: "system",
68487
+ addonId: null,
68488
+ access: "view"
68489
+ },
67270
68490
  "sceneMonitor.captureReference": {
67271
68491
  capName: "scene-monitor",
67272
68492
  capScope: "device",
@@ -67699,6 +68919,48 @@ Object.freeze({
67699
68919
  addonId: null,
67700
68920
  access: "create"
67701
68921
  },
68922
+ "storageAdmin.adoptRecords": {
68923
+ capName: "storage-admin",
68924
+ capScope: "system",
68925
+ addonId: null,
68926
+ access: "create"
68927
+ },
68928
+ "storageAdmin.dropCollection": {
68929
+ capName: "storage-admin",
68930
+ capScope: "system",
68931
+ addonId: null,
68932
+ access: "delete"
68933
+ },
68934
+ "storageAdmin.isAdoptedLegacyTable": {
68935
+ capName: "storage-admin",
68936
+ capScope: "system",
68937
+ addonId: null,
68938
+ access: "view"
68939
+ },
68940
+ "storageAdmin.listKinds": {
68941
+ capName: "storage-admin",
68942
+ capScope: "system",
68943
+ addonId: null,
68944
+ access: "view"
68945
+ },
68946
+ "storageAdmin.listTables": {
68947
+ capName: "storage-admin",
68948
+ capScope: "system",
68949
+ addonId: null,
68950
+ access: "view"
68951
+ },
68952
+ "storageAdmin.readLegacyCollection": {
68953
+ capName: "storage-admin",
68954
+ capScope: "system",
68955
+ addonId: null,
68956
+ access: "view"
68957
+ },
68958
+ "storageAdmin.readRecords": {
68959
+ capName: "storage-admin",
68960
+ capScope: "system",
68961
+ addonId: null,
68962
+ access: "view"
68963
+ },
67702
68964
  "storageEvictable.evict": {
67703
68965
  capName: "storage-evictable",
67704
68966
  capScope: "system",
@@ -68611,6 +69873,12 @@ Object.freeze({
68611
69873
  addonId: null,
68612
69874
  access: "view"
68613
69875
  },
69876
+ "userManagement.migrateRawSecrets": {
69877
+ capName: "user-management",
69878
+ capScope: "system",
69879
+ addonId: null,
69880
+ access: "create"
69881
+ },
68614
69882
  "userManagement.oauthExchangeCode": {
68615
69883
  capName: "user-management",
68616
69884
  capScope: "system",
@@ -71287,6 +72555,37 @@ Object.freeze({
71287
72555
  form: "single",
71288
72556
  optional: false
71289
72557
  }],
72558
+ "records.count": [{
72559
+ name: "deviceId",
72560
+ form: "single",
72561
+ optional: true
72562
+ }],
72563
+ "records.deleteDevice": [{
72564
+ name: "deviceId",
72565
+ form: "single",
72566
+ optional: false
72567
+ }],
72568
+ "records.deleteWhere": [{
72569
+ name: "deviceId",
72570
+ form: "single",
72571
+ optional: true
72572
+ }],
72573
+ "records.histogram": [{
72574
+ name: "deviceId",
72575
+ form: "single",
72576
+ optional: true
72577
+ }],
72578
+ "records.putMany": [{
72579
+ name: "records",
72580
+ form: "object-array",
72581
+ optional: false,
72582
+ itemField: "deviceId"
72583
+ }],
72584
+ "records.query": [{
72585
+ name: "deviceId",
72586
+ form: "single",
72587
+ optional: true
72588
+ }],
71290
72589
  "sceneMonitor.captureReference": [{
71291
72590
  name: "deviceId",
71292
72591
  form: "single",
@@ -71403,6 +72702,17 @@ Object.freeze({
71403
72702
  form: "single",
71404
72703
  optional: false
71405
72704
  }],
72705
+ "storageAdmin.adoptRecords": [{
72706
+ name: "records",
72707
+ form: "object-array",
72708
+ optional: false,
72709
+ itemField: "deviceId"
72710
+ }],
72711
+ "storageAdmin.readRecords": [{
72712
+ name: "deviceId",
72713
+ form: "single",
72714
+ optional: true
72715
+ }],
71406
72716
  "streamBroker.acquireEgressTranscode": [{
71407
72717
  name: "deviceId",
71408
72718
  form: "single",
@@ -73786,6 +75096,74 @@ async function probeGoogleOauthClient(cfg, http = { fetch }) {
73786
75096
  function pickOauthRedirectOrigin(book) {
73787
75097
  return book.roles.publicEndpoint.resolved ?? book.roles.internal.resolved ?? null;
73788
75098
  }
75099
+ var googleBrokersEntryKind = defineEntryKind("brokers", {
75100
+ title: "Google Services brokers",
75101
+ schema: entryBody({
75102
+ clientId: GoogleBrokerEntrySchema.shape.clientId,
75103
+ clientSecret: GoogleBrokerEntrySchema.shape.clientSecret,
75104
+ calendarFilter: GoogleBrokerEntrySchema.shape.calendarFilter,
75105
+ fromAddress: GoogleBrokerEntrySchema.shape.fromAddress,
75106
+ fromName: GoogleBrokerEntrySchema.shape.fromName
75107
+ }),
75108
+ writeTrigger: "an operator adds or edits a Google OAuth broker",
75109
+ adoptsFrom: settingsBrokersAdoptsFrom("google-services")
75110
+ });
75111
+ //#endregion
75112
+ //#region src/google-broker-store.ts
75113
+ function rowToEntry(id, data) {
75114
+ const parsed = GoogleBrokerEntrySchema.safeParse({
75115
+ id,
75116
+ ...data
75117
+ });
75118
+ return parsed.success ? parsed.data : null;
75119
+ }
75120
+ var GoogleBrokerStore = class GoogleBrokerStore {
75121
+ kind;
75122
+ constructor(kind) {
75123
+ this.kind = kind;
75124
+ }
75125
+ static of(records) {
75126
+ return new GoogleBrokerStore(records.kind(googleBrokersEntryKind));
75127
+ }
75128
+ async listResolved() {
75129
+ const page = await this.kind.query({ limit: 1e3 });
75130
+ const out = [];
75131
+ for (const record of page.records) {
75132
+ let data = record.data;
75133
+ try {
75134
+ const resolved = await this.kind.getResolved(record.id);
75135
+ if (resolved !== null) data = resolved.data;
75136
+ } catch (err) {
75137
+ if (!(err instanceof RecordSecretUnavailableError)) throw err;
75138
+ }
75139
+ const entry = rowToEntry(record.id, data);
75140
+ if (entry !== null) out.push(entry);
75141
+ }
75142
+ return out;
75143
+ }
75144
+ async replaceAll(entries) {
75145
+ const page = await this.kind.query({ limit: 1e3 });
75146
+ const nextIds = new Set(entries.map((e) => e.id));
75147
+ for (const row of page.records) if (!nextIds.has(row.id)) await this.kind.delete(row.id);
75148
+ for (const entry of entries) {
75149
+ const { id, name, clientId, clientSecret, calendarFilter, fromAddress, fromName } = entry;
75150
+ const body = {
75151
+ name,
75152
+ clientId,
75153
+ clientSecret,
75154
+ calendarFilter,
75155
+ fromAddress,
75156
+ fromName
75157
+ };
75158
+ const parsed = googleBrokersEntryKind.schema.safeParse(body);
75159
+ if (!parsed.success) throw new Error(`invalid Google broker '${id}': ${parsed.error.message}`);
75160
+ await this.kind.put({
75161
+ id,
75162
+ data: parsed.data
75163
+ });
75164
+ }
75165
+ }
75166
+ };
73789
75167
  //#endregion
73790
75168
  //#region src/google-services.addon.ts
73791
75169
  /**
@@ -73811,6 +75189,8 @@ var GoogleServicesAddon = class extends BaseAddon {
73811
75189
  ];
73812
75190
  oauthAccountsHandle = null;
73813
75191
  registry = new GoogleBrokerRegistry();
75192
+ brokerStore = null;
75193
+ activeBrokers = [];
73814
75194
  /** CSRF state → { brokerId, popup, issuedAt } — popup mirrors OIDC D794. */
73815
75195
  pendingStates = /* @__PURE__ */ new Map();
73816
75196
  publicOrigin = null;
@@ -73852,7 +75232,16 @@ var GoogleServicesAddon = class extends BaseAddon {
73852
75232
  await this.oauthAccountsHandle.set(oauthAccounts);
73853
75233
  await legacyHandle.set({ ...DEFAULT_OAUTH_STATE });
73854
75234
  }
73855
- this.registry.seedFrom(this.config.brokers, oauthAccounts.accounts);
75235
+ const records = this.ctx.records;
75236
+ if (records === void 0) throw new Error("google-services: ctx.records is required (hub-only addon)");
75237
+ await records.declare({ brokers: googleBrokersEntryKind });
75238
+ this.brokerStore = GoogleBrokerStore.of(records);
75239
+ this.activeBrokers = await this.loadPersistedBrokers();
75240
+ if ((await this.brokerStore.listResolved()).length === 0 && this.config.brokers.length > 0) {
75241
+ await this.brokerStore.replaceAll(this.config.brokers);
75242
+ this.activeBrokers = await this.loadPersistedBrokers();
75243
+ }
75244
+ this.registry.seedFrom(this.activeBrokers, oauthAccounts.accounts);
73856
75245
  await this.refreshPublicOrigin();
73857
75246
  const calendarProvider = createGoogleCalendarSource({
73858
75247
  logger: this.ctx.logger,
@@ -73924,7 +75313,8 @@ var GoogleServicesAddon = class extends BaseAddon {
73924
75313
  }
73925
75314
  async onConfigChanged() {
73926
75315
  const accounts = this.registry.listOauthAccounts();
73927
- this.registry.seedFrom(this.config.brokers, accounts);
75316
+ this.activeBrokers = await this.loadPersistedBrokers();
75317
+ this.registry.seedFrom(this.activeBrokers, accounts);
73928
75318
  }
73929
75319
  buildBrokerProvider() {
73930
75320
  const ownerAddonId = this.ctx.id;
@@ -74277,8 +75667,23 @@ var GoogleServicesAddon = class extends BaseAddon {
74277
75667
  const cutoff = Date.now() - 10 * 6e4;
74278
75668
  for (const [k, v] of this.pendingStates) if (v.issuedAt < cutoff) this.pendingStates.delete(k);
74279
75669
  }
75670
+ async loadPersistedBrokers() {
75671
+ const store = this.brokerStore;
75672
+ if (store !== null) {
75673
+ const fromRecords = await store.listResolved();
75674
+ if (fromRecords.length > 0) return fromRecords;
75675
+ }
75676
+ return this.config.brokers;
75677
+ }
74280
75678
  async persistBrokers() {
74281
- await this.updateGlobalSettings({ brokers: [...this.registry.listEntries()] });
75679
+ const entries = [...this.registry.listEntries()];
75680
+ this.activeBrokers = entries;
75681
+ const store = this.brokerStore;
75682
+ if (store !== null) {
75683
+ await store.replaceAll(entries);
75684
+ return;
75685
+ }
75686
+ await this.updateGlobalSettings({ brokers: entries });
74282
75687
  }
74283
75688
  async persistOauthAccounts() {
74284
75689
  if (!this.oauthAccountsHandle) return;