@camstack/addon-auth 1.2.148 → 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.
@@ -1,4 +1,4 @@
1
- //#region ../types/dist/event-category-C4hVnRo8.mjs
1
+ //#region ../types/dist/event-category-BvOFi6PY.mjs
2
2
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
3
3
  EventCategory["SystemBoot"] = "system.boot";
4
4
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -62,6 +62,24 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
62
62
  * consumes this category and maps it to the `addon-crash-loop` kind.
63
63
  */
64
64
  EventCategory["AddonRunnerFailed"] = "addon.runner-failed";
65
+ /**
66
+ * A runner whose addon refused to start with a typed reason (D877) - parked
67
+ * in `refused`, never counted by the crash breaker, retried on operator
68
+ * action. One event per refusal.
69
+ */
70
+ EventCategory["AddonRunnerRefused"] = "addon.runner-refused";
71
+ /**
72
+ * A runner settled on a state (D877): `running` (READY), `crashed`, `failed` or
73
+ * `refused`. In-process telemetry for the boot check (re-evaluate while any
74
+ * runner is still pending) and the alert centre (close a recovered runner).
75
+ */
76
+ EventCategory["ProcessStateChanged"] = "process.state-changed";
77
+ /**
78
+ * The node's one-shot runner boot check (D877): planned runners against the
79
+ * process service, `degraded` when any is failed, refused or missing. The
80
+ * alert centre turns it into one alert and a direct critical push.
81
+ */
82
+ EventCategory["SystemRunnerCheck"] = "system.runner-check";
65
83
  EventCategory["AddonError"] = "addon.error";
66
84
  EventCategory["AddonPageReady"] = "addon.page-ready";
67
85
  EventCategory["AddonWidgetReady"] = "addon.widget-ready";
@@ -4104,6 +4122,12 @@ var numberProcessor = (schema, ctx, _json, _params) => {
4104
4122
  var booleanProcessor = (_schema, _ctx, json, _params) => {
4105
4123
  json.type = "boolean";
4106
4124
  };
4125
+ var bigintProcessor = (_schema, ctx, _json, _params) => {
4126
+ if (ctx.unrepresentable === "throw") throw new Error("BigInt cannot be represented in JSON Schema");
4127
+ };
4128
+ var symbolProcessor = (_schema, ctx, _json, _params) => {
4129
+ if (ctx.unrepresentable === "throw") throw new Error("Symbols cannot be represented in JSON Schema");
4130
+ };
4107
4131
  var nullProcessor = (_schema, ctx, json, _params) => {
4108
4132
  if (ctx.target === "openapi-3.0") {
4109
4133
  json.type = "string";
@@ -4111,12 +4135,17 @@ var nullProcessor = (_schema, ctx, json, _params) => {
4111
4135
  json.enum = [null];
4112
4136
  } else json.type = "null";
4113
4137
  };
4138
+ var undefinedProcessor = (_schema, ctx, _json, _params) => {
4139
+ if (ctx.unrepresentable === "throw") throw new Error("Undefined cannot be represented in JSON Schema");
4140
+ };
4114
4141
  var voidProcessor = (_schema, ctx, _json, _params) => {
4115
4142
  if (ctx.unrepresentable === "throw") throw new Error("Void cannot be represented in JSON Schema");
4116
4143
  };
4117
4144
  var neverProcessor = (_schema, _ctx, json, _params) => {
4118
4145
  json.not = {};
4119
4146
  };
4147
+ var anyProcessor = (_schema, _ctx, _json, _params) => {};
4148
+ var unknownProcessor = (_schema, _ctx, _json, _params) => {};
4120
4149
  var dateProcessor = (_schema, ctx, _json, _params) => {
4121
4150
  if (ctx.unrepresentable === "throw") throw new Error("Date cannot be represented in JSON Schema");
4122
4151
  };
@@ -4148,12 +4177,53 @@ var literalProcessor = (schema, ctx, json, _params) => {
4148
4177
  json.enum = vals;
4149
4178
  }
4150
4179
  };
4180
+ var nanProcessor = (_schema, ctx, _json, _params) => {
4181
+ if (ctx.unrepresentable === "throw") throw new Error("NaN cannot be represented in JSON Schema");
4182
+ };
4183
+ var templateLiteralProcessor = (schema, _ctx, json, _params) => {
4184
+ const _json = json;
4185
+ const pattern = schema._zod.pattern;
4186
+ if (!pattern) throw new Error("Pattern not found in template literal");
4187
+ _json.type = "string";
4188
+ _json.pattern = pattern.source;
4189
+ };
4190
+ var fileProcessor = (schema, _ctx, json, _params) => {
4191
+ const _json = json;
4192
+ const file = {
4193
+ type: "string",
4194
+ format: "binary",
4195
+ contentEncoding: "binary"
4196
+ };
4197
+ const { minimum, maximum, mime } = schema._zod.bag;
4198
+ if (minimum !== void 0) file.minLength = minimum;
4199
+ if (maximum !== void 0) file.maxLength = maximum;
4200
+ if (mime) if (mime.length === 1) {
4201
+ file.contentMediaType = mime[0];
4202
+ Object.assign(_json, file);
4203
+ } else {
4204
+ Object.assign(_json, file);
4205
+ _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
4206
+ }
4207
+ else Object.assign(_json, file);
4208
+ };
4209
+ var successProcessor = (_schema, _ctx, json, _params) => {
4210
+ json.type = "boolean";
4211
+ };
4151
4212
  var customProcessor = (_schema, ctx, _json, _params) => {
4152
4213
  if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4153
4214
  };
4215
+ var functionProcessor = (_schema, ctx, _json, _params) => {
4216
+ if (ctx.unrepresentable === "throw") throw new Error("Function types cannot be represented in JSON Schema");
4217
+ };
4154
4218
  var transformProcessor = (_schema, ctx, _json, _params) => {
4155
4219
  if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4156
4220
  };
4221
+ var mapProcessor = (_schema, ctx, _json, _params) => {
4222
+ if (ctx.unrepresentable === "throw") throw new Error("Map cannot be represented in JSON Schema");
4223
+ };
4224
+ var setProcessor = (_schema, ctx, _json, _params) => {
4225
+ if (ctx.unrepresentable === "throw") throw new Error("Set cannot be represented in JSON Schema");
4226
+ };
4157
4227
  var arrayProcessor = (schema, ctx, _json, params) => {
4158
4228
  const json = _json;
4159
4229
  const def = schema._zod.def;
@@ -4358,6 +4428,12 @@ var readonlyProcessor = (schema, ctx, json, params) => {
4358
4428
  seen.ref = def.innerType;
4359
4429
  json.readOnly = true;
4360
4430
  };
4431
+ var promiseProcessor = (schema, ctx, _json, params) => {
4432
+ const def = schema._zod.def;
4433
+ process(def.innerType, ctx, params);
4434
+ const seen = ctx.seen.get(schema);
4435
+ seen.ref = def.innerType;
4436
+ };
4361
4437
  var optionalProcessor = (schema, ctx, _json, params) => {
4362
4438
  const def = schema._zod.def;
4363
4439
  process(def.innerType, ctx, params);
@@ -4370,6 +4446,81 @@ var lazyProcessor = (schema, ctx, _json, params) => {
4370
4446
  const seen = ctx.seen.get(schema);
4371
4447
  seen.ref = innerType;
4372
4448
  };
4449
+ var allProcessors = {
4450
+ string: stringProcessor,
4451
+ number: numberProcessor,
4452
+ boolean: booleanProcessor,
4453
+ bigint: bigintProcessor,
4454
+ symbol: symbolProcessor,
4455
+ null: nullProcessor,
4456
+ undefined: undefinedProcessor,
4457
+ void: voidProcessor,
4458
+ never: neverProcessor,
4459
+ any: anyProcessor,
4460
+ unknown: unknownProcessor,
4461
+ date: dateProcessor,
4462
+ enum: enumProcessor,
4463
+ literal: literalProcessor,
4464
+ nan: nanProcessor,
4465
+ template_literal: templateLiteralProcessor,
4466
+ file: fileProcessor,
4467
+ success: successProcessor,
4468
+ custom: customProcessor,
4469
+ function: functionProcessor,
4470
+ transform: transformProcessor,
4471
+ map: mapProcessor,
4472
+ set: setProcessor,
4473
+ array: arrayProcessor,
4474
+ object: objectProcessor,
4475
+ union: unionProcessor,
4476
+ intersection: intersectionProcessor,
4477
+ tuple: tupleProcessor,
4478
+ record: recordProcessor,
4479
+ nullable: nullableProcessor,
4480
+ nonoptional: nonoptionalProcessor,
4481
+ default: defaultProcessor,
4482
+ prefault: prefaultProcessor,
4483
+ catch: catchProcessor,
4484
+ pipe: pipeProcessor,
4485
+ readonly: readonlyProcessor,
4486
+ promise: promiseProcessor,
4487
+ optional: optionalProcessor,
4488
+ lazy: lazyProcessor
4489
+ };
4490
+ function toJSONSchema(input, params) {
4491
+ if ("_idmap" in input) {
4492
+ const registry = input;
4493
+ const ctx = initializeContext({
4494
+ ...params,
4495
+ processors: allProcessors
4496
+ });
4497
+ const defs = {};
4498
+ for (const entry of registry._idmap.entries()) {
4499
+ const [_, schema] = entry;
4500
+ process(schema, ctx);
4501
+ }
4502
+ const schemas = {};
4503
+ ctx.external = {
4504
+ registry,
4505
+ uri: params?.uri,
4506
+ defs
4507
+ };
4508
+ for (const entry of registry._idmap.entries()) {
4509
+ const [key, schema] = entry;
4510
+ extractDefs(ctx, schema);
4511
+ schemas[key] = finalize(ctx, schema);
4512
+ }
4513
+ if (Object.keys(defs).length > 0) schemas.__shared = { [ctx.target === "draft-2020-12" ? "$defs" : "definitions"]: defs };
4514
+ return { schemas };
4515
+ }
4516
+ const ctx = initializeContext({
4517
+ ...params,
4518
+ processors: allProcessors
4519
+ });
4520
+ process(input, ctx);
4521
+ extractDefs(ctx, input);
4522
+ return finalize(ctx, input);
4523
+ }
4373
4524
  //#endregion
4374
4525
  //#region ../../node_modules/zod/v4/classic/iso.js
4375
4526
  var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
@@ -5386,7 +5537,7 @@ var ZodIssueCode = {
5386
5537
  var ZodFirstPartyTypeKind;
5387
5538
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5388
5539
  //#endregion
5389
- //#region ../types/dist/sleep-DRqxtc0C.mjs
5540
+ //#region ../types/dist/sleep-bZIhUvjd.mjs
5390
5541
  /**
5391
5542
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5392
5543
  * window to float samples (D455).
@@ -5503,7 +5654,7 @@ function isKeychainStoredField(field) {
5503
5654
  var SECRET_CLEAR = { $secretClear: true };
5504
5655
  /** The `'***'` token D634 redaction writes for non-admins. */
5505
5656
  var LEGACY_DEVICE_REDACTION = "***";
5506
- function isRecord$2(value) {
5657
+ function isRecord$5(value) {
5507
5658
  return typeof value === "object" && value !== null && !Array.isArray(value);
5508
5659
  }
5509
5660
  function makeSecretMarker(ref) {
@@ -5514,12 +5665,12 @@ function makeSecretMarker(ref) {
5514
5665
  }
5515
5666
  /** A stored marker: an object whose `$secret` is a non-empty string. */
5516
5667
  function isSecretMarker(value) {
5517
- if (!isRecord$2(value)) return false;
5668
+ if (!isRecord$5(value)) return false;
5518
5669
  const ref = value["$secret"];
5519
5670
  return typeof ref === "string" && ref.length > 0;
5520
5671
  }
5521
5672
  function isSecretClear(value) {
5522
- return isRecord$2(value) && value["$secretClear"] === true;
5673
+ return isRecord$5(value) && value["$secretClear"] === true;
5523
5674
  }
5524
5675
  /**
5525
5676
  * The UI view of a stored secret field value: a marker becomes "set", inline
@@ -6129,7 +6280,7 @@ var KeychainWriteRefusedError = class extends Error {
6129
6280
  }
6130
6281
  };
6131
6282
  var KEEP = { kind: "keep" };
6132
- function isRecord$1(value) {
6283
+ function isRecord$4(value) {
6133
6284
  return typeof value === "object" && value !== null && !Array.isArray(value);
6134
6285
  }
6135
6286
  function defaultMintId() {
@@ -6142,7 +6293,7 @@ function collectSecretMarkerRefs(value, out = []) {
6142
6293
  return out;
6143
6294
  }
6144
6295
  if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
6145
- else if (isRecord$1(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6296
+ else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
6146
6297
  return out;
6147
6298
  }
6148
6299
  async function storedValueEquals(secrets, marker, candidate) {
@@ -6197,7 +6348,7 @@ function rowId(row, idKey) {
6197
6348
  return null;
6198
6349
  }
6199
6350
  async function writeArray(ctx, node, incoming, stored, fieldPath) {
6200
- const storedRows = Array.isArray(stored) ? stored.filter(isRecord$1) : [];
6351
+ const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
6201
6352
  if (!Array.isArray(incoming)) {
6202
6353
  ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
6203
6354
  return {
@@ -6213,7 +6364,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
6213
6364
  const kept = /* @__PURE__ */ new Set();
6214
6365
  const rows = [];
6215
6366
  for (const row of incoming) {
6216
- if (!isRecord$1(row)) {
6367
+ if (!isRecord$4(row)) {
6217
6368
  rows.push(row);
6218
6369
  continue;
6219
6370
  }
@@ -6238,7 +6389,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6238
6389
  case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
6239
6390
  case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
6240
6391
  case "object": {
6241
- if (!isRecord$1(incoming)) {
6392
+ if (!isRecord$4(incoming)) {
6242
6393
  if (incoming === void 0) return KEEP;
6243
6394
  ctx.deletes.push(...collectSecretMarkerRefs(stored));
6244
6395
  return {
@@ -6246,7 +6397,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
6246
6397
  value: incoming
6247
6398
  };
6248
6399
  }
6249
- const storedObj = isRecord$1(stored) ? stored : {};
6400
+ const storedObj = isRecord$4(stored) ? stored : {};
6250
6401
  return {
6251
6402
  kind: "value",
6252
6403
  value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
@@ -6369,7 +6520,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
6369
6520
  value: items
6370
6521
  };
6371
6522
  }
6372
- if (isRecord$1(v)) {
6523
+ if (isRecord$4(v)) {
6373
6524
  const out = {};
6374
6525
  for (const [k, child] of Object.entries(v)) {
6375
6526
  const s = substitute(child);
@@ -6401,7 +6552,7 @@ var SecretOverwriteRefusedError = class extends Error {
6401
6552
  this.name = "SecretOverwriteRefusedError";
6402
6553
  }
6403
6554
  };
6404
- function isRecord(value) {
6555
+ function isRecord$3(value) {
6405
6556
  return typeof value === "object" && value !== null && !Array.isArray(value);
6406
6557
  }
6407
6558
  function resolvedValue(pass, marker) {
@@ -6430,7 +6581,7 @@ function inArray(pass, incoming, stored) {
6430
6581
  return incoming.map((item, index) => {
6431
6582
  const twin = stored[index];
6432
6583
  if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
6433
- if (isRecord(item) && isRecord(twin)) return inArrayRow(pass, item, twin);
6584
+ if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
6434
6585
  if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
6435
6586
  return item;
6436
6587
  });
@@ -6441,7 +6592,7 @@ function inArrayRow(pass, incoming, stored) {
6441
6592
  const twin = stored[key];
6442
6593
  if (isSecretMarker(twin)) {
6443
6594
  if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
6444
- } else if (isRecord(value) && isRecord(twin)) out[key] = inArrayRow(pass, value, twin);
6595
+ } else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
6445
6596
  else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
6446
6597
  }
6447
6598
  return out;
@@ -6449,7 +6600,7 @@ function inArrayRow(pass, incoming, stored) {
6449
6600
  async function walk(pass, incoming, stored) {
6450
6601
  if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
6451
6602
  if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
6452
- if (!isRecord(incoming) || !isRecord(stored)) return incoming;
6603
+ if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
6453
6604
  const out = { ...incoming };
6454
6605
  for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
6455
6606
  return out;
@@ -6480,7 +6631,7 @@ async function restoreUnchangedSecrets(input) {
6480
6631
  function isJsonEqual(a, b) {
6481
6632
  if (Object.is(a, b)) return true;
6482
6633
  if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
6483
- if (isRecord(a) && isRecord(b)) {
6634
+ if (isRecord$3(a) && isRecord$3(b)) {
6484
6635
  const keys = Object.keys(a);
6485
6636
  if (keys.length !== Object.keys(b).length) return false;
6486
6637
  return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
@@ -6504,7 +6655,7 @@ function markerKeysOf(blob, owner) {
6504
6655
  }
6505
6656
  function nodeFromStored(value, owner) {
6506
6657
  if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
6507
- if (!isRecord(value)) return null;
6658
+ if (!isRecord$3(value)) return null;
6508
6659
  const children = /* @__PURE__ */ new Map();
6509
6660
  for (const [key, child] of Object.entries(value)) {
6510
6661
  const node = nodeFromStored(child, owner);
@@ -6637,7 +6788,6 @@ function createHandle(raw, opts) {
6637
6788
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
6638
6789
  const readAddonStoreResult = raw.readAddonStoreResult;
6639
6790
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
6640
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
6641
6791
  const overrides = {
6642
6792
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
6643
6793
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -6661,12 +6811,12 @@ function createHandle(raw, opts) {
6661
6811
  };
6662
6812
  } } : {},
6663
6813
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
6664
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
6665
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
6814
+ readDeviceStoreBatch: async (deviceIds) => {
6815
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
6666
6816
  const out = /* @__PURE__ */ new Map();
6667
6817
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
6668
6818
  return out;
6669
- } } : {},
6819
+ },
6670
6820
  writeAddonStore: async (patch) => {
6671
6821
  await writeAddon(patch);
6672
6822
  },
@@ -7293,7 +7443,7 @@ var BaseAddon = class {
7293
7443
  if (!ctx) return;
7294
7444
  const addonId = ctx.id;
7295
7445
  setImmediate(() => {
7296
- ctx.api.addons?.restartAddon?.mutate({ addonId }).then(() => {
7446
+ ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
7297
7447
  ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
7298
7448
  }).catch((err) => {
7299
7449
  ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
@@ -7493,7 +7643,7 @@ var BaseAddon = class {
7493
7643
  return this._addonSecretTree;
7494
7644
  }
7495
7645
  deviceSecretTree() {
7496
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
7646
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
7497
7647
  return this._deviceSecretTree;
7498
7648
  }
7499
7649
  /**
@@ -7569,42 +7719,135 @@ var BaseAddon = class {
7569
7719
  this[timerOf] = timer;
7570
7720
  }
7571
7721
  /**
7572
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
7573
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
7574
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
7575
- * re-initialize) doesn't propagate up into `initialize()` and leave the
7722
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
7723
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
7576
7724
  * addon permanently broken.
7577
7725
  *
7578
- * Retry only the two known infra fingerprints. Anything else propagates so
7579
- * real bugs surface immediately. After the budget expires we fall back to
7580
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
7726
+ * Two kinds of outage, two budgets:
7727
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
7728
+ * initialized`, `provider not available`): a short budget, then the addon
7729
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
7730
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
7731
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
7732
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
7733
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
7734
+ * loop. A long, bounded budget; only after it the error propagates - the
7735
+ * addon never runs on defaults for a store it could not ask.
7736
+ * Anything else propagates immediately so real bugs surface.
7581
7737
  */
7582
7738
  async readAddonStoreWithRetry() {
7583
7739
  const settings = this.rawSettings();
7584
7740
  if (!settings) return {};
7585
- const delaysMs = [
7586
- 150,
7587
- 350,
7588
- 600,
7589
- 900
7590
- ];
7591
7741
  let lastErr;
7592
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
7742
+ for (let attempt = 0;; attempt++) try {
7593
7743
  const stored = await settings.readAddonStore() ?? {};
7594
7744
  this.settingsStoreReady = true;
7595
7745
  return stored;
7596
7746
  } catch (err) {
7597
7747
  lastErr = err;
7598
- const msg = err instanceof Error ? err.message : String(err);
7599
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
7600
- if (attempt === delaysMs.length) break;
7601
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
7748
+ const kind = classifyStoreError(err);
7749
+ if (kind === "permanent") throw err;
7750
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
7751
+ if (delay === void 0) {
7752
+ if (kind === "transport") throw err;
7753
+ break;
7754
+ }
7755
+ await new Promise((r) => setTimeout(r, delay));
7602
7756
  }
7603
7757
  this.settingsStoreReady = false;
7604
7758
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
7605
7759
  return {};
7606
7760
  }
7607
7761
  };
7762
+ /** The settings store's own restart fingerprints. */
7763
+ var RESTART_RETRY_DELAYS_MS = [
7764
+ 150,
7765
+ 350,
7766
+ 600,
7767
+ 900
7768
+ ];
7769
+ /** A hub restarting under a booting runner: ~100 s in total. */
7770
+ var TRANSPORT_RETRY_DELAYS_MS = [
7771
+ 150,
7772
+ 350,
7773
+ 600,
7774
+ 900,
7775
+ 2e3,
7776
+ 5e3,
7777
+ 1e4,
7778
+ 2e4,
7779
+ 3e4,
7780
+ 3e4
7781
+ ];
7782
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
7783
+ /** Node / socket error codes of a connection that did not happen or broke. */
7784
+ var TRANSPORT_CODES = new Set([
7785
+ "ECONNREFUSED",
7786
+ "ECONNRESET",
7787
+ "ETIMEDOUT",
7788
+ "EPIPE",
7789
+ "EHOSTUNREACH",
7790
+ "ENETUNREACH"
7791
+ ]);
7792
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
7793
+ var UNAVAILABLE_TRPC_CODES = new Set([
7794
+ "TIMEOUT",
7795
+ "SERVICE_UNAVAILABLE",
7796
+ "BAD_GATEWAY",
7797
+ "GATEWAY_TIMEOUT"
7798
+ ]);
7799
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
7800
+ var TRANSPORT_PHRASES = [
7801
+ "discovery deadline exceeded",
7802
+ "parent could not route child unowned cap call",
7803
+ "UDS request timed out after",
7804
+ "channel closed"
7805
+ ];
7806
+ /** Moleculer error `type`s of a call that could not be served right now. */
7807
+ var MOLECULER_TRANSIENT_TYPES = new Set([
7808
+ "REQUEST_TIMEOUT",
7809
+ "SERVICE_NOT_FOUND",
7810
+ "SERVICE_NOT_AVAILABLE",
7811
+ "REQUEST_REJECTED",
7812
+ "BROKER_DISCONNECTED"
7813
+ ]);
7814
+ function stringProp(value, key) {
7815
+ if (typeof value !== "object" || value === null) return void 0;
7816
+ const found = Reflect.get(value, key);
7817
+ return typeof found === "string" ? found : void 0;
7818
+ }
7819
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
7820
+ function errorCode(err) {
7821
+ const out = {};
7822
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
7823
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
7824
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
7825
+ if (node !== void 0) out.node = node;
7826
+ const trpc = stringProp(data, "code");
7827
+ if (trpc !== void 0) out.trpc = trpc;
7828
+ return out;
7829
+ }
7830
+ /**
7831
+ * Is a settings read failure worth retrying, and with which budget? Only
7832
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
7833
+ * one of the exact phrases our own transport raises. A message that merely
7834
+ * contains "timed out" or "unreachable" is not evidence of anything, and
7835
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
7836
+ */
7837
+ function classifyStoreError(err) {
7838
+ const message = err instanceof Error ? err.message : String(err);
7839
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
7840
+ const code = errorCode(err);
7841
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
7842
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
7843
+ if (typeof err === "object" && err !== null) {
7844
+ if (Reflect.get(err, "retryable") === true) return "transport";
7845
+ const type = stringProp(err, "type");
7846
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
7847
+ }
7848
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
7849
+ return "permanent";
7850
+ }
7608
7851
  /**
7609
7852
  * Collect the keys of every field marked `perNode: true`, recursing into
7610
7853
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -7694,6 +7937,341 @@ var PeerBytesTicketSchema = object({
7694
7937
  */
7695
7938
  declaredBytes: number().int().nonnegative().nullable()
7696
7939
  });
7940
+ /** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
7941
+ /** The files a kind may live in. `history` is device-history's (D850), never records. */
7942
+ var RECORD_DATABASES = ["settings", "events"];
7943
+ /** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
7944
+ var RECORD_CLASSES = [
7945
+ "config",
7946
+ "ledger",
7947
+ "audit",
7948
+ "mirror",
7949
+ "ephemeral"
7950
+ ];
7951
+ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
7952
+ var RECORD_MAX_DATA_BYTES = 1024 * 1024;
7953
+ var RECORD_BATCH_MAX = 1e3;
7954
+ var RECORD_QUERY_MAX = 1e3;
7955
+ /** A kind in the `settings` file may not bound itself above this (D447: high volume is `events`). */
7956
+ var RECORD_SETTINGS_MAX_ROWS = 5e4;
7957
+ var PREFIX = "records/";
7958
+ /** The base of every records failure. `detail` is the human part of the message. */
7959
+ var RecordsError = class extends Error {
7960
+ code;
7961
+ detail;
7962
+ constructor(code, detail) {
7963
+ super(`${PREFIX}${code}: ${detail}`);
7964
+ this.name = "RecordsError";
7965
+ this.code = code;
7966
+ this.detail = detail;
7967
+ }
7968
+ };
7969
+ /** The keychain could not store or serve a value: explicit, never an empty string. */
7970
+ var RecordSecretUnavailableError = class extends RecordsError {
7971
+ constructor(detail) {
7972
+ super("secret-unavailable", detail);
7973
+ this.name = "RecordSecretUnavailableError";
7974
+ }
7975
+ };
7976
+ var InvalidRecordError = class extends RecordsError {
7977
+ constructor(detail) {
7978
+ super("invalid-record", detail);
7979
+ this.name = "InvalidRecordError";
7980
+ }
7981
+ };
7982
+ /** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
7983
+ var DeclarationRefusedError = class extends RecordsError {
7984
+ constructor(detail) {
7985
+ super("declaration-refused", detail);
7986
+ this.name = "DeclarationRefusedError";
7987
+ }
7988
+ };
7989
+ function defOf(schema) {
7990
+ const zodBag = Reflect.get(schema, "_zod");
7991
+ if (typeof zodBag !== "object" || zodBag === null) return {};
7992
+ const def = Reflect.get(zodBag, "def");
7993
+ if (typeof def !== "object" || def === null) return {};
7994
+ return def;
7995
+ }
7996
+ function declaredHere(schema) {
7997
+ return globalRegistry.get(schema)?.secret === true;
7998
+ }
7999
+ /** Wrapper kinds whose `innerType` is the field itself. */
8000
+ var WRAPPERS = new Set([
8001
+ "optional",
8002
+ "nullable",
8003
+ "default",
8004
+ "prefault",
8005
+ "catch",
8006
+ "readonly",
8007
+ "nonoptional"
8008
+ ]);
8009
+ /**
8010
+ * The schema layers that make up ONE field: the schema itself and every
8011
+ * wrapper below it (optional / default / nullable / readonly / catch), plus
8012
+ * both sides of a pipe (`z.preprocess` puts the real schema on `out`,
8013
+ * `.transform` on `in`).
8014
+ */
8015
+ function layersOf(schema) {
8016
+ const out = [];
8017
+ const queue = [schema];
8018
+ while (queue.length > 0) {
8019
+ const s = queue.shift();
8020
+ if (!s || out.includes(s)) continue;
8021
+ out.push(s);
8022
+ const def = defOf(s);
8023
+ if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
8024
+ if (def.type === "pipe") {
8025
+ if (def.in) queue.push(def.in);
8026
+ if (def.out) queue.push(def.out);
8027
+ }
8028
+ }
8029
+ return out;
8030
+ }
8031
+ /** True when any layer of this field declares `.meta({ secret: true })`. */
8032
+ function isZodSecret(schema) {
8033
+ return layersOf(schema).some(declaredHere);
8034
+ }
8035
+ /**
8036
+ * Every declared secret path in a config schema: dotted keys, `[]` for "each
8037
+ * element of this array" (`connection.password`, `rows[].token`). A declared
8038
+ * object or array is reported as one path and not descended into — everything
8039
+ * under it is secret.
8040
+ */
8041
+ function collectZodSecretPaths(schema, prefix = "") {
8042
+ if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
8043
+ const paths = [];
8044
+ for (const layer of layersOf(schema)) {
8045
+ const def = defOf(layer);
8046
+ if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
8047
+ else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
8048
+ else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
8049
+ else if (def.type === "intersection") {
8050
+ if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
8051
+ if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
8052
+ }
8053
+ }
8054
+ return [...new Set(paths)];
8055
+ }
8056
+ /**
8057
+ * Secret fields of a record, addressed the way a Zod schema declares them
8058
+ * (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
8059
+ * (`auth.accessToken`, `headers[].value`).
8060
+ *
8061
+ * Array elements are matched by a DECLARED id key (`secretArrayKeys`:
8062
+ * `{ headers: 'name' }`), never by index, so reordering a list keeps every
8063
+ * keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
8064
+ * leaf names its element: `headers[X-Api].value`.
8065
+ *
8066
+ * Pure and browser-safe. Nothing here mutates: every transform returns a new value.
8067
+ */
8068
+ /** The array prefixes (declared form, e.g. `headers` or `a.headers`) of a path. */
8069
+ function parseSecretPath(path) {
8070
+ if (path.length === 0) throw new InvalidRecordError("an empty secret path");
8071
+ return path.split(".").map((raw) => {
8072
+ const each = raw.endsWith("[]");
8073
+ const key = each ? raw.slice(0, -2) : raw;
8074
+ if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
8075
+ return {
8076
+ key,
8077
+ each
8078
+ };
8079
+ });
8080
+ }
8081
+ /** The declared array prefixes of `path` that need an id key (`headers`, `a.rows`). */
8082
+ function secretArrayPrefixes(path) {
8083
+ const segments = parseSecretPath(path);
8084
+ const prefixes = [];
8085
+ const walked = [];
8086
+ for (const segment of segments) {
8087
+ walked.push(segment.key);
8088
+ if (segment.each) prefixes.push(walked.join("."));
8089
+ }
8090
+ return prefixes;
8091
+ }
8092
+ /**
8093
+ * Record kinds (D881): the declaration an addon makes of one kind of fact, the
8094
+ * Zod row schema that describes it, and the helper that turns the two into the
8095
+ * JSON the engine stores.
8096
+ *
8097
+ * A kind is declared ONCE, next to the code that owns it, and the engine's
8098
+ * reconciler creates its indexes - nothing creates DDL at runtime from a write.
8099
+ * Everything the generic machinery needs (secret fields, the entry descriptor)
8100
+ * is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
8101
+ * never a field name (D879).
8102
+ */
8103
+ /** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
8104
+ var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
8105
+ var RecordIndexSchema = object({
8106
+ name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
8107
+ fields: array(RecordFieldPathSchema).min(1).max(4),
8108
+ unique: boolean().optional()
8109
+ }).strict();
8110
+ var RecordRetentionSchema = union([
8111
+ object({
8112
+ ttlMs: number().int().positive(),
8113
+ from: _enum(["at", "write"])
8114
+ }).strict(),
8115
+ object({
8116
+ maxRows: number().int().positive().optional(),
8117
+ maxRowsPerDevice: number().int().positive().optional()
8118
+ }).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
8119
+ object({
8120
+ owner: string().min(1),
8121
+ reason: string().min(1)
8122
+ }).strict(),
8123
+ object({ none: string().min(1) }).strict()
8124
+ ]);
8125
+ /** The descriptor a generic entries UI reads (D881 "generic entries"). */
8126
+ var EntryDescriptorSchema = object({
8127
+ title: string().min(1),
8128
+ /** The record body field shown as the entry's name. */
8129
+ nameField: string().min(1),
8130
+ /** JSON Schema of the entry body; `secret: true` marks a password field. */
8131
+ fields: record(string(), unknown())
8132
+ }).strict();
8133
+ /** What crosses the wire and sits in the engine's catalog: JSON only, no Zod. */
8134
+ var RecordKindDeclarationSchema = object({
8135
+ database: _enum(RECORD_DATABASES).default("settings"),
8136
+ class: _enum(RECORD_CLASSES),
8137
+ writeTrigger: string().min(1),
8138
+ device: _enum([
8139
+ "required",
8140
+ "optional",
8141
+ "none"
8142
+ ]).default("none"),
8143
+ at: _enum(["required", "none"]).default("none"),
8144
+ indexes: array(RecordIndexSchema).max(8).default([]),
8145
+ retention: RecordRetentionSchema,
8146
+ deviceRemoval: _enum(["delete", "none"]).default("none"),
8147
+ maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
8148
+ /** Derived from the Zod schema; never written by hand. */
8149
+ secretPaths: array(string().min(1)).default([]),
8150
+ /** The id key of each array that carries a secret (`{ headers: 'name' }`). */
8151
+ secretArrayKeys: record(string(), string()).default({}),
8152
+ /** The legacy table this kind adopts from; the boot guard reads it (D853: no migration code). */
8153
+ adoptsFrom: string().min(1).optional(),
8154
+ /** Kinds that must agree through `transact` sit in one file under one family name. */
8155
+ transactFamily: string().min(1).optional(),
8156
+ entry: EntryDescriptorSchema.optional()
8157
+ }).strict();
8158
+ /** The kind names: lower-case, dash separated, short enough for an index name. */
8159
+ var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8160
+ /** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
8161
+ function assertValidDeclaration(name, decl) {
8162
+ const refuse = (why) => {
8163
+ throw new DeclarationRefusedError(`kind "${name}": ${why}`);
8164
+ };
8165
+ if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
8166
+ const seen = /* @__PURE__ */ new Set();
8167
+ for (const index of decl.indexes) {
8168
+ if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
8169
+ seen.add(index.name);
8170
+ }
8171
+ const { retention } = decl;
8172
+ const hasSecrets = decl.secretPaths.length > 0;
8173
+ if ("ttlMs" in retention) {
8174
+ if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
8175
+ if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
8176
+ }
8177
+ if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
8178
+ if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
8179
+ if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
8180
+ if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
8181
+ const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
8182
+ if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
8183
+ }
8184
+ if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
8185
+ for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
8186
+ }
8187
+ function bodyFieldsOf(schema) {
8188
+ return { ...toJSONSchema(schema, {
8189
+ unrepresentable: "any",
8190
+ io: "input"
8191
+ }) };
8192
+ }
8193
+ function isRecordLike(value) {
8194
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8195
+ }
8196
+ /** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
8197
+ function hasNameField(json, field) {
8198
+ const branches = json["oneOf"] ?? json["anyOf"];
8199
+ if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
8200
+ const properties = json["properties"];
8201
+ return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
8202
+ }
8203
+ /**
8204
+ * Declare the kinds of a package. The keys are the kind names. The result is
8205
+ * what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
8206
+ * types its handle from.
8207
+ */
8208
+ function defineRecordKinds(specs) {
8209
+ const out = {};
8210
+ for (const [name, spec] of Object.entries(specs)) {
8211
+ const secretPaths = collectZodSecretPaths(spec.schema);
8212
+ const nameField = spec.entry?.nameField ?? "name";
8213
+ const fields = bodyFieldsOf(spec.schema);
8214
+ if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
8215
+ const parsed = RecordKindDeclarationSchema.parse({
8216
+ database: spec.database,
8217
+ class: spec.class,
8218
+ writeTrigger: spec.writeTrigger,
8219
+ device: spec.device,
8220
+ at: spec.at,
8221
+ indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
8222
+ retention: spec.retention,
8223
+ deviceRemoval: spec.deviceRemoval,
8224
+ maxDataBytes: spec.maxDataBytes,
8225
+ secretPaths: [...secretPaths],
8226
+ secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
8227
+ adoptsFrom: spec.adoptsFrom,
8228
+ transactFamily: spec.transactFamily,
8229
+ entry: spec.entry === void 0 ? void 0 : {
8230
+ title: spec.entry.title,
8231
+ nameField,
8232
+ fields
8233
+ }
8234
+ });
8235
+ assertValidDeclaration(name, parsed);
8236
+ out[name] = {
8237
+ name,
8238
+ schema: spec.schema,
8239
+ declaration: parsed
8240
+ };
8241
+ }
8242
+ return out;
8243
+ }
8244
+ /**
8245
+ * Declare one entry kind. An entry is configuration: never trimmed by the
8246
+ * engine, never aged, belonging to no device.
8247
+ */
8248
+ function defineEntryKind(name, spec) {
8249
+ const defined = defineRecordKinds({ [name]: {
8250
+ schema: spec.schema,
8251
+ class: "config",
8252
+ writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
8253
+ retention: { none: "an entry goes only when the operator deletes it" },
8254
+ ...spec.database === void 0 ? {} : { database: spec.database },
8255
+ ...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
8256
+ ...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
8257
+ ...spec.adoptsFrom === void 0 ? {} : { adoptsFrom: spec.adoptsFrom },
8258
+ entry: {
8259
+ title: spec.title,
8260
+ ...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
8261
+ }
8262
+ } })[name];
8263
+ if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
8264
+ return defined;
8265
+ }
8266
+ /**
8267
+ * Legacy source for entry adoption (B3): a list stored under addon-settings
8268
+ * `<addonId>.<key>` until records-adopt copies rows into the entry kind.
8269
+ */
8270
+ var SETTINGS_ARRAY_ADOPTS_PREFIX = "@settings-array/";
8271
+ /** The `adoptsFrom` value for an addon-settings array field. */
8272
+ function settingsArrayAdoptsFrom(addonId, settingsKey) {
8273
+ return `${SETTINGS_ARRAY_ADOPTS_PREFIX}${addonId}/${settingsKey}`;
8274
+ }
7697
8275
  /** Shared Zod schemas used across streaming capabilities. */
7698
8276
  var CamProfileSchema = _enum([
7699
8277
  "high",
@@ -8159,7 +8737,7 @@ object({
8159
8737
  params: record(string(), union([string(), number()])).optional()
8160
8738
  });
8161
8739
  //#endregion
8162
- //#region ../types/dist/err-msg-DLerKiVO.mjs
8740
+ //#region ../types/dist/err-msg--2RrYiLO.mjs
8163
8741
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
8164
8742
  DeviceType["Camera"] = "camera";
8165
8743
  DeviceType["Hub"] = "hub";
@@ -8428,6 +9006,9 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
8428
9006
  /** Virtual HA toggle (input_boolean.*) — distinguishable from a
8429
9007
  * real Switch device for UI rendering / export adapters. */
8430
9008
  DeviceRole["BinaryHelper"] = "binary-helper";
9009
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
9010
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
9011
+ DeviceRole["Outlet"] = "outlet";
8431
9012
  /** Generic motion / occupancy / moving event source. Distinct from
8432
9013
  * the camera accessory PirSensor role: that one is a camera child;
8433
9014
  * this is a standalone HA / 3rd-party motion sensor. */
@@ -8505,7 +9086,7 @@ function errMsg(err) {
8505
9086
  return String(err);
8506
9087
  }
8507
9088
  //#endregion
8508
- //#region ../types/dist/composition-EQ9Ok0Ee.mjs
9089
+ //#region ../types/dist/composition-DOwQB_Ua.mjs
8509
9090
  /**
8510
9091
  * The ffmpeg build every CamStack node downloads, per platform and arch.
8511
9092
  *
@@ -11826,11 +12407,10 @@ var ClipModelMetaSchema = object({
11826
12407
  /**
11827
12408
  * The `vector-store` index this model's vectors live in. ONE feature space
11828
12409
  * per index: two models share an index only when their vectors are ranked
11829
- * against each other, which for CLIP means never across families. MobileCLIP
11830
- * S1 and S2 share `object-clip` for history (separated by the row's
11831
- * `modelId`); any other model gets its own.
12410
+ * against each other, which for CLIP means never across families. Every
12411
+ * model gets its own.
11832
12412
  */
11833
- vectorIndex: string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
12413
+ vectorIndex: string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
11834
12414
  /**
11835
12415
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
11836
12416
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -15716,6 +16296,41 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
15716
16296
  keyField: string()
15717
16297
  }).optional()
15718
16298
  })) });
16299
+ /**
16300
+ * The report of a one-shot "move this owner's plaintext secrets into the
16301
+ * keychain" run (D878). COUNTS only - never a value, never a ref.
16302
+ *
16303
+ * The owner runs it on its own rows, through its own write path; an operator
16304
+ * script (`scripts/hub/migrate-raw-secrets.ts`) calls the owner's cap method.
16305
+ * Dry run (`apply: false`) reports what WOULD move and changes nothing.
16306
+ */
16307
+ var RawSecretMigrationInputSchema = object({
16308
+ /** `false` (the default of the script) = report only. */
16309
+ apply: boolean() });
16310
+ var RawSecretMigrationReportSchema = object({
16311
+ apply: boolean(),
16312
+ /** Rows that can carry a secret (a profile, an enrolment). */
16313
+ rows: number().int(),
16314
+ /** Rows whose secret was plaintext when the run started. */
16315
+ raw: number().int(),
16316
+ /** Rows that already held a keychain marker when the run started. */
16317
+ markers: number().int(),
16318
+ /** Plaintext rows moved by THIS run (always 0 on a dry run). */
16319
+ migrated: number().int(),
16320
+ /** Plaintext rows left in place because the move or its read-back failed. */
16321
+ failed: number().int(),
16322
+ /** After the run: rows still holding plaintext. */
16323
+ remainingRaw: number().int(),
16324
+ /** After the run: markers the keychain could not resolve right now. */
16325
+ unresolvedMarkers: number().int(),
16326
+ /**
16327
+ * A second, redundant copy of the secrets' rows that the run found (and, on
16328
+ * `apply`, deleted after verifying the first). Owners with a single copy omit it.
16329
+ */
16330
+ redundantCopies: number().int().optional(),
16331
+ /** True when nothing is raw and every marker resolves. */
16332
+ verified: boolean()
16333
+ });
15719
16334
  /** Where a block runs. The operator chooses — a block driving a device on an
15720
16335
  * agent is the reason placement is not fixed to the hub. */
15721
16336
  var CoreBlockPlacementSchema = union([literal("hub"), string().min(1)]);
@@ -15942,6 +16557,9 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
15942
16557
  }), SettingsUpdateResultSchema, {
15943
16558
  kind: "mutation",
15944
16559
  auth: "admin"
16560
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
16561
+ kind: "mutation",
16562
+ auth: "admin"
15945
16563
  }), method(object({}), object({ libs: array(object({
15946
16564
  filePath: string(),
15947
16565
  content: string()
@@ -16205,6 +16823,347 @@ id: union([string(), number()]) }), {
16205
16823
  auth: "admin"
16206
16824
  });
16207
16825
  /**
16826
+ * records - an addon's own facts and documents (D881): ledgers, audit rows,
16827
+ * config documents, mirrors. The third storage API next to `ctx.settings`
16828
+ * (operator intent, D870) and device-history (numbers over time, D850).
16829
+ *
16830
+ * Who the OWNER is: `callerAddonId`, stamped by the transport on a call that
16831
+ * crossed a process and stated by a hub in-process caller (`ctx.records` does
16832
+ * that with the addon id closed over). It is deliberately NOT in any input
16833
+ * schema, so a session can never supply it, and a call with no stamp is refused
16834
+ * `records/no-caller`. A kind is readable and writable only by its owner; other
16835
+ * addons go through the owner's capability.
16836
+ *
16837
+ * Every read is three-way: a row, `null`, or the call THROWS. A failed read is
16838
+ * never `[]`. Secret fields are never on the wire: a read shows the
16839
+ * redaction token, `secretRefs` hands the owner's `ctx.secrets` the refs it
16840
+ * resolves itself, and a write may carry only a keychain marker bound to the
16841
+ * row's own ref.
16842
+ *
16843
+ * Internal: addons reach it through `ctx.records`, never directly.
16844
+ */
16845
+ var RecordIdSchema = string().min(1).max(256);
16846
+ /** A JSON object body. Size is the engine's check (`maxDataBytes`), not a schema's. */
16847
+ var RecordBodySchema = record(string(), unknown());
16848
+ var RecordInputSchema = object({
16849
+ id: RecordIdSchema,
16850
+ /** The device this row belongs to (D865 removal, per-device reads). */
16851
+ deviceId: number().int().optional(),
16852
+ /** The domain clock, ms: observed / created / opened. */
16853
+ at: number().int().optional(),
16854
+ /** Producer-set expiry, ms. Refused on a kind whose retention is an engine TTL. */
16855
+ expiresAt: number().int().optional(),
16856
+ data: RecordBodySchema
16857
+ });
16858
+ var RecordViewSchema = object({
16859
+ id: string(),
16860
+ deviceId: number().int().nullable(),
16861
+ at: number().nullable(),
16862
+ expiresAt: number().nullable(),
16863
+ rev: number().int(),
16864
+ updatedAt: number(),
16865
+ data: RecordBodySchema
16866
+ });
16867
+ /** Declared index fields only. Anything else does not compile, by design. */
16868
+ var RecordWhereSchema = record(RecordFieldPathSchema, union([
16869
+ string(),
16870
+ number(),
16871
+ boolean(),
16872
+ object({ in: array(union([
16873
+ string(),
16874
+ number(),
16875
+ boolean()
16876
+ ])).min(1).max(RECORD_BATCH_MAX) }),
16877
+ object({
16878
+ gt: union([string(), number()]).optional(),
16879
+ gte: union([string(), number()]).optional(),
16880
+ lt: union([string(), number()]).optional(),
16881
+ lte: union([string(), number()]).optional()
16882
+ }).refine((r) => Object.keys(r).length > 0, { message: "name at least one bound" })
16883
+ ]));
16884
+ var KindShape = { kind: RecordKindNameSchema };
16885
+ var TimeWindowShape = {
16886
+ deviceId: number().int().optional(),
16887
+ atFrom: number().optional(),
16888
+ atTo: number().optional()
16889
+ };
16890
+ var RecordQueryInputSchema = object({
16891
+ ...KindShape,
16892
+ ...TimeWindowShape,
16893
+ where: RecordWhereSchema.optional(),
16894
+ /** Without `where`: `at` (default for a kind with a clock) or `id`. With `where` the order is the index's. */
16895
+ order: _enum(["at", "id"]).optional(),
16896
+ desc: boolean().optional(),
16897
+ limit: number().int().min(1).max(RECORD_QUERY_MAX).default(100),
16898
+ /** Opaque keyset cursor from a previous answer. There is no offset. */
16899
+ cursor: string().min(1).optional()
16900
+ });
16901
+ var RecordQueryResultSchema = object({
16902
+ records: array(RecordViewSchema),
16903
+ nextCursor: string().nullable()
16904
+ });
16905
+ var RecordKindStateSchema = _enum([
16906
+ "created",
16907
+ "unchanged",
16908
+ "updated"
16909
+ ]);
16910
+ var DeclareKindResultSchema = object({
16911
+ kindId: number().int(),
16912
+ state: RecordKindStateSchema,
16913
+ createdIndexes: array(string()),
16914
+ /** The boot guard: the kind is empty while its legacy table still holds rows. */
16915
+ adoptionPending: object({
16916
+ legacyTable: string(),
16917
+ legacyRows: number().int()
16918
+ }).nullable()
16919
+ });
16920
+ /** Keychain refs a write released (the old marker is gone from the row): the owner deletes the values. */
16921
+ var SecretRefsList = array(string());
16922
+ var RecordSecretRefsSchema = record(string(), record(string(), string()));
16923
+ method(object({ kinds: record(RecordKindNameSchema, RecordKindDeclarationSchema) }), object({ kinds: record(string(), DeclareKindResultSchema) }), {
16924
+ kind: "mutation",
16925
+ auth: "admin"
16926
+ }), method(object({
16927
+ ...KindShape,
16928
+ id: RecordIdSchema
16929
+ }), RecordViewSchema.nullable(), { auth: "admin" }), method(object({
16930
+ ...KindShape,
16931
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16932
+ }), array(RecordViewSchema), { auth: "admin" }), method(object({
16933
+ ...KindShape,
16934
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16935
+ }), RecordSecretRefsSchema, { auth: "admin" }), method(object({
16936
+ ...KindShape,
16937
+ record: RecordInputSchema,
16938
+ /** Compare-and-set. `0` means "the row must not exist". */
16939
+ ifRev: number().int().min(0).optional()
16940
+ }), object({
16941
+ rev: number().int(),
16942
+ releasedRefs: SecretRefsList
16943
+ }), {
16944
+ kind: "mutation",
16945
+ auth: "admin"
16946
+ }), method(object({
16947
+ ...KindShape,
16948
+ records: array(RecordInputSchema).min(1).max(RECORD_BATCH_MAX)
16949
+ }), object({
16950
+ count: number().int(),
16951
+ releasedRefs: SecretRefsList
16952
+ }), {
16953
+ kind: "mutation",
16954
+ auth: "admin"
16955
+ }), method(object({
16956
+ ...KindShape,
16957
+ id: RecordIdSchema,
16958
+ data: RecordBodySchema,
16959
+ at: number().int().nullable().optional(),
16960
+ expiresAt: number().int().nullable().optional(),
16961
+ ifRev: number().int().min(1).optional()
16962
+ }), object({
16963
+ rev: number().int(),
16964
+ releasedRefs: SecretRefsList
16965
+ }), {
16966
+ kind: "mutation",
16967
+ auth: "admin"
16968
+ }), method(object({
16969
+ ...KindShape,
16970
+ id: RecordIdSchema
16971
+ }), object({
16972
+ deleted: boolean(),
16973
+ secretRefs: SecretRefsList
16974
+ }), {
16975
+ kind: "mutation",
16976
+ auth: "admin"
16977
+ }), method(object({
16978
+ ...KindShape,
16979
+ ids: array(RecordIdSchema).min(1).max(RECORD_BATCH_MAX)
16980
+ }), object({
16981
+ deleted: number().int(),
16982
+ secretRefs: SecretRefsList
16983
+ }), {
16984
+ kind: "mutation",
16985
+ auth: "admin"
16986
+ }), method(RecordQueryInputSchema, RecordQueryResultSchema, { auth: "admin" }), method(object({
16987
+ ...KindShape,
16988
+ ...TimeWindowShape,
16989
+ where: RecordWhereSchema.optional()
16990
+ }), object({ count: number().int() }), { auth: "admin" }), method(object({
16991
+ ...KindShape,
16992
+ deviceId: number().int().optional(),
16993
+ from: number(),
16994
+ to: number(),
16995
+ bucketMs: number().int().positive()
16996
+ }), object({ buckets: array(object({
16997
+ bucketStart: number(),
16998
+ count: number().int()
16999
+ })) }), { auth: "admin" }), method(object({
17000
+ ...KindShape,
17001
+ op: _enum([
17002
+ "sum",
17003
+ "min",
17004
+ "max",
17005
+ "count"
17006
+ ]),
17007
+ field: RecordFieldPathSchema.optional(),
17008
+ groupBy: RecordFieldPathSchema.optional(),
17009
+ where: RecordWhereSchema.optional()
17010
+ }), object({ rows: array(object({
17011
+ group: union([
17012
+ string(),
17013
+ number(),
17014
+ _null()
17015
+ ]),
17016
+ value: number().nullable()
17017
+ })) }), { auth: "admin" }), method(object({
17018
+ ...KindShape,
17019
+ deviceId: number().int().optional(),
17020
+ atBefore: number().optional(),
17021
+ where: RecordWhereSchema.optional()
17022
+ }), object({
17023
+ deleted: number().int(),
17024
+ secretRefs: SecretRefsList
17025
+ }), {
17026
+ kind: "mutation",
17027
+ auth: "admin"
17028
+ }), method(object({
17029
+ deviceId: number().int(),
17030
+ kinds: array(RecordKindNameSchema).optional()
17031
+ }), object({
17032
+ deleted: record(string(), number().int()),
17033
+ secretRefs: SecretRefsList
17034
+ }), {
17035
+ kind: "mutation",
17036
+ auth: "admin"
17037
+ }), method(object(KindShape), object({ id: number().int() }), {
17038
+ kind: "mutation",
17039
+ auth: "admin"
17040
+ });
17041
+ /** One table of the settings database. */
17042
+ var StorageTableSchema = object({
17043
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
17044
+ name: string(),
17045
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
17046
+ owner: string().nullable(),
17047
+ rows: number().int().nonnegative(),
17048
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
17049
+ bytes: number().int().nonnegative().nullable(),
17050
+ /** Declared by an addon since this engine process started (a running addon claims it). */
17051
+ declaredThisBoot: boolean()
17052
+ });
17053
+ /** One declared record kind (D881) as System -> Data shows it. */
17054
+ var StorageKindSchema = object({
17055
+ owner: string(),
17056
+ kind: string(),
17057
+ database: _enum(["settings", "events"]),
17058
+ class: string(),
17059
+ state: _enum([
17060
+ "declared",
17061
+ "orphaned",
17062
+ "dropped"
17063
+ ]),
17064
+ /** `null` when the caller asked for no counts (`counts: false`). */
17065
+ rows: number().int().nonnegative().nullable(),
17066
+ /** Rows x the average size of a sample; null for an empty kind. */
17067
+ bytesEstimate: number().int().nonnegative().nullable(),
17068
+ writeTrigger: string(),
17069
+ retention: RecordRetentionSchema,
17070
+ /** `true` when the kind is an entry kind (the generic entries UI lists it). */
17071
+ entry: boolean(),
17072
+ /** The whole declaration, secret paths and entry descriptor included (the entries service builds its handle from it). */
17073
+ declaration: RecordKindDeclarationSchema
17074
+ });
17075
+ method(object({ ownerPrefix: string().min(1).optional() }), object({ tables: array(StorageTableSchema) }), { auth: "admin" }), method(object({
17076
+ collection: string().min(1),
17077
+ expectRows: number().int().nonnegative()
17078
+ }), object({
17079
+ dropped: literal(true),
17080
+ rows: number().int().nonnegative()
17081
+ }), {
17082
+ kind: "mutation",
17083
+ auth: "admin"
17084
+ }), method(object({
17085
+ owner: string().min(1).optional(),
17086
+ /** `false` skips the per-kind row count (a catalog read only). Default true. */
17087
+ counts: boolean().optional()
17088
+ }), object({ kinds: array(StorageKindSchema) }), { auth: "admin" }), method(RecordQueryInputSchema.extend({
17089
+ owner: string().min(1),
17090
+ kind: RecordKindNameSchema
17091
+ }), RecordQueryResultSchema, { auth: "admin" }), method(object({
17092
+ owner: string().min(1),
17093
+ kind: RecordKindNameSchema,
17094
+ records: array(RecordInputSchema).max(RECORD_BATCH_MAX),
17095
+ /** The LAST batch: the copy is complete, the boot guard stops asking. */
17096
+ complete: boolean().optional()
17097
+ }).refine((input) => input.records.length > 0 || input.complete === true, { message: "records must be non-empty unless complete is true" }), object({ adopted: number().int() }), {
17098
+ kind: "mutation",
17099
+ auth: "admin"
17100
+ }), method(object({
17101
+ collection: string().min(1),
17102
+ cursor: string().optional(),
17103
+ limit: number().int().min(1).max(1e3).optional()
17104
+ }), object({
17105
+ rows: array(object({
17106
+ id: string(),
17107
+ data: record(string(), unknown())
17108
+ })),
17109
+ nextCursor: string().nullable()
17110
+ }), { auth: "admin" }), method(object({ collection: string().min(1) }), object({ adopted: boolean() }), { auth: "admin" });
17111
+ /**
17112
+ * record-entries - the ONE admin surface for every list of user-created entries
17113
+ * (D881): notification targets, brokers, LLM profiles, anything an addon
17114
+ * declares as an ENTRY kind (`entry: { title }` in `defineRecordKinds`).
17115
+ *
17116
+ * The UI is generic. `listEntryKinds` hands it, per kind, the JSON Schema of
17117
+ * the entry body with `secret: true` on every credential field, so a password
17118
+ * field is derived from the schema and never from a name. `putEntry` takes the
17119
+ * redaction token for an untouched secret (the stored value is kept), a string
17120
+ * for a new one, and the clear instruction to remove one. A read never carries
17121
+ * a secret value, and a locked keychain refuses the write with
17122
+ * `records/secret-unavailable` instead of storing plaintext.
17123
+ *
17124
+ * Hub-only, served in-process (it acts for each entry's owner on the keychain).
17125
+ */
17126
+ var EntryKindInfoSchema = object({
17127
+ owner: string(),
17128
+ kind: RecordKindNameSchema,
17129
+ title: string(),
17130
+ nameField: string(),
17131
+ /** JSON Schema of the body; `secret: true` marks a password field. */
17132
+ fields: record(string(), unknown()),
17133
+ secretPaths: array(string()),
17134
+ rows: number().int().nonnegative()
17135
+ });
17136
+ var EntryViewSchema = object({
17137
+ id: RecordIdSchema,
17138
+ name: string(),
17139
+ rev: number().int(),
17140
+ updatedAt: number(),
17141
+ /** Secret fields hold the redaction token. */
17142
+ data: RecordBodySchema
17143
+ });
17144
+ var EntryAddress = {
17145
+ owner: string().min(1),
17146
+ kind: RecordKindNameSchema
17147
+ };
17148
+ method(object({}), object({ kinds: array(EntryKindInfoSchema) }), { auth: "admin" }), method(object({ ...EntryAddress }), object({ entries: array(EntryViewSchema) }), { auth: "admin" }), method(object({
17149
+ ...EntryAddress,
17150
+ id: RecordIdSchema.optional(),
17151
+ data: RecordBodySchema,
17152
+ ifRev: number().int().min(1).optional()
17153
+ }), object({
17154
+ id: string(),
17155
+ rev: number().int()
17156
+ }), {
17157
+ kind: "mutation",
17158
+ auth: "admin"
17159
+ }), method(object({
17160
+ ...EntryAddress,
17161
+ id: RecordIdSchema
17162
+ }), object({ deleted: boolean() }), {
17163
+ kind: "mutation",
17164
+ auth: "admin"
17165
+ });
17166
+ /**
16208
17167
  * `keychain` — the hub's encrypted store of secret values (D787).
16209
17168
  *
16210
17169
  * Settings blobs never hold a secret: they hold a marker
@@ -16745,6 +17704,16 @@ method(object({}), KeychainStatusSchema, { auth: "admin" }), method(object({}),
16745
17704
  kind: "mutation",
16746
17705
  auth: "admin",
16747
17706
  caller: "required"
17707
+ }), method(object({
17708
+ ref: string().min(1),
17709
+ value: string().min(1)
17710
+ }), object({
17711
+ ref: string(),
17712
+ version: number().int()
17713
+ }), {
17714
+ kind: "mutation",
17715
+ auth: "admin",
17716
+ caller: "required"
16748
17717
  }), method(object({ refs: array(string().min(1)).max(1e3) }), object({
16749
17718
  deleted: array(string()).readonly(),
16750
17719
  kept: array(object({
@@ -39232,6 +40201,9 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, {
39232
40201
  }), _void(), { kind: "mutation" }), method(object({}), array(LlmProfileKindDescriptorSchema)), method(object({}), array(LlmProfileSchema)), method(object({ profile: LlmProfileSchema }), LlmProfileSchema, {
39233
40202
  kind: "mutation",
39234
40203
  auth: "admin"
40204
+ }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
40205
+ kind: "mutation",
40206
+ auth: "admin"
39235
40207
  }), method(ProfileRefInputSchema, _void(), {
39236
40208
  kind: "mutation",
39237
40209
  auth: "admin"
@@ -49679,6 +50651,41 @@ var ServerRollbackInfoSchema = object({
49679
50651
  atMs: number(),
49680
50652
  reason: string()
49681
50653
  });
50654
+ /**
50655
+ * The runner boot check (D877): the runners this node PLANNED (hub: one per
50656
+ * `resolveRunnerId` over its forked addons; agent: the runners its process
50657
+ * service holds, because only the hub plans) against the states the process
50658
+ * service reports. Kept in memory, recomputed by the same one-shot check after
50659
+ * every boot, served on `getServerPackageStatus`.
50660
+ *
50661
+ * `failed` is the D6 breaker's terminal state, `refused` a deterministic Init
50662
+ * refusal (an addon that said "I will not start, and here is why"), `missing` a
50663
+ * planned runner the process service has no entry for.
50664
+ */
50665
+ var RunnerRefusalSchema = object({
50666
+ runnerId: string(),
50667
+ addonIds: array(string()),
50668
+ reason: string()
50669
+ });
50670
+ var RunnerBootCheckSchema = object({
50671
+ checkedAtMs: number(),
50672
+ /** Runners planned for this node. */
50673
+ expected: number(),
50674
+ /** Planned runners whose process is `running`. */
50675
+ running: number(),
50676
+ failed: array(string()),
50677
+ refused: array(RunnerRefusalSchema),
50678
+ missing: array(string()),
50679
+ /**
50680
+ * Runners still on their way: `starting`, or `crashed` waiting on a backoff
50681
+ * respawn. The check is FINAL only when this is empty; until then nothing is
50682
+ * pushed and the verdict is re-evaluated on the next runner state change.
50683
+ * Optional for version skew (absent = settled).
50684
+ */
50685
+ pending: array(string()).optional(),
50686
+ /** True when the plan is the hub's (`missing` is then meaningful); false on an agent. */
50687
+ planKnown: boolean()
50688
+ });
49682
50689
  var ServerPackageStatusSchema = object({
49683
50690
  /** Root package name (`@camstack/server` on the hub). */
49684
50691
  packageName: string(),
@@ -49741,7 +50748,14 @@ var ServerPackageStatusSchema = object({
49741
50748
  * for version skew: an older provider's payload simply omits it, and an
49742
50749
  * absent wrapper is unknown — never `native`.
49743
50750
  */
49744
- wrapper: WrapperIdentitySchema.optional()
50751
+ wrapper: WrapperIdentitySchema.optional(),
50752
+ /**
50753
+ * What this node PLANNED to run against what its process service reports
50754
+ * (D877). Absent until the one-shot boot check has run (~60 s after boot) and
50755
+ * on a provider that predates it. Absent is "not checked yet", never "all
50756
+ * well": a consumer that needs the answer treats it as pending.
50757
+ */
50758
+ runners: RunnerBootCheckSchema.optional()
49745
50759
  });
49746
50760
  var ServerUpdateCheckResultSchema = object({
49747
50761
  packageName: string(),
@@ -49792,6 +50806,13 @@ var ServerUpdateOutcomeSchema = _enum([
49792
50806
  "refused",
49793
50807
  "failed"
49794
50808
  ]);
50809
+ /** One addon the pre-flight found the target version would refuse (D877). */
50810
+ var UpdateBlockerSchema = object({
50811
+ addonId: string(),
50812
+ reason: string(),
50813
+ /** What the operator does about it. */
50814
+ remedy: string()
50815
+ });
49795
50816
  var ServerUpdateActionResultSchema = object({
49796
50817
  accepted: boolean(),
49797
50818
  targetVersion: string().nullable(),
@@ -49809,14 +50830,27 @@ var ServerUpdateActionResultSchema = object({
49809
50830
  * The failure itself, verbatim enough to act on (the npm output for a
49810
50831
  * staging install). Non-null only for `failed`.
49811
50832
  */
49812
- error: string().nullable().optional()
50833
+ error: string().nullable().optional(),
50834
+ /**
50835
+ * The addons the target version would refuse to start on this node's live
50836
+ * store (D877), present when the pre-flight refused the update
50837
+ * (`reason: 'addon-would-refuse'`). Optional for version skew.
50838
+ */
50839
+ blockers: array(UpdateBlockerSchema).optional()
49813
50840
  });
49814
50841
  method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
49815
50842
  kind: "mutation",
49816
50843
  auth: "admin"
49817
- }), method(object({
49818
- /** Explicit target version; omitted = latest from the registry. */
49819
- version: string().optional() }), ServerUpdateActionResultSchema, {
50844
+ }), method(object({
50845
+ /** Explicit target version; omitted = latest from the registry. */
50846
+ version: string().optional(),
50847
+ /**
50848
+ * Apply even though the pre-flight (D877) found addons the target would
50849
+ * refuse to start. Off by default: those addons stay down until the
50850
+ * remedy is run, which is the incident this gate exists to prevent.
50851
+ */
50852
+ acknowledgeRefusals: boolean().optional()
50853
+ }), ServerUpdateActionResultSchema, {
49820
50854
  kind: "mutation",
49821
50855
  auth: "admin",
49822
50856
  timeoutMs: 16 * 6e4
@@ -52264,7 +53298,9 @@ var ManifestShapeSchema = object({
52264
53298
  var AddonProcessSchema = object({
52265
53299
  pid: number().optional(),
52266
53300
  mode: string(),
52267
- state: string()
53301
+ state: string(),
53302
+ /** Why the runner is `refused` (an addon's own words), when it is (D877). */
53303
+ reason: string().optional()
52268
53304
  });
52269
53305
  /**
52270
53306
  * Per-addon health snapshot from the kernel's AddonHealthMonitor.
@@ -53267,6 +54303,12 @@ object({
53267
54303
  /** Horizontal louver swing on/off. Null when the device has no
53268
54304
  * horizontal swing surface (gate with `DeviceFeature.ClimateSwingHorizontal`). */
53269
54305
  swingHorizontal: boolean().nullable(),
54306
+ /** Lowest setpoint the device accepts, Celsius. Absent / null = not reported. */
54307
+ minTemp: number().nullable().optional(),
54308
+ /** Highest setpoint the device accepts, Celsius. Absent / null = not reported. */
54309
+ maxTemp: number().nullable().optional(),
54310
+ /** Setpoint granularity, Celsius (0.5, 1). Absent / null = not reported. */
54311
+ tempStep: number().positive().nullable().optional(),
53270
54312
  /** Ms epoch when the slice was last updated (push or command). */
53271
54313
  lastFetchedAt: number()
53272
54314
  });
@@ -55087,7 +56129,19 @@ var TlsStatusSchema = object({
55087
56129
  sans: array(string()),
55088
56130
  caCertPem: string().nullable(),
55089
56131
  reissueError: string().nullable(),
55090
- restartRequired: boolean()
56132
+ restartRequired: boolean(),
56133
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
56134
+ caMissing: boolean(),
56135
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
56136
+ localCaConstrained: boolean().nullable(),
56137
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
56138
+ caReplacedAt: string().nullable(),
56139
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
56140
+ storedUpload: object({
56141
+ leafFingerprintSha256: string(),
56142
+ validTo: string(),
56143
+ hasCa: boolean()
56144
+ }).nullable()
55091
56145
  });
55092
56146
  method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(object({
55093
56147
  /**
@@ -55143,6 +56197,9 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
55143
56197
  }), method(_void(), object({ pem: string() })), method(_void(), TlsStatusSchema, {
55144
56198
  kind: "mutation",
55145
56199
  auth: "admin"
56200
+ }), method(_void(), TlsStatusSchema, {
56201
+ kind: "mutation",
56202
+ auth: "admin"
55146
56203
  });
55147
56204
  object({
55148
56205
  /** Lifecycle state of the lock. `jammed` means the motor reported
@@ -60272,7 +61329,11 @@ method(_void(), array(UserSummarySchema), { auth: "admin" }), method(CreateUserI
60272
61329
  kind: "mutation",
60273
61330
  auth: "admin",
60274
61331
  access: "delete"
60275
- }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(object({
61332
+ }), method(object({ userId: string() }), TotpStatusSchema, { auth: "admin" }), method(RawSecretMigrationInputSchema, RawSecretMigrationReportSchema, {
61333
+ kind: "mutation",
61334
+ auth: "admin",
61335
+ access: "create"
61336
+ }), method(object({
60276
61337
  userId: string(),
60277
61338
  code: string()
60278
61339
  }), object({ valid: boolean() }), {
@@ -62473,6 +63534,12 @@ Object.freeze({
62473
63534
  addonId: null,
62474
63535
  access: "view"
62475
63536
  },
63537
+ "coreBlocks.migrateRawSecrets": {
63538
+ capName: "core-blocks",
63539
+ capScope: "system",
63540
+ addonId: null,
63541
+ access: "create"
63542
+ },
62476
63543
  "coreBlocks.restart": {
62477
63544
  capName: "core-blocks",
62478
63545
  capScope: "system",
@@ -64159,6 +65226,12 @@ Object.freeze({
64159
65226
  addonId: null,
64160
65227
  access: "create"
64161
65228
  },
65229
+ "keychainAdmin.importSecret": {
65230
+ capName: "keychain-admin",
65231
+ capScope: "system",
65232
+ addonId: null,
65233
+ access: "create"
65234
+ },
64162
65235
  "keychainAdmin.listAudit": {
64163
65236
  capName: "keychain-admin",
64164
65237
  capScope: "system",
@@ -64327,6 +65400,12 @@ Object.freeze({
64327
65400
  addonId: null,
64328
65401
  access: "view"
64329
65402
  },
65403
+ "llm.migrateRawSecrets": {
65404
+ capName: "llm",
65405
+ capScope: "system",
65406
+ addonId: null,
65407
+ access: "create"
65408
+ },
64330
65409
  "llm.resolveModelRef": {
64331
65410
  capName: "llm",
64332
65411
  capScope: "system",
@@ -64555,6 +65634,12 @@ Object.freeze({
64555
65634
  addonId: null,
64556
65635
  access: "create"
64557
65636
  },
65637
+ "localNetwork.useStoredUploadedCertificate": {
65638
+ capName: "local-network",
65639
+ capScope: "system",
65640
+ addonId: null,
65641
+ access: "create"
65642
+ },
64558
65643
  "lockControl.getStatus": {
64559
65644
  capName: "lock-control",
64560
65645
  capScope: "device",
@@ -67207,6 +68292,30 @@ Object.freeze({
67207
68292
  addonId: null,
67208
68293
  access: "create"
67209
68294
  },
68295
+ "recordEntries.deleteEntry": {
68296
+ capName: "record-entries",
68297
+ capScope: "system",
68298
+ addonId: null,
68299
+ access: "delete"
68300
+ },
68301
+ "recordEntries.listEntries": {
68302
+ capName: "record-entries",
68303
+ capScope: "system",
68304
+ addonId: null,
68305
+ access: "view"
68306
+ },
68307
+ "recordEntries.listEntryKinds": {
68308
+ capName: "record-entries",
68309
+ capScope: "system",
68310
+ addonId: null,
68311
+ access: "view"
68312
+ },
68313
+ "recordEntries.putEntry": {
68314
+ capName: "record-entries",
68315
+ capScope: "system",
68316
+ addonId: null,
68317
+ access: "create"
68318
+ },
67210
68319
  "recording.getAvailability": {
67211
68320
  capName: "recording",
67212
68321
  capScope: "device",
@@ -67507,6 +68616,102 @@ Object.freeze({
67507
68616
  addonId: null,
67508
68617
  access: "view"
67509
68618
  },
68619
+ "records.aggregate": {
68620
+ capName: "records",
68621
+ capScope: "system",
68622
+ addonId: null,
68623
+ access: "view"
68624
+ },
68625
+ "records.allocateId": {
68626
+ capName: "records",
68627
+ capScope: "system",
68628
+ addonId: null,
68629
+ access: "create"
68630
+ },
68631
+ "records.count": {
68632
+ capName: "records",
68633
+ capScope: "system",
68634
+ addonId: null,
68635
+ access: "view"
68636
+ },
68637
+ "records.declareKinds": {
68638
+ capName: "records",
68639
+ capScope: "system",
68640
+ addonId: null,
68641
+ access: "create"
68642
+ },
68643
+ "records.delete": {
68644
+ capName: "records",
68645
+ capScope: "system",
68646
+ addonId: null,
68647
+ access: "delete"
68648
+ },
68649
+ "records.deleteDevice": {
68650
+ capName: "records",
68651
+ capScope: "system",
68652
+ addonId: null,
68653
+ access: "delete"
68654
+ },
68655
+ "records.deleteMany": {
68656
+ capName: "records",
68657
+ capScope: "system",
68658
+ addonId: null,
68659
+ access: "delete"
68660
+ },
68661
+ "records.deleteWhere": {
68662
+ capName: "records",
68663
+ capScope: "system",
68664
+ addonId: null,
68665
+ access: "delete"
68666
+ },
68667
+ "records.get": {
68668
+ capName: "records",
68669
+ capScope: "system",
68670
+ addonId: null,
68671
+ access: "view"
68672
+ },
68673
+ "records.getMany": {
68674
+ capName: "records",
68675
+ capScope: "system",
68676
+ addonId: null,
68677
+ access: "view"
68678
+ },
68679
+ "records.histogram": {
68680
+ capName: "records",
68681
+ capScope: "system",
68682
+ addonId: null,
68683
+ access: "view"
68684
+ },
68685
+ "records.patch": {
68686
+ capName: "records",
68687
+ capScope: "system",
68688
+ addonId: null,
68689
+ access: "create"
68690
+ },
68691
+ "records.put": {
68692
+ capName: "records",
68693
+ capScope: "system",
68694
+ addonId: null,
68695
+ access: "create"
68696
+ },
68697
+ "records.putMany": {
68698
+ capName: "records",
68699
+ capScope: "system",
68700
+ addonId: null,
68701
+ access: "create"
68702
+ },
68703
+ "records.query": {
68704
+ capName: "records",
68705
+ capScope: "system",
68706
+ addonId: null,
68707
+ access: "view"
68708
+ },
68709
+ "records.secretRefs": {
68710
+ capName: "records",
68711
+ capScope: "system",
68712
+ addonId: null,
68713
+ access: "view"
68714
+ },
67510
68715
  "sceneMonitor.captureReference": {
67511
68716
  capName: "scene-monitor",
67512
68717
  capScope: "device",
@@ -67939,6 +69144,48 @@ Object.freeze({
67939
69144
  addonId: null,
67940
69145
  access: "create"
67941
69146
  },
69147
+ "storageAdmin.adoptRecords": {
69148
+ capName: "storage-admin",
69149
+ capScope: "system",
69150
+ addonId: null,
69151
+ access: "create"
69152
+ },
69153
+ "storageAdmin.dropCollection": {
69154
+ capName: "storage-admin",
69155
+ capScope: "system",
69156
+ addonId: null,
69157
+ access: "delete"
69158
+ },
69159
+ "storageAdmin.isAdoptedLegacyTable": {
69160
+ capName: "storage-admin",
69161
+ capScope: "system",
69162
+ addonId: null,
69163
+ access: "view"
69164
+ },
69165
+ "storageAdmin.listKinds": {
69166
+ capName: "storage-admin",
69167
+ capScope: "system",
69168
+ addonId: null,
69169
+ access: "view"
69170
+ },
69171
+ "storageAdmin.listTables": {
69172
+ capName: "storage-admin",
69173
+ capScope: "system",
69174
+ addonId: null,
69175
+ access: "view"
69176
+ },
69177
+ "storageAdmin.readLegacyCollection": {
69178
+ capName: "storage-admin",
69179
+ capScope: "system",
69180
+ addonId: null,
69181
+ access: "view"
69182
+ },
69183
+ "storageAdmin.readRecords": {
69184
+ capName: "storage-admin",
69185
+ capScope: "system",
69186
+ addonId: null,
69187
+ access: "view"
69188
+ },
67942
69189
  "storageEvictable.evict": {
67943
69190
  capName: "storage-evictable",
67944
69191
  capScope: "system",
@@ -68851,6 +70098,12 @@ Object.freeze({
68851
70098
  addonId: null,
68852
70099
  access: "view"
68853
70100
  },
70101
+ "userManagement.migrateRawSecrets": {
70102
+ capName: "user-management",
70103
+ capScope: "system",
70104
+ addonId: null,
70105
+ access: "create"
70106
+ },
68854
70107
  "userManagement.oauthExchangeCode": {
68855
70108
  capName: "user-management",
68856
70109
  capScope: "system",
@@ -71527,6 +72780,37 @@ Object.freeze({
71527
72780
  form: "single",
71528
72781
  optional: false
71529
72782
  }],
72783
+ "records.count": [{
72784
+ name: "deviceId",
72785
+ form: "single",
72786
+ optional: true
72787
+ }],
72788
+ "records.deleteDevice": [{
72789
+ name: "deviceId",
72790
+ form: "single",
72791
+ optional: false
72792
+ }],
72793
+ "records.deleteWhere": [{
72794
+ name: "deviceId",
72795
+ form: "single",
72796
+ optional: true
72797
+ }],
72798
+ "records.histogram": [{
72799
+ name: "deviceId",
72800
+ form: "single",
72801
+ optional: true
72802
+ }],
72803
+ "records.putMany": [{
72804
+ name: "records",
72805
+ form: "object-array",
72806
+ optional: false,
72807
+ itemField: "deviceId"
72808
+ }],
72809
+ "records.query": [{
72810
+ name: "deviceId",
72811
+ form: "single",
72812
+ optional: true
72813
+ }],
71530
72814
  "sceneMonitor.captureReference": [{
71531
72815
  name: "deviceId",
71532
72816
  form: "single",
@@ -71643,6 +72927,17 @@ Object.freeze({
71643
72927
  form: "single",
71644
72928
  optional: false
71645
72929
  }],
72930
+ "storageAdmin.adoptRecords": [{
72931
+ name: "records",
72932
+ form: "object-array",
72933
+ optional: false,
72934
+ itemField: "deviceId"
72935
+ }],
72936
+ "storageAdmin.readRecords": [{
72937
+ name: "deviceId",
72938
+ form: "single",
72939
+ optional: true
72940
+ }],
71646
72941
  "streamBroker.acquireEgressTranscode": [{
71647
72942
  name: "deviceId",
71648
72943
  form: "single",
@@ -73093,4 +74388,4 @@ DEFAULT_NATIVE_LEASE_SETTINGS.admission;
73093
74388
  var MB = 1024 * 1024;
73094
74389
  1024 * MB, 3072 * MB;
73095
74390
  //#endregion
73096
- export { number as A, arrayItemFieldPath as C, toSecretFieldView as D, isSecretMarker as E, string as M, array as O, SECRET_CLEAR as S, isSecretClear as T, requestMountPrefix as _, addonWidgetsSourceCapability as a, errMsg as b, authProviderCapability as c, loginMethodCapability as d, normalizeOrigin as f, pickRequestOrigin as g, parseAppPageLang as h, addonRoutesCapability as i, object as j, boolean as k, buildAddonRouteProvider as l, parseAppFlowRequest as m, APP_REFUSED_PATH as n, advertisedHubOrigins as o, oidcConnectionsCapability as p, SSO_STATE_COOKIE as r, appFlowLocation as s, APP_FLOW_DEFAULT_REDIRECT as t, claimedRequestOrigins as u, resolveIconKey as v, globalSecretScope as w, BaseAddon as x, userPasskeysCapability as y };
74391
+ export { settingsArrayAdoptsFrom as A, SECRET_CLEAR as C, globalSecretScope as D, defineRecordKinds as E, number as F, object as I, string as L, _enum as M, array as N, isSecretClear as O, boolean as P, RecordSecretUnavailableError as S, defineEntryKind as T, requestMountPrefix as _, addonWidgetsSourceCapability as a, errMsg as b, authProviderCapability as c, loginMethodCapability as d, normalizeOrigin as f, pickRequestOrigin as g, parseAppPageLang as h, addonRoutesCapability as i, toSecretFieldView as j, isSecretMarker as k, buildAddonRouteProvider as l, parseAppFlowRequest as m, APP_REFUSED_PATH as n, advertisedHubOrigins as o, oidcConnectionsCapability as p, SSO_STATE_COOKIE as r, appFlowLocation as s, APP_FLOW_DEFAULT_REDIRECT as t, claimedRequestOrigins as u, resolveIconKey as v, arrayItemFieldPath as w, BaseAddon as x, userPasskeysCapability as y };