@camstack/system 1.2.438 → 1.2.440

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.
Files changed (120) hide show
  1. package/dist/addon-runner.js +743 -79
  2. package/dist/addon-runner.mjs +743 -79
  3. package/dist/addon-utils.js +1 -1
  4. package/dist/addon-utils.mjs +1 -1
  5. package/dist/{agent-https-BZIwS4xF.js → agent-https-DlpTMDqA.js} +252 -22
  6. package/dist/{agent-https-BPfHrI4c.mjs → agent-https-U0d4uvn2.mjs} +211 -23
  7. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  8. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  9. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  10. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  11. package/dist/builtins/alerts/alerts.addon.js +1 -1
  12. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  13. package/dist/builtins/autotrack/index.js +1 -1
  14. package/dist/builtins/autotrack/index.mjs +1 -1
  15. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  16. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  17. package/dist/builtins/calendars/calendars.addon.js +1 -1
  18. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  19. package/dist/builtins/camera-grid/index.js +1 -1
  20. package/dist/builtins/camera-grid/index.mjs +1 -1
  21. package/dist/builtins/composer/composer.addon.js +2 -2
  22. package/dist/builtins/composer/composer.addon.mjs +2 -2
  23. package/dist/builtins/console-logging/index.js +1 -1
  24. package/dist/builtins/console-logging/index.mjs +1 -1
  25. package/dist/builtins/core-blocks/block-settings-store.d.ts +1 -1
  26. package/dist/builtins/core-blocks/core-blocks.addon.js +77 -11
  27. package/dist/builtins/core-blocks/core-blocks.addon.mjs +77 -12
  28. package/dist/builtins/core-blocks/index.mjs +1 -1
  29. package/dist/builtins/device-manager/device-manager.addon.js +197 -60
  30. package/dist/builtins/device-manager/device-manager.addon.mjs +196 -61
  31. package/dist/builtins/device-manager/device-removal-hooks.d.ts +0 -11
  32. package/dist/builtins/device-manager/device-tombstone-store.d.ts +12 -2
  33. package/dist/builtins/hub-forwarder/index.js +1 -1
  34. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  35. package/dist/builtins/keychain/index.js +29 -11
  36. package/dist/builtins/keychain/index.mjs +29 -11
  37. package/dist/builtins/keychain/keychain-service.d.ts +8 -0
  38. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  39. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  40. package/dist/builtins/local-auth/local-auth.addon.js +2 -2
  41. package/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  42. package/dist/builtins/local-network/local-network.addon.js +7 -2
  43. package/dist/builtins/local-network/local-network.addon.mjs +7 -2
  44. package/dist/builtins/loki-logging/index.js +1 -1
  45. package/dist/builtins/loki-logging/index.mjs +1 -1
  46. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  47. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  48. package/dist/builtins/platform-probe/index.js +1 -1
  49. package/dist/builtins/platform-probe/index.mjs +1 -1
  50. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  51. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  52. package/dist/builtins/snapshot/index.js +1 -1
  53. package/dist/builtins/snapshot/index.mjs +1 -1
  54. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  55. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  56. package/dist/builtins/sqlite-storage/index.js +1 -1
  57. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  58. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +38 -7
  59. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +69 -3
  60. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +69 -3
  61. package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +31 -0
  62. package/dist/builtins/storage-orchestrator/hub-settings-forward.d.ts +3 -3
  63. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +4 -4
  64. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +4 -4
  65. package/dist/builtins/system-config/system-config.addon.js +4 -4
  66. package/dist/builtins/system-config/system-config.addon.mjs +285 -285
  67. package/dist/builtins/winston-logging/index.js +1 -1
  68. package/dist/builtins/winston-logging/index.mjs +1 -1
  69. package/dist/{composition-sources-DpHGCjdL.mjs → composition-sources-CS0D7imL.mjs} +1 -1
  70. package/dist/{composition-sources-DI3Z83vG.js → composition-sources-cBG8fBTu.js} +1 -1
  71. package/dist/{constants-DQK705Sb.mjs → constants-CIzPjw7L.mjs} +1 -1
  72. package/dist/{constants-wkcn5Ij3.js → constants-CRI3QzT4.js} +1 -1
  73. package/dist/{device-ca-DvIZjXIl.mjs → device-ca-DLKXYseS.mjs} +2 -2
  74. package/dist/{device-ca-BSvkXqyI.js → device-ca-DNHjts4_.js} +2 -2
  75. package/dist/{dist-Dc8GKC5H.mjs → dist-9fcsrFU3.mjs} +271 -32
  76. package/dist/{dist-GgG-7amw.js → dist-BKhlcYz6.js} +288 -31
  77. package/dist/file-host-worker.js +1 -1
  78. package/dist/file-host-worker.mjs +1 -1
  79. package/dist/{hub-mdns-ciao-CBLvq2oj.js → hub-mdns-ciao-3Zc9G9MS.js} +377 -69
  80. package/dist/{hub-mdns-ciao-DMlQTdPU.mjs → hub-mdns-ciao-Dy2YjRqC.mjs} +344 -72
  81. package/dist/index.js +372 -339
  82. package/dist/index.mjs +361 -341
  83. package/dist/kernel/addon-settings-store.d.ts +43 -0
  84. package/dist/kernel/config-manager.d.ts +0 -19
  85. package/dist/kernel/device-settings-store.d.ts +74 -0
  86. package/dist/kernel/legacy-blob-guard.d.ts +58 -0
  87. package/dist/kernel/moleculer/runner-addon-settings.d.ts +34 -0
  88. package/dist/kernel/moleculer/runner-device-settings.d.ts +39 -0
  89. package/dist/kernel/prefix-walk.d.ts +39 -0
  90. package/dist/kernel/sections-store.d.ts +20 -0
  91. package/dist/kernel/settings-door-view.d.ts +2 -2
  92. package/dist/kernel/settings-view-types.d.ts +5 -30
  93. package/dist/kernel/store-settings-view.d.ts +0 -3
  94. package/dist/{lib-NNxHSOIE.js → lib-8oZrELLm.js} +1 -1
  95. package/dist/{lib-BeGzVQcd.mjs → lib-DK38ompL.mjs} +1 -1
  96. package/dist/prefix-range-D_KueXbQ.js +27 -0
  97. package/dist/prefix-range-Dl0znowN.mjs +22 -0
  98. package/dist/prefix-walk-DAOBSyH1.mjs +88 -0
  99. package/dist/prefix-walk-Dv6MLZlM.js +99 -0
  100. package/dist/{restore-archive-CTRz8v9o.js → restore-archive-49aZwkp8.js} +1 -1
  101. package/dist/{restore-archive-DPg9duVY.mjs → restore-archive-DgvDecXM.mjs} +82 -82
  102. package/dist/{retired-settings-keys-Is0zO8gX.mjs → retired-settings-keys-Bhwe4ymb.mjs} +2 -2
  103. package/dist/{retired-settings-keys-Dr_4lfKu.js → retired-settings-keys-D_VwZiDt.js} +10 -4
  104. package/dist/tls/agent-https.d.ts +2 -2
  105. package/dist/tls/boot-tls.d.ts +6 -0
  106. package/dist/tls/cert-evaluation.d.ts +1 -1
  107. package/dist/tls/cert-issue.d.ts +5 -1
  108. package/dist/tls/cert-manager.d.ts +18 -0
  109. package/dist/tls/cert-name-constraints.d.ts +53 -0
  110. package/dist/tls/index.d.ts +5 -4
  111. package/dist/tls/tls-actions.d.ts +27 -7
  112. package/dist/tls/tls-status.d.ts +22 -0
  113. package/dist/tls/uploaded-cert.d.ts +36 -4
  114. package/dist/{wal-maintenance-Bx3lcVA7.mjs → wal-maintenance-BZGmF-3U.mjs} +0 -0
  115. package/dist/{wal-maintenance-mjB2i-VR.js → wal-maintenance-C041zn6V.js} +0 -0
  116. package/dist/{x509.es-r7Ht1thA.js → x509.es-C4cOo48M.js} +36 -0
  117. package/dist/{x509.es-CDvj67p1.mjs → x509.es-DK__ETIe.mjs} +1 -1
  118. package/package.json +7 -2
  119. package/dist/{custom-action-registry-Bf_YnagS.js → custom-action-registry-BKmoaqG0.js} +1 -1
  120. package/dist/{custom-action-registry-BQnbN0DP.mjs → custom-action-registry-CyUuhATc.mjs} +1 -1
@@ -718,7 +718,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
718
718
  return EventCategory;
719
719
  }({});
720
720
  //#endregion
721
- //#region ../types/dist/sleep-DRqxtc0C.mjs
721
+ //#region ../types/dist/sleep-bwsTj221.mjs
722
722
  /**
723
723
  * The audio chunk plane's byte format, and the ONE expansion from a coded
724
724
  * window to float samples (D455).
@@ -2079,7 +2079,6 @@ function createHandle(raw, opts) {
2079
2079
  const writeAddon = (patch) => write("addon", opts.addonTree(), void 0, patch, () => readStoredAddonBlob(raw), (p) => raw.writeAddonStore(p));
2080
2080
  const readAddonStoreResult = raw.readAddonStoreResult;
2081
2081
  const readAddonStoreKeyResult = raw.readAddonStoreKeyResult;
2082
- const readDeviceStoreBatch = raw.readDeviceStoreBatch;
2083
2082
  const overrides = {
2084
2083
  readAddonStore: async () => resolveRead("addon", await raw.readAddonStore()),
2085
2084
  ...readAddonStoreResult !== void 0 ? { readAddonStoreResult: async () => {
@@ -2103,12 +2102,12 @@ function createHandle(raw, opts) {
2103
2102
  };
2104
2103
  } } : {},
2105
2104
  readDeviceStore: async (deviceId) => resolveRead(`device:${deviceId}`, await raw.readDeviceStore(deviceId)),
2106
- ...readDeviceStoreBatch !== void 0 ? { readDeviceStoreBatch: async (deviceIds) => {
2107
- const rows = await readDeviceStoreBatch.call(raw, deviceIds);
2105
+ readDeviceStoreBatch: async (deviceIds) => {
2106
+ const rows = await raw.readDeviceStoreBatch(deviceIds);
2108
2107
  const out = /* @__PURE__ */ new Map();
2109
2108
  for (const [deviceId, blob] of rows) out.set(deviceId, await resolveRead(`device:${deviceId}`, blob));
2110
2109
  return out;
2111
- } } : {},
2110
+ },
2112
2111
  writeAddonStore: async (patch) => {
2113
2112
  await writeAddon(patch);
2114
2113
  },
@@ -2948,7 +2947,7 @@ var BaseAddon = class {
2948
2947
  return this._addonSecretTree;
2949
2948
  }
2950
2949
  deviceSecretTree() {
2951
- this._deviceSecretTree ??= secretTreeFromSchema(this.deviceSettingsSchema());
2950
+ this._deviceSecretTree ??= mergeSecretStatePaths(secretTreeFromSchema(this.deviceSettingsSchema()), this.secretStatePaths);
2952
2951
  return this._deviceSecretTree;
2953
2952
  }
2954
2953
  /**
@@ -3024,42 +3023,135 @@ var BaseAddon = class {
3024
3023
  this[timerOf] = timer;
3025
3024
  }
3026
3025
  /**
3027
- * Wrap `ctx.settings.readAddonStore()` with a short retry budget so a
3028
- * transient settings-store outage (mid-restart of sqlite-settings, tsx-watch
3029
- * swap, or any race where the SqliteSettingsBackend is between shutdown and
3030
- * re-initialize) doesn't propagate up into `initialize()` and leave the
3026
+ * Wrap `ctx.settings.readAddonStore()` with a retry budget so a transient
3027
+ * settings-store outage doesn't propagate up into `initialize()` and leave the
3031
3028
  * addon permanently broken.
3032
3029
  *
3033
- * Retry only the two known infra fingerprints. Anything else propagates so
3034
- * real bugs surface immediately. After the budget expires we fall back to
3035
- * `{}` (defaults) — the addon's first successful patch will rehydrate.
3030
+ * Two kinds of outage, two budgets:
3031
+ * - the store's own restart fingerprints (`SqliteSettingsBackend not
3032
+ * initialized`, `provider not available`): a short budget, then the addon
3033
+ * falls back to `{}` (defaults) - its first successful patch rehydrates;
3034
+ * - a TRANSPORT failure (the hub is restarting while this runner boots:
3035
+ * `discovery deadline exceeded`, `parent could not route`, a refused or
3036
+ * timed-out connection). Since D870 a runner's settings read THROWS instead
3037
+ * of answering `{}`, so without a budget a hub restart ends in a respawn
3038
+ * loop. A long, bounded budget; only after it the error propagates - the
3039
+ * addon never runs on defaults for a store it could not ask.
3040
+ * Anything else propagates immediately so real bugs surface.
3036
3041
  */
3037
3042
  async readAddonStoreWithRetry() {
3038
3043
  const settings = this.rawSettings();
3039
3044
  if (!settings) return {};
3040
- const delaysMs = [
3041
- 150,
3042
- 350,
3043
- 600,
3044
- 900
3045
- ];
3046
3045
  let lastErr;
3047
- for (let attempt = 0; attempt <= delaysMs.length; attempt++) try {
3046
+ for (let attempt = 0;; attempt++) try {
3048
3047
  const stored = await settings.readAddonStore() ?? {};
3049
3048
  this.settingsStoreReady = true;
3050
3049
  return stored;
3051
3050
  } catch (err) {
3052
3051
  lastErr = err;
3053
- const msg = err instanceof Error ? err.message : String(err);
3054
- if (!(msg.includes("SqliteSettingsBackend not initialized") || msg.includes("provider not available"))) throw err;
3055
- if (attempt === delaysMs.length) break;
3056
- await new Promise((r) => setTimeout(r, delaysMs[attempt]));
3052
+ const kind = classifyStoreError(err);
3053
+ if (kind === "permanent") throw err;
3054
+ const delay = (kind === "transport" ? TRANSPORT_RETRY_DELAYS_MS : RESTART_RETRY_DELAYS_MS)[attempt];
3055
+ if (delay === void 0) {
3056
+ if (kind === "transport") throw err;
3057
+ break;
3058
+ }
3059
+ await new Promise((r) => setTimeout(r, delay));
3057
3060
  }
3058
3061
  this.settingsStoreReady = false;
3059
3062
  this._ctx?.logger?.warn?.("readAddonStore: settings-store unavailable after retries — using defaults", { meta: { error: lastErr instanceof Error ? lastErr.message : String(lastErr) } });
3060
3063
  return {};
3061
3064
  }
3062
3065
  };
3066
+ /** The settings store's own restart fingerprints. */
3067
+ var RESTART_RETRY_DELAYS_MS = [
3068
+ 150,
3069
+ 350,
3070
+ 600,
3071
+ 900
3072
+ ];
3073
+ /** A hub restarting under a booting runner: ~100 s in total. */
3074
+ var TRANSPORT_RETRY_DELAYS_MS = [
3075
+ 150,
3076
+ 350,
3077
+ 600,
3078
+ 900,
3079
+ 2e3,
3080
+ 5e3,
3081
+ 1e4,
3082
+ 2e4,
3083
+ 3e4,
3084
+ 3e4
3085
+ ];
3086
+ var RESTART_FINGERPRINTS = ["SqliteSettingsBackend not initialized", "provider not available"];
3087
+ /** Node / socket error codes of a connection that did not happen or broke. */
3088
+ var TRANSPORT_CODES = new Set([
3089
+ "ECONNREFUSED",
3090
+ "ECONNRESET",
3091
+ "ETIMEDOUT",
3092
+ "EPIPE",
3093
+ "EHOSTUNREACH",
3094
+ "ENETUNREACH"
3095
+ ]);
3096
+ /** tRPC error codes that mean "the other side is not answering now", not "your call is wrong". */
3097
+ var UNAVAILABLE_TRPC_CODES = new Set([
3098
+ "TIMEOUT",
3099
+ "SERVICE_UNAVAILABLE",
3100
+ "BAD_GATEWAY",
3101
+ "GATEWAY_TIMEOUT"
3102
+ ]);
3103
+ /** The exact phrases OUR transport raises when it cannot reach the hub. */
3104
+ var TRANSPORT_PHRASES = [
3105
+ "discovery deadline exceeded",
3106
+ "parent could not route child unowned cap call",
3107
+ "UDS request timed out after",
3108
+ "channel closed"
3109
+ ];
3110
+ /** Moleculer error `type`s of a call that could not be served right now. */
3111
+ var MOLECULER_TRANSIENT_TYPES = new Set([
3112
+ "REQUEST_TIMEOUT",
3113
+ "SERVICE_NOT_FOUND",
3114
+ "SERVICE_NOT_AVAILABLE",
3115
+ "REQUEST_REJECTED",
3116
+ "BROKER_DISCONNECTED"
3117
+ ]);
3118
+ function stringProp(value, key) {
3119
+ if (typeof value !== "object" || value === null) return void 0;
3120
+ const found = Reflect.get(value, key);
3121
+ return typeof found === "string" ? found : void 0;
3122
+ }
3123
+ /** The code an error carries: its own, its cause's, or a tRPC `data.code`. */
3124
+ function errorCode(err) {
3125
+ const out = {};
3126
+ const cause = typeof err === "object" && err !== null ? Reflect.get(err, "cause") : void 0;
3127
+ const data = typeof err === "object" && err !== null ? Reflect.get(err, "data") : void 0;
3128
+ const node = stringProp(err, "code") ?? stringProp(cause, "code");
3129
+ if (node !== void 0) out.node = node;
3130
+ const trpc = stringProp(data, "code");
3131
+ if (trpc !== void 0) out.trpc = trpc;
3132
+ return out;
3133
+ }
3134
+ /**
3135
+ * Is a settings read failure worth retrying, and with which budget? Only
3136
+ * EXPLICIT signals count: a socket error code, a tRPC "unavailable" code, or
3137
+ * one of the exact phrases our own transport raises. A message that merely
3138
+ * contains "timed out" or "unreachable" is not evidence of anything, and
3139
+ * `settings store not wired` is a wiring bug that retrying cannot fix.
3140
+ */
3141
+ function classifyStoreError(err) {
3142
+ const message = err instanceof Error ? err.message : String(err);
3143
+ if (RESTART_FINGERPRINTS.some((f) => message.includes(f))) return "restart";
3144
+ const code = errorCode(err);
3145
+ if (code.node !== void 0 && TRANSPORT_CODES.has(code.node)) return "transport";
3146
+ if (code.trpc !== void 0 && UNAVAILABLE_TRPC_CODES.has(code.trpc)) return "transport";
3147
+ if (typeof err === "object" && err !== null) {
3148
+ if (Reflect.get(err, "retryable") === true) return "transport";
3149
+ const type = stringProp(err, "type");
3150
+ if (type !== void 0 && MOLECULER_TRANSIENT_TYPES.has(type)) return "transport";
3151
+ }
3152
+ if (TRANSPORT_PHRASES.some((f) => message.includes(f))) return "transport";
3153
+ return "permanent";
3154
+ }
3063
3155
  /**
3064
3156
  * Collect the keys of every field marked `perNode: true`, recursing into
3065
3157
  * layout containers (`group` fields and `sub-tabs` tabs) the same way
@@ -9321,11 +9413,10 @@ var ClipModelMetaSchema = zod.z.object({
9321
9413
  /**
9322
9414
  * The `vector-store` index this model's vectors live in. ONE feature space
9323
9415
  * per index: two models share an index only when their vectors are ranked
9324
- * against each other, which for CLIP means never across families. MobileCLIP
9325
- * S1 and S2 share `object-clip` for history (separated by the row's
9326
- * `modelId`); any other model gets its own.
9416
+ * against each other, which for CLIP means never across families. Every
9417
+ * model gets its own.
9327
9418
  */
9328
- vectorIndex: zod.z.string().regex(/^object-clip(-[a-z0-9][a-z0-9-]*)?$/),
9419
+ vectorIndex: zod.z.string().regex(/^object-clip-[a-z0-9][a-z0-9-]*$/),
9329
9420
  /**
9330
9421
  * The text encoder's tokenizer, a declared SIBLING file of its onnx. The name
9331
9422
  * must be unique per tokenizer: every model's siblings land in ONE flat
@@ -16169,6 +16260,89 @@ id: zod.z.union([zod.z.string(), zod.z.number()]) }), {
16169
16260
  })
16170
16261
  }
16171
16262
  };
16263
+ /** One table of the settings database. */
16264
+ var StorageTableSchema = zod.z.object({
16265
+ /** The table's full name, e.g. `recorder:addon-settings` or `addon-device-settings`. */
16266
+ name: zod.z.string(),
16267
+ /** The owner prefix of a scoped name (`recorder` for `recorder:addon-settings`), else null. */
16268
+ owner: zod.z.string().nullable(),
16269
+ rows: zod.z.number().int().nonnegative(),
16270
+ /** Bytes the table's pages occupy (`dbstat`); null when the engine cannot measure. */
16271
+ bytes: zod.z.number().int().nonnegative().nullable(),
16272
+ /** Declared by an addon since this engine process started (a running addon claims it). */
16273
+ declaredThisBoot: zod.z.boolean()
16274
+ });
16275
+ /**
16276
+ * The collections retired by exact name: the D870 ones (their data became keys
16277
+ * of the camera's settings) and the three D871 leftovers (the `stats-5m` tables
16278
+ * superseded by `stats-5m-v2`, and the unread `vec_object_clip`). No addon
16279
+ * declares any of them any more; the engine still refuses one a running addon
16280
+ * declared this boot. `dropCollection` may remove these, the
16281
+ * per-addon scoped `addon-settings` / `addon-devices` / `sections` tables, and
16282
+ * the tables of owners that are no longer installed - nothing else.
16283
+ */
16284
+ var STORAGE_ADMIN_MOVED_COLLECTIONS = [
16285
+ "stream-broker:probe-snapshots",
16286
+ "stream-broker:profile-map",
16287
+ "stream-broker:rtsp-tokens",
16288
+ "notification-center:device-mutes",
16289
+ "recorder:recording-configs",
16290
+ "pipeline-orchestrator:device-features",
16291
+ "pipeline-analytics:stats-5m",
16292
+ "pipeline-orchestrator:stats-5m",
16293
+ "vec_object_clip"
16294
+ ];
16295
+ /** The per-addon blob tables a scoped name may carry. */
16296
+ var STORAGE_ADMIN_SCOPED_BASES = [
16297
+ "addon-settings",
16298
+ "addon-devices",
16299
+ "sections"
16300
+ ];
16301
+ /**
16302
+ * storage-admin - the operator's maintenance reach into the settings database:
16303
+ * list its tables, drop one that nothing owns any more (D870).
16304
+ *
16305
+ * Hub-only, internal and `auth: 'admin'` explicitly (`internal` does not gate
16306
+ * the mount, see `data-store-provider`). Both methods are LOGGED by the engine
16307
+ * with the table and the counts. `dropCollection` is a ONE-SHOT of the D870
16308
+ * migration and is marked for removal once the last hub has run it.
16309
+ *
16310
+ * `listTables` is READ-ONLY: it never creates a table, which `count` and `get`
16311
+ * on an undeclared scoped name used to do.
16312
+ */
16313
+ var storageAdminCapability = {
16314
+ name: "storage-admin",
16315
+ scope: "system",
16316
+ mode: "singleton",
16317
+ internal: true,
16318
+ methods: {
16319
+ /**
16320
+ * Every table of the settings database with its row count and size,
16321
+ * optionally only those owned by `ownerPrefix`. Reads only.
16322
+ */
16323
+ listTables: method(zod.z.object({ ownerPrefix: zod.z.string().min(1).optional() }), zod.z.object({ tables: zod.z.array(StorageTableSchema) }), { auth: "admin" }),
16324
+ /**
16325
+ * Drop one table. REFUSES when an addon declared it since the engine
16326
+ * started (a running addon still owns it), when it is an engine or
16327
+ * canonical table, when it does not exist, or when its row count is not
16328
+ * `expectRows` - the caller states what it believes it is deleting. The
16329
+ * engine also refuses anything but `<owner>:(addon-settings|addon-devices|
16330
+ * sections)`, the retired collections by name, and tables of owners that
16331
+ * are not installed (and refuses when it cannot read the installed list).
16332
+ * Removed with the D870 migration script once the last hub ran it.
16333
+ */
16334
+ dropCollection: method(zod.z.object({
16335
+ collection: zod.z.string().min(1),
16336
+ expectRows: zod.z.number().int().nonnegative()
16337
+ }), zod.z.object({
16338
+ dropped: zod.z.literal(true),
16339
+ rows: zod.z.number().int().nonnegative()
16340
+ }), {
16341
+ kind: "mutation",
16342
+ auth: "admin"
16343
+ })
16344
+ }
16345
+ };
16172
16346
  /**
16173
16347
  * `keychain` — the hub's encrypted store of secret values (D787).
16174
16348
  *
@@ -16905,6 +17079,24 @@ var keychainAdminCapability = {
16905
17079
  auth: "admin",
16906
17080
  caller: "required"
16907
17081
  }),
17082
+ /**
17083
+ * Store a value an operator tool carries over from a retired store at an
17084
+ * addon's own ref (`secret://<owner>/<scope>/<path>`) and answer the ref -
17085
+ * the D870 migration moves a camera's restream tokens this way, so they
17086
+ * never sit in a settings row as plaintext. Audited as the operator; the
17087
+ * caller then writes the MARKER of the ref where the value used to be.
17088
+ */
17089
+ importSecret: method(zod.z.object({
17090
+ ref: zod.z.string().min(1),
17091
+ value: zod.z.string().min(1)
17092
+ }), zod.z.object({
17093
+ ref: zod.z.string(),
17094
+ version: zod.z.number().int()
17095
+ }), {
17096
+ kind: "mutation",
17097
+ auth: "admin",
17098
+ caller: "required"
17099
+ }),
16908
17100
  /** Delete refs no owner points at any more. Re-checked here; `unknown` is kept. */
16909
17101
  deleteOrphans: method(zod.z.object({ refs: zod.z.array(zod.z.string().min(1)).max(1e3) }), zod.z.object({
16910
17102
  deleted: zod.z.array(zod.z.string()).readonly(),
@@ -61888,7 +62080,19 @@ var TlsStatusSchema = zod.z.object({
61888
62080
  sans: zod.z.array(zod.z.string()),
61889
62081
  caCertPem: zod.z.string().nullable(),
61890
62082
  reissueError: zod.z.string().nullable(),
61891
- restartRequired: zod.z.boolean()
62083
+ restartRequired: zod.z.boolean(),
62084
+ /** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
62085
+ caMissing: zod.z.boolean(),
62086
+ /** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
62087
+ localCaConstrained: zod.z.boolean().nullable(),
62088
+ /** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
62089
+ caReplacedAt: zod.z.string().nullable(),
62090
+ /** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
62091
+ storedUpload: zod.z.object({
62092
+ leafFingerprintSha256: zod.z.string(),
62093
+ validTo: zod.z.string(),
62094
+ hasCa: zod.z.boolean()
62095
+ }).nullable()
61892
62096
  });
61893
62097
  var localNetworkCapability = {
61894
62098
  name: "local-network",
@@ -62082,7 +62286,10 @@ var localNetworkCapability = {
62082
62286
  kind: "mutation",
62083
62287
  auth: "admin"
62084
62288
  }),
62085
- /** Replace the served material with operator-supplied PEMs. */
62289
+ /**
62290
+ * Replace the served material with operator-supplied PEMs. A certificate that does not lead
62291
+ * to a public CA must come with its CA certificate, validated and kept for Download CA (D873).
62292
+ */
62086
62293
  uploadCertificate: method(zod.z.object({
62087
62294
  certPem: zod.z.string().min(1),
62088
62295
  keyPem: zod.z.string().min(1),
@@ -62093,7 +62300,14 @@ var localNetworkCapability = {
62093
62300
  }),
62094
62301
  /** The local CA PEM, or empty when there is none to download. */
62095
62302
  downloadCa: method(zod.z.void(), zod.z.object({ pem: zod.z.string() })),
62096
- /** Drop uploaded material and return to the generated local CA. */
62303
+ /**
62304
+ * Serve the kept upload again after "Revert to generated" (D873). Refused when none is kept.
62305
+ */
62306
+ useStoredUploadedCertificate: method(zod.z.void(), TlsStatusSchema, {
62307
+ kind: "mutation",
62308
+ auth: "admin"
62309
+ }),
62310
+ /** Return to the generated local CA. The uploaded certificate stays stored (D873). */
62097
62311
  revertToGeneratedCertificate: method(zod.z.void(), TlsStatusSchema, {
62098
62312
  kind: "mutation",
62099
62313
  auth: "admin"
@@ -76086,6 +76300,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
76086
76300
  addonId: null,
76087
76301
  access: "create"
76088
76302
  },
76303
+ "keychainAdmin.importSecret": {
76304
+ capName: "keychain-admin",
76305
+ capScope: "system",
76306
+ addonId: null,
76307
+ access: "create"
76308
+ },
76089
76309
  "keychainAdmin.listAudit": {
76090
76310
  capName: "keychain-admin",
76091
76311
  capScope: "system",
@@ -76482,6 +76702,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
76482
76702
  addonId: null,
76483
76703
  access: "create"
76484
76704
  },
76705
+ "localNetwork.useStoredUploadedCertificate": {
76706
+ capName: "local-network",
76707
+ capScope: "system",
76708
+ addonId: null,
76709
+ access: "create"
76710
+ },
76485
76711
  "lockControl.getStatus": {
76486
76712
  capName: "lock-control",
76487
76713
  capScope: "device",
@@ -79866,6 +80092,18 @@ var METHOD_ACCESS_MAP = Object.freeze({
79866
80092
  addonId: null,
79867
80093
  access: "create"
79868
80094
  },
80095
+ "storageAdmin.dropCollection": {
80096
+ capName: "storage-admin",
80097
+ capScope: "system",
80098
+ addonId: null,
80099
+ access: "delete"
80100
+ },
80101
+ "storageAdmin.listTables": {
80102
+ capName: "storage-admin",
80103
+ capScope: "system",
80104
+ addonId: null,
80105
+ access: "view"
80106
+ },
79869
80107
  "storageEvictable.evict": {
79870
80108
  capName: "storage-evictable",
79871
80109
  capScope: "system",
@@ -81510,6 +81748,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
81510
81748
  snapshotCapability,
81511
81749
  ssoBridgeCapability,
81512
81750
  storageCapability,
81751
+ storageAdminCapability,
81513
81752
  storageEvictableCapability,
81514
81753
  storageMigrationCapability,
81515
81754
  storageOccupancyCapability,
@@ -86238,6 +86477,18 @@ Object.defineProperty(exports, "STORAGE_ACCESS_FALLBACK", {
86238
86477
  return STORAGE_ACCESS_FALLBACK;
86239
86478
  }
86240
86479
  });
86480
+ Object.defineProperty(exports, "STORAGE_ADMIN_MOVED_COLLECTIONS", {
86481
+ enumerable: true,
86482
+ get: function() {
86483
+ return STORAGE_ADMIN_MOVED_COLLECTIONS;
86484
+ }
86485
+ });
86486
+ Object.defineProperty(exports, "STORAGE_ADMIN_SCOPED_BASES", {
86487
+ enumerable: true,
86488
+ get: function() {
86489
+ return STORAGE_ADMIN_SCOPED_BASES;
86490
+ }
86491
+ });
86241
86492
  Object.defineProperty(exports, "STREAM_PROFILE_META", {
86242
86493
  enumerable: true,
86243
86494
  get: function() {
@@ -87174,6 +87425,12 @@ Object.defineProperty(exports, "splitTranslationRef", {
87174
87425
  return splitTranslationRef;
87175
87426
  }
87176
87427
  });
87428
+ Object.defineProperty(exports, "storageAdminCapability", {
87429
+ enumerable: true,
87430
+ get: function() {
87431
+ return storageAdminCapability;
87432
+ }
87433
+ });
87177
87434
  Object.defineProperty(exports, "storageCapability", {
87178
87435
  enumerable: true,
87179
87436
  get: function() {
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Cek0wNdY.js");
2
- const require_wal_maintenance = require("./wal-maintenance-mjB2i-VR.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-C041zn6V.js");
3
3
  let node_worker_threads = require("node:worker_threads");
4
4
  //#region src/builtins/sqlite-storage/file-host-worker.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { C as callControl, E as controlTargetOf, T as callVector, _ as collectTransferables, a as WalMaintenance, b as isFileHostWorkerData, c as SqliteSettingsBackend, h as serializeError, o as createVectorIndex, s as vectorProviderOf, w as callData, x as trustInput, y as isFileHostRequest } from "./wal-maintenance-Bx3lcVA7.mjs";
1
+ import { C as callData, S as callControl, T as controlTargetOf, a as WalMaintenance, b as trustInput, c as SqliteSettingsBackend, g as collectTransferables, m as serializeError, o as createVectorIndex, s as vectorProviderOf, v as isFileHostRequest, w as callVector, y as isFileHostWorkerData } from "./wal-maintenance-BZGmF-3U.mjs";
2
2
  import { parentPort, threadId, workerData } from "node:worker_threads";
3
3
  //#region src/builtins/sqlite-storage/file-host-worker.ts
4
4
  /**