@camstack/server 1.2.740 → 1.2.741

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 (88) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api/trpc/generated-cap-routers.js +9 -0
  3. package/package.json +14 -16
  4. package/system/dist/{agent-https-DcYKH3q_.mjs → agent-https-BtTMjLgk.mjs} +1 -1
  5. package/system/dist/{agent-https-DXWlu1kP.js → agent-https-CNf7_i1z.js} +1 -1
  6. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  7. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  8. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  9. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  10. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  11. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  12. package/system/dist/builtins/autotrack/index.js +1 -1
  13. package/system/dist/builtins/autotrack/index.mjs +1 -1
  14. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  15. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  16. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  17. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  18. package/system/dist/builtins/camera-grid/index.js +1 -1
  19. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  20. package/system/dist/builtins/composer/composer.addon.js +3 -3
  21. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  22. package/system/dist/builtins/console-logging/index.js +1 -1
  23. package/system/dist/builtins/console-logging/index.mjs +1 -1
  24. package/system/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  25. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  26. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  27. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  28. package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
  29. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  30. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  31. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  32. package/system/dist/builtins/keychain/index.js +3 -3
  33. package/system/dist/builtins/keychain/index.mjs +3 -3
  34. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  35. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  36. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  37. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  38. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  39. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  40. package/system/dist/builtins/loki-logging/index.js +127 -32
  41. package/system/dist/builtins/loki-logging/index.mjs +127 -32
  42. package/system/dist/builtins/loki-logging/loki-logging.addon.d.ts +8 -0
  43. package/system/dist/builtins/loki-logging/loki-record-kinds.d.ts +2 -0
  44. package/system/dist/builtins/loki-logging/migrations/index.d.ts +4 -1
  45. package/system/dist/builtins/loki-logging/migrations/registry-toggle-to-record.d.ts +26 -0
  46. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  47. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  48. package/system/dist/builtins/platform-probe/index.js +1 -1
  49. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  50. package/system/dist/builtins/record-entries/index.js +1 -1
  51. package/system/dist/builtins/record-entries/index.mjs +1 -1
  52. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  53. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  54. package/system/dist/builtins/snapshot/index.js +1 -1
  55. package/system/dist/builtins/snapshot/index.mjs +1 -1
  56. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  57. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  58. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  59. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  60. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  61. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  62. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  63. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  64. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  65. package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
  66. package/system/dist/builtins/winston-logging/index.js +1 -1
  67. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  68. package/system/dist/{composition-sources-BfWnLt2j.js → composition-sources-D9GBwT5d.js} +1 -1
  69. package/system/dist/{composition-sources-BNa_vU07.mjs → composition-sources-DUmnnLrw.mjs} +1 -1
  70. package/system/dist/{constants-DCYUT12P.mjs → constants-BkiDA8Cf.mjs} +1 -1
  71. package/system/dist/{constants-DugYIgQF.js → constants-Cy5svHxz.js} +1 -1
  72. package/system/dist/{device-ca-CFs0PY9S.js → device-ca-CxlqxrvG.js} +1 -1
  73. package/system/dist/{device-ca-BnBFt1ex.mjs → device-ca-Cxu7j6aY.mjs} +1 -1
  74. package/system/dist/{dist-BF9MiiHX.mjs → dist-C5sQPOZX.mjs} +100 -0
  75. package/system/dist/{dist-DwI4ifnv.js → dist-Cyc4oyGh.js} +100 -0
  76. package/system/dist/file-host-worker.js +1 -1
  77. package/system/dist/file-host-worker.mjs +1 -1
  78. package/system/dist/{hub-mdns-ciao-CnSqBHO9.mjs → hub-mdns-ciao-CTPWSgwo.mjs} +2 -2
  79. package/system/dist/{hub-mdns-ciao-Dsk7HF0G.js → hub-mdns-ciao-YxQ97aHW.js} +2 -2
  80. package/system/dist/index.js +7 -7
  81. package/system/dist/index.mjs +7 -7
  82. package/system/dist/{restore-archive-CDgSTubW.mjs → restore-archive-08Uthry1.mjs} +1 -1
  83. package/system/dist/{restore-archive-CnG6nyar.js → restore-archive-b5rBXY1e.js} +1 -1
  84. package/system/dist/{retention-voCdtR4h.js → retention-DWCHp91p.js} +1 -1
  85. package/system/dist/{retention-csYEu0l3.mjs → retention-i8aZ6vE5.mjs} +1 -1
  86. package/system/dist/{wal-maintenance-CTsOr0e7.mjs → wal-maintenance-CEi8PqMh.mjs} +0 -0
  87. package/system/dist/{wal-maintenance-DrLnLCGO.js → wal-maintenance-DNE7RTcS.js} +0 -0
  88. package/system/package.json +1 -1
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DwI4ifnv.js");
6
+ const require_dist = require("../../dist-Cyc4oyGh.js");
7
7
  const require_log_read_filter = require("../../log-read-filter-Bi066jwU.js");
8
8
  let zod = require("zod");
9
9
  //#region src/builtins/loki-logging/loki-payload.ts
@@ -649,7 +649,8 @@ var LokiDestinationBodySchema = zod.z.object({
649
649
  password: zod.z.string().optional().meta({ secret: true }),
650
650
  batchIntervalMs: zod.z.number().int().min(LOKI_BOUNDS.batchIntervalMs.min).max(LOKI_BOUNDS.batchIntervalMs.max),
651
651
  batchSize: zod.z.number().int().min(LOKI_BOUNDS.batchSize.min).max(LOKI_BOUNDS.batchSize.max),
652
- timeoutMs: zod.z.number().int().min(LOKI_BOUNDS.timeoutMs.min).max(LOKI_BOUNDS.timeoutMs.max)
652
+ timeoutMs: zod.z.number().int().min(LOKI_BOUNDS.timeoutMs.min).max(LOKI_BOUNDS.timeoutMs.max),
653
+ enabled: zod.z.boolean().optional()
653
654
  });
654
655
  var lokiDestinationsKind = require_dist.defineEntryKind("destinations", {
655
656
  title: "Loki destinations",
@@ -801,40 +802,83 @@ async function confirmRecordHoldsLegacy(ports, stored) {
801
802
  if (legacyPassword && !record.hasPassword) return refuse("the record holds no password");
802
803
  }
803
804
  //#endregion
805
+ //#region src/builtins/loki-logging/migrations/registry-toggle-to-record.ts
806
+ async function moveRegistryToggleToRecord(ports) {
807
+ const state = await ports.readRegistryState();
808
+ if (state === "active") return {
809
+ outcome: "already-done",
810
+ summary: { carried: false }
811
+ };
812
+ if (state === "unregistered") throw new Error("the log-destination provider is not registered yet");
813
+ const record = await ports.findToggleRecord();
814
+ if (record === null) return {
815
+ outcome: "already-done",
816
+ summary: { carried: false }
817
+ };
818
+ if (record.enabled) await ports.disableRecord(record.id);
819
+ await ports.enableRegistry();
820
+ return {
821
+ outcome: "done",
822
+ summary: {
823
+ carried: true,
824
+ integrationId: record.id
825
+ }
826
+ };
827
+ }
828
+ //#endregion
804
829
  //#region src/builtins/loki-logging/migrations/index.ts
805
830
  var CONNECTION_TO_RECORDS_ID = "loki-logging/2026-11-02-connection-to-records";
806
831
  /** The `loki-logging` catalogue (D987): offered to the engine when the hub-resident addon initialises. */
807
- var ADDON_MIGRATIONS = [{
808
- meta: {
809
- id: CONNECTION_TO_RECORDS_ID,
810
- owner: "loki-logging",
811
- level: "addon-state",
812
- seq: 1,
813
- dependsOn: [],
814
- store: "settings",
815
- scope: "cluster",
816
- onFailure: "block-owner",
817
- bodyKind: "procedure",
818
- description: "Move the Loki connection (url, credentials, labels, batching) from the addon settings into a destinations record under an integrations row",
819
- fixtureMark: "the D777 retirement marker the migration does not know"
832
+ var ADDON_MIGRATIONS = [
833
+ {
834
+ meta: {
835
+ id: CONNECTION_TO_RECORDS_ID,
836
+ owner: "loki-logging",
837
+ level: "addon-state",
838
+ seq: 1,
839
+ dependsOn: [],
840
+ store: "settings",
841
+ scope: "cluster",
842
+ onFailure: "block-owner",
843
+ bodyKind: "procedure",
844
+ description: "Move the Loki connection (url, credentials, labels, batching) from the addon settings into a destinations record under an integrations row",
845
+ fixtureMark: "the D777 retirement marker the migration does not know"
846
+ },
847
+ procedure: moveConnectionToRecord
820
848
  },
821
- procedure: moveConnectionToRecord
822
- }, {
823
- meta: {
824
- id: "loki-logging/2026-11-02-drop-moved-settings",
825
- owner: "loki-logging",
826
- level: "addon-state",
827
- seq: 2,
828
- dependsOn: [CONNECTION_TO_RECORDS_ID],
829
- store: "settings",
830
- scope: "cluster",
831
- onFailure: "block-owner",
832
- bodyKind: "plan",
833
- description: "Delete the connection keys that moved into the destinations record",
834
- fixtureMark: "the D777 retirement marker the migration does not know"
849
+ {
850
+ meta: {
851
+ id: "loki-logging/2026-11-02-drop-moved-settings",
852
+ owner: "loki-logging",
853
+ level: "addon-state",
854
+ seq: 2,
855
+ dependsOn: [CONNECTION_TO_RECORDS_ID],
856
+ store: "settings",
857
+ scope: "cluster",
858
+ onFailure: "block-owner",
859
+ bodyKind: "plan",
860
+ description: "Delete the connection keys that moved into the destinations record",
861
+ fixtureMark: "the D777 retirement marker the migration does not know"
862
+ },
863
+ plan: planDropMovedSettings
835
864
  },
836
- plan: planDropMovedSettings
837
- }];
865
+ {
866
+ meta: {
867
+ id: "loki-logging/2026-11-02-registry-toggle-to-record",
868
+ owner: "loki-logging",
869
+ level: "addon-state",
870
+ seq: 3,
871
+ dependsOn: [CONNECTION_TO_RECORDS_ID],
872
+ store: "settings",
873
+ scope: "cluster",
874
+ onFailure: "tolerate",
875
+ bodyKind: "procedure",
876
+ description: "Carry a Loki provider switched off at the log-destination registry toggle to a destinations record that is off, and turn the registry toggle back on",
877
+ fixtureMark: "a destinations record field the migration does not know (the job)"
878
+ },
879
+ procedure: moveRegistryToggleToRecord
880
+ }
881
+ ];
838
882
  //#endregion
839
883
  //#region src/builtins/loki-logging/retire-enabled-flag.ts
840
884
  /** The retired settings key. */
@@ -1048,6 +1092,28 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
1048
1092
  }
1049
1093
  return "created";
1050
1094
  },
1095
+ readRegistryState: async () => {
1096
+ const own = (await this.ctx.api.addons.listCapabilityProviders.query({ capName: require_dist.logDestinationCapability.name })).find((p) => p.addonId === this.ctx.id);
1097
+ if (own === void 0) return "unregistered";
1098
+ return own.isActive ? "active" : "inactive";
1099
+ },
1100
+ findToggleRecord: async () => {
1101
+ const [first] = await instances.listResolved();
1102
+ return first === void 0 ? null : {
1103
+ id: first.id,
1104
+ enabled: first.enabled
1105
+ };
1106
+ },
1107
+ disableRecord: async (id) => {
1108
+ await handle.patch(id, { enabled: false });
1109
+ },
1110
+ enableRegistry: async () => {
1111
+ await this.ctx.api.addons.setCapabilityProviderEnabled.mutate({
1112
+ capName: require_dist.logDestinationCapability.name,
1113
+ addonId: this.ctx.id,
1114
+ enabled: true
1115
+ });
1116
+ },
1051
1117
  clearOldPassword: async () => {
1052
1118
  await this.clearSecrets(["password"]);
1053
1119
  }
@@ -1104,6 +1170,13 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
1104
1170
  outcome = await retireEnabledFlag({
1105
1171
  readStoredKey: (key) => this.readStoredGlobalKey(key),
1106
1172
  disableAtCapability: async () => {
1173
+ const instances = this.instances;
1174
+ const [first] = instances === null ? [] : await instances.listResolved();
1175
+ if (first !== void 0 && this.ctx.records !== void 0) {
1176
+ await this.ctx.records.kind(lokiDestinationsKind).patch(first.id, { enabled: false });
1177
+ await this.refreshFromRecord();
1178
+ return;
1179
+ }
1107
1180
  await this.ctx.api.addons.setCapabilityProviderEnabled.mutate({
1108
1181
  capName: require_dist.logDestinationCapability.name,
1109
1182
  addonId: this.ctx.id,
@@ -1142,6 +1215,28 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
1142
1215
  }, delay);
1143
1216
  this.retirementTimer.unref?.();
1144
1217
  }
1218
+ /**
1219
+ * Registration is done: the hub calls this after the providers are registered, so
1220
+ * `listCapabilityProviders` now sees Loki. The registry-toggle migration cannot decide before
1221
+ * that (the pass inside `onInitialize` fails, tolerated), so it runs ONCE here, hub-only. A
1222
+ * failure is logged and writes nothing; the `tolerate` ledger row keeps it for the next boot.
1223
+ */
1224
+ postBrokerStart() {
1225
+ super.postBrokerStart();
1226
+ if (!this.isHub() || this.instances === null || this.shuttingDown) return;
1227
+ this.runRegistryToggleMigration();
1228
+ }
1229
+ async runRegistryToggleMigration() {
1230
+ try {
1231
+ if ((await this.runMigrations(require_dist.defineAddonMigrations(ADDON_MIGRATIONS, this.migrationPorts()))).failed.includes("loki-logging/2026-11-02-registry-toggle-to-record")) {
1232
+ this.ctx.logger.warn("Loki logging: the registry-toggle migration is kept for next boot");
1233
+ return;
1234
+ }
1235
+ await this.refreshFromRecord();
1236
+ } catch (err) {
1237
+ this.ctx.logger.warn("Loki logging: the registry-toggle migration could not run", { meta: { error: err instanceof Error ? err.message : String(err) } });
1238
+ }
1239
+ }
1145
1240
  async onShutdown() {
1146
1241
  this.shuttingDown = true;
1147
1242
  if (this.retirementTimer !== null) clearTimeout(this.retirementTimer);
@@ -1178,7 +1273,7 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
1178
1273
  name: ""
1179
1274
  };
1180
1275
  return {
1181
- enabled: true,
1276
+ enabled: body.enabled !== false,
1182
1277
  url: body.url,
1183
1278
  job: body.job,
1184
1279
  node: this.ctx.kernel.localNodeId ?? "hub",
@@ -1,4 +1,4 @@
1
- import { Dr as integrationInstancesCapability, Oi as preconditionOf, Pt as RecordIntegrationInstances, Qr as logDestinationCapability, Ts as isSecretMarker, Vo as RevConflictError, cs as defineEntryKind, mo as BaseAddon, os as defineAddonMigrations, ws as isSecretFieldView } from "../../dist-BF9MiiHX.mjs";
1
+ import { Dr as integrationInstancesCapability, Oi as preconditionOf, Pt as RecordIntegrationInstances, Qr as logDestinationCapability, Ts as isSecretMarker, Vo as RevConflictError, cs as defineEntryKind, mo as BaseAddon, os as defineAddonMigrations, ws as isSecretFieldView } from "../../dist-C5sQPOZX.mjs";
2
2
  import { n as compileLogFilter, o as lineMatches } from "../../log-read-filter-D7Ev3zm-.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/builtins/loki-logging/loki-payload.ts
@@ -646,7 +646,8 @@ var lokiDestinationsKind = defineEntryKind("destinations", {
646
646
  password: z.string().optional().meta({ secret: true }),
647
647
  batchIntervalMs: z.number().int().min(LOKI_BOUNDS.batchIntervalMs.min).max(LOKI_BOUNDS.batchIntervalMs.max),
648
648
  batchSize: z.number().int().min(LOKI_BOUNDS.batchSize.min).max(LOKI_BOUNDS.batchSize.max),
649
- timeoutMs: z.number().int().min(LOKI_BOUNDS.timeoutMs.min).max(LOKI_BOUNDS.timeoutMs.max)
649
+ timeoutMs: z.number().int().min(LOKI_BOUNDS.timeoutMs.min).max(LOKI_BOUNDS.timeoutMs.max),
650
+ enabled: z.boolean().optional()
650
651
  })
651
652
  });
652
653
  var LOKI_DEFAULT_BODY = {
@@ -794,40 +795,83 @@ async function confirmRecordHoldsLegacy(ports, stored) {
794
795
  if (legacyPassword && !record.hasPassword) return refuse("the record holds no password");
795
796
  }
796
797
  //#endregion
798
+ //#region src/builtins/loki-logging/migrations/registry-toggle-to-record.ts
799
+ async function moveRegistryToggleToRecord(ports) {
800
+ const state = await ports.readRegistryState();
801
+ if (state === "active") return {
802
+ outcome: "already-done",
803
+ summary: { carried: false }
804
+ };
805
+ if (state === "unregistered") throw new Error("the log-destination provider is not registered yet");
806
+ const record = await ports.findToggleRecord();
807
+ if (record === null) return {
808
+ outcome: "already-done",
809
+ summary: { carried: false }
810
+ };
811
+ if (record.enabled) await ports.disableRecord(record.id);
812
+ await ports.enableRegistry();
813
+ return {
814
+ outcome: "done",
815
+ summary: {
816
+ carried: true,
817
+ integrationId: record.id
818
+ }
819
+ };
820
+ }
821
+ //#endregion
797
822
  //#region src/builtins/loki-logging/migrations/index.ts
798
823
  var CONNECTION_TO_RECORDS_ID = "loki-logging/2026-11-02-connection-to-records";
799
824
  /** The `loki-logging` catalogue (D987): offered to the engine when the hub-resident addon initialises. */
800
- var ADDON_MIGRATIONS = [{
801
- meta: {
802
- id: CONNECTION_TO_RECORDS_ID,
803
- owner: "loki-logging",
804
- level: "addon-state",
805
- seq: 1,
806
- dependsOn: [],
807
- store: "settings",
808
- scope: "cluster",
809
- onFailure: "block-owner",
810
- bodyKind: "procedure",
811
- description: "Move the Loki connection (url, credentials, labels, batching) from the addon settings into a destinations record under an integrations row",
812
- fixtureMark: "the D777 retirement marker the migration does not know"
825
+ var ADDON_MIGRATIONS = [
826
+ {
827
+ meta: {
828
+ id: CONNECTION_TO_RECORDS_ID,
829
+ owner: "loki-logging",
830
+ level: "addon-state",
831
+ seq: 1,
832
+ dependsOn: [],
833
+ store: "settings",
834
+ scope: "cluster",
835
+ onFailure: "block-owner",
836
+ bodyKind: "procedure",
837
+ description: "Move the Loki connection (url, credentials, labels, batching) from the addon settings into a destinations record under an integrations row",
838
+ fixtureMark: "the D777 retirement marker the migration does not know"
839
+ },
840
+ procedure: moveConnectionToRecord
813
841
  },
814
- procedure: moveConnectionToRecord
815
- }, {
816
- meta: {
817
- id: "loki-logging/2026-11-02-drop-moved-settings",
818
- owner: "loki-logging",
819
- level: "addon-state",
820
- seq: 2,
821
- dependsOn: [CONNECTION_TO_RECORDS_ID],
822
- store: "settings",
823
- scope: "cluster",
824
- onFailure: "block-owner",
825
- bodyKind: "plan",
826
- description: "Delete the connection keys that moved into the destinations record",
827
- fixtureMark: "the D777 retirement marker the migration does not know"
842
+ {
843
+ meta: {
844
+ id: "loki-logging/2026-11-02-drop-moved-settings",
845
+ owner: "loki-logging",
846
+ level: "addon-state",
847
+ seq: 2,
848
+ dependsOn: [CONNECTION_TO_RECORDS_ID],
849
+ store: "settings",
850
+ scope: "cluster",
851
+ onFailure: "block-owner",
852
+ bodyKind: "plan",
853
+ description: "Delete the connection keys that moved into the destinations record",
854
+ fixtureMark: "the D777 retirement marker the migration does not know"
855
+ },
856
+ plan: planDropMovedSettings
828
857
  },
829
- plan: planDropMovedSettings
830
- }];
858
+ {
859
+ meta: {
860
+ id: "loki-logging/2026-11-02-registry-toggle-to-record",
861
+ owner: "loki-logging",
862
+ level: "addon-state",
863
+ seq: 3,
864
+ dependsOn: [CONNECTION_TO_RECORDS_ID],
865
+ store: "settings",
866
+ scope: "cluster",
867
+ onFailure: "tolerate",
868
+ bodyKind: "procedure",
869
+ description: "Carry a Loki provider switched off at the log-destination registry toggle to a destinations record that is off, and turn the registry toggle back on",
870
+ fixtureMark: "a destinations record field the migration does not know (the job)"
871
+ },
872
+ procedure: moveRegistryToggleToRecord
873
+ }
874
+ ];
831
875
  //#endregion
832
876
  //#region src/builtins/loki-logging/retire-enabled-flag.ts
833
877
  /** The retired settings key. */
@@ -1041,6 +1085,28 @@ var LokiLoggingAddon = class extends BaseAddon {
1041
1085
  }
1042
1086
  return "created";
1043
1087
  },
1088
+ readRegistryState: async () => {
1089
+ const own = (await this.ctx.api.addons.listCapabilityProviders.query({ capName: logDestinationCapability.name })).find((p) => p.addonId === this.ctx.id);
1090
+ if (own === void 0) return "unregistered";
1091
+ return own.isActive ? "active" : "inactive";
1092
+ },
1093
+ findToggleRecord: async () => {
1094
+ const [first] = await instances.listResolved();
1095
+ return first === void 0 ? null : {
1096
+ id: first.id,
1097
+ enabled: first.enabled
1098
+ };
1099
+ },
1100
+ disableRecord: async (id) => {
1101
+ await handle.patch(id, { enabled: false });
1102
+ },
1103
+ enableRegistry: async () => {
1104
+ await this.ctx.api.addons.setCapabilityProviderEnabled.mutate({
1105
+ capName: logDestinationCapability.name,
1106
+ addonId: this.ctx.id,
1107
+ enabled: true
1108
+ });
1109
+ },
1044
1110
  clearOldPassword: async () => {
1045
1111
  await this.clearSecrets(["password"]);
1046
1112
  }
@@ -1097,6 +1163,13 @@ var LokiLoggingAddon = class extends BaseAddon {
1097
1163
  outcome = await retireEnabledFlag({
1098
1164
  readStoredKey: (key) => this.readStoredGlobalKey(key),
1099
1165
  disableAtCapability: async () => {
1166
+ const instances = this.instances;
1167
+ const [first] = instances === null ? [] : await instances.listResolved();
1168
+ if (first !== void 0 && this.ctx.records !== void 0) {
1169
+ await this.ctx.records.kind(lokiDestinationsKind).patch(first.id, { enabled: false });
1170
+ await this.refreshFromRecord();
1171
+ return;
1172
+ }
1100
1173
  await this.ctx.api.addons.setCapabilityProviderEnabled.mutate({
1101
1174
  capName: logDestinationCapability.name,
1102
1175
  addonId: this.ctx.id,
@@ -1135,6 +1208,28 @@ var LokiLoggingAddon = class extends BaseAddon {
1135
1208
  }, delay);
1136
1209
  this.retirementTimer.unref?.();
1137
1210
  }
1211
+ /**
1212
+ * Registration is done: the hub calls this after the providers are registered, so
1213
+ * `listCapabilityProviders` now sees Loki. The registry-toggle migration cannot decide before
1214
+ * that (the pass inside `onInitialize` fails, tolerated), so it runs ONCE here, hub-only. A
1215
+ * failure is logged and writes nothing; the `tolerate` ledger row keeps it for the next boot.
1216
+ */
1217
+ postBrokerStart() {
1218
+ super.postBrokerStart();
1219
+ if (!this.isHub() || this.instances === null || this.shuttingDown) return;
1220
+ this.runRegistryToggleMigration();
1221
+ }
1222
+ async runRegistryToggleMigration() {
1223
+ try {
1224
+ if ((await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, this.migrationPorts()))).failed.includes("loki-logging/2026-11-02-registry-toggle-to-record")) {
1225
+ this.ctx.logger.warn("Loki logging: the registry-toggle migration is kept for next boot");
1226
+ return;
1227
+ }
1228
+ await this.refreshFromRecord();
1229
+ } catch (err) {
1230
+ this.ctx.logger.warn("Loki logging: the registry-toggle migration could not run", { meta: { error: err instanceof Error ? err.message : String(err) } });
1231
+ }
1232
+ }
1138
1233
  async onShutdown() {
1139
1234
  this.shuttingDown = true;
1140
1235
  if (this.retirementTimer !== null) clearTimeout(this.retirementTimer);
@@ -1171,7 +1266,7 @@ var LokiLoggingAddon = class extends BaseAddon {
1171
1266
  name: ""
1172
1267
  };
1173
1268
  return {
1174
- enabled: true,
1269
+ enabled: body.enabled !== false,
1175
1270
  url: body.url,
1176
1271
  job: body.job,
1177
1272
  node: this.ctx.kernel.localNodeId ?? "hub",
@@ -48,6 +48,14 @@ export declare class LokiLoggingAddon extends BaseAddon<LokiAddonConfig> {
48
48
  private probe;
49
49
  /** One attempt of the D777 carry-over; reschedules itself while deferred. */
50
50
  private attemptEnabledFlagRetirement;
51
+ /**
52
+ * Registration is done: the hub calls this after the providers are registered, so
53
+ * `listCapabilityProviders` now sees Loki. The registry-toggle migration cannot decide before
54
+ * that (the pass inside `onInitialize` fails, tolerated), so it runs ONCE here, hub-only. A
55
+ * failure is logged and writes nothing; the `tolerate` ledger row keeps it for the next boot.
56
+ */
57
+ override postBrokerStart(): void;
58
+ private runRegistryToggleMigration;
51
59
  protected onShutdown(): Promise<void>;
52
60
  /**
53
61
  * React to a settings change (URL, level, batching) without a
@@ -25,6 +25,8 @@ export type LokiDestinationBody = {
25
25
  readonly batchIntervalMs: number;
26
26
  readonly batchSize: number;
27
27
  readonly timeoutMs: number;
28
+ /** The instance's own switch (D996). Absent means on, so no data migration was needed. */
29
+ readonly enabled?: boolean | undefined;
28
30
  };
29
31
  /** The schema is checked against the interface by its annotation: a drifted field fails the typecheck. */
30
32
  export declare const LokiDestinationBodySchema: z.ZodType<LokiDestinationBody>;
@@ -1,8 +1,11 @@
1
1
  import type { AddonMigration } from "@camstack/types";
2
2
  import { type DropMovedSettingsPorts, type LokiMigrationPorts } from "./connection-to-records.js";
3
+ import { type RegistryToggleMigrationPorts } from "./registry-toggle-to-record.js";
4
+ export type { RegistryState, RegistryToggleMigrationPorts } from "./registry-toggle-to-record.js";
3
5
  export type { DropMovedSettingsPorts, LokiMigrationLog, LokiMigrationPorts, LokiRecordState } from "./connection-to-records.js";
4
6
  /** Both bodies read through ONE port object, so the addon binds the catalogue once. */
5
- export type LokiCataloguePorts = LokiMigrationPorts & DropMovedSettingsPorts;
7
+ export type LokiCataloguePorts = LokiMigrationPorts & DropMovedSettingsPorts & RegistryToggleMigrationPorts;
6
8
  export declare const CONNECTION_TO_RECORDS_ID = "loki-logging/2026-11-02-connection-to-records";
9
+ export declare const REGISTRY_TOGGLE_TO_RECORD_ID = "loki-logging/2026-11-02-registry-toggle-to-record";
7
10
  /** The `loki-logging` catalogue (D987): offered to the engine when the hub-resident addon initialises. */
8
11
  export declare const ADDON_MIGRATIONS: readonly AddonMigration<LokiCataloguePorts>[];
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Loki's on/off moves from the `log-destination` registry toggle (D777) to the record's own
3
+ * `enabled` (D996). A provider the registry holds OFF is carried to a record that is off, and the
4
+ * registry toggle is turned back on, so the operator has ONE switch and it is the visible one.
5
+ *
6
+ * Idempotent and crash-safe: the record is written first (a rerun sees it already off and only
7
+ * turns the registry on); a registry that cannot be read writes nothing (D49); a provider that is
8
+ * not registered yet FAILS the migration (tolerated) so the addon retries after registration.
9
+ */
10
+ import type { MigrationProcedureResult } from "@camstack/types";
11
+ /** What the hub's capability registry says about Loki's `log-destination` provider. */
12
+ export type RegistryState = "active" | "inactive" | "unregistered";
13
+ export interface RegistryToggleMigrationPorts {
14
+ /** The registry state of this addon's `log-destination` provider. Throws when it cannot be read. */
15
+ readRegistryState(): Promise<RegistryState>;
16
+ /** The destinations record, or null when there is none. */
17
+ findToggleRecord(): Promise<{
18
+ readonly id: string;
19
+ readonly enabled: boolean;
20
+ } | null>;
21
+ /** Patch the record to `enabled: false`. */
22
+ disableRecord(id: string): Promise<void>;
23
+ /** Turn the registry toggle back on. */
24
+ enableRegistry(): Promise<void>;
25
+ }
26
+ export declare function moveRegistryToggleToRecord(ports: RegistryToggleMigrationPorts): Promise<MigrationProcedureResult>;
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DwI4ifnv.js");
6
+ const require_dist = require("../../dist-Cyc4oyGh.js");
7
7
  let node_fs_promises = require("node:fs/promises");
8
8
  let node_util = require("node:util");
9
9
  let node_os = require("node:os");
@@ -1,4 +1,4 @@
1
- import { $t as UNATTRIBUTED_BUCKET_KEY, Bi as resolveBucketMs, Nt as ROOT_BUCKET_KEY, Pi as reducePoints, ec as errMsg, is as createEvent, mo as BaseAddon, oi as metricsProviderCapability, tc as EventCategory, xr as foldSnapshotByFunction } from "../../dist-BF9MiiHX.mjs";
1
+ import { $t as UNATTRIBUTED_BUCKET_KEY, Bi as resolveBucketMs, Nt as ROOT_BUCKET_KEY, Pi as reducePoints, ec as errMsg, is as createEvent, mo as BaseAddon, oi as metricsProviderCapability, tc as EventCategory, xr as foldSnapshotByFunction } from "../../dist-C5sQPOZX.mjs";
2
2
  import { access, readFile, readdir } from "node:fs/promises";
3
3
  import { promisify } from "node:util";
4
4
  import * as os$1 from "node:os";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DwI4ifnv.js");
6
+ const require_dist = require("../../dist-Cyc4oyGh.js");
7
7
  const require_coral_accelerators = require("../../coral-accelerators-BSVsBVzt.js");
8
8
  let node_path = require("node:path");
9
9
  node_path = require_chunk.__toESM(node_path);
@@ -1,5 +1,5 @@
1
1
  import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
2
- import { Ti as platformProbeCapability, bi as parseAcceleratorFactsJson, ds as emitReadiness, ec as errMsg, mo as BaseAddon, na as scoreRuntimes, sr as enumerateInferenceDevices, tc as EventCategory } from "../../dist-BF9MiiHX.mjs";
2
+ import { Ti as platformProbeCapability, bi as parseAcceleratorFactsJson, ds as emitReadiness, ec as errMsg, mo as BaseAddon, na as scoreRuntimes, sr as enumerateInferenceDevices, tc as EventCategory } from "../../dist-C5sQPOZX.mjs";
3
3
  import { n as detectCoralAccelerator, r as nodeCoralFs } from "../../coral-accelerators-BW3OcrLD.mjs";
4
4
  import * as path$1 from "node:path";
5
5
  import { promisify } from "node:util";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DwI4ifnv.js");
6
+ const require_dist = require("../../dist-Cyc4oyGh.js");
7
7
  let zod = require("zod");
8
8
  let node_crypto = require("node:crypto");
9
9
  //#region src/builtins/record-entries/entries-service.ts
@@ -1,4 +1,4 @@
1
- import { Ko as UnknownRecordKindError, Mi as recordEntriesCapability, Ws as secretViewsOf, mo as BaseAddon, wo as InvalidRecordError } from "../../dist-BF9MiiHX.mjs";
1
+ import { Ko as UnknownRecordKindError, Mi as recordEntriesCapability, Ws as secretViewsOf, mo as BaseAddon, wo as InvalidRecordError } from "../../dist-C5sQPOZX.mjs";
2
2
  import { z } from "zod";
3
3
  import { randomUUID } from "node:crypto";
4
4
  //#region src/builtins/record-entries/entries-service.ts
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DwI4ifnv.js");
6
+ const require_dist = require("../../dist-Cyc4oyGh.js");
7
7
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
8
8
  /**
9
9
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -1,4 +1,4 @@
1
- import { mo as BaseAddon, tc as EventCategory } from "../../dist-BF9MiiHX.mjs";
1
+ import { mo as BaseAddon, tc as EventCategory } from "../../dist-C5sQPOZX.mjs";
2
2
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
3
3
  /**
4
4
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DwI4ifnv.js");
6
+ const require_dist = require("../../dist-Cyc4oyGh.js");
7
7
  const require_snapshot_courtesy = require("../../snapshot-courtesy-D_C5-nC0.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { $s as DeviceType, Zn as deriveBatteryPresence, Zs as DeviceFeature, ec as errMsg, gn as batteryCapability, h as BatteryStatusSchema, hn as bareAddonId, ii as memoizePinnedFfmpeg, js as nodePin, mo as BaseAddon, tc as EventCategory, ua as snapshotCapability, va as streamQualityLabel } from "../../dist-BF9MiiHX.mjs";
1
+ import { $s as DeviceType, Zn as deriveBatteryPresence, Zs as DeviceFeature, ec as errMsg, gn as batteryCapability, h as BatteryStatusSchema, hn as bareAddonId, ii as memoizePinnedFfmpeg, js as nodePin, mo as BaseAddon, tc as EventCategory, ua as snapshotCapability, va as streamQualityLabel } from "../../dist-C5sQPOZX.mjs";
2
2
  import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CyFs1M3I.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DwI4ifnv.js");
6
+ const require_dist = require("../../dist-Cyc4oyGh.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let node_fs_promises = require("node:fs/promises");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { br as filesystemBrowseCapability, ga as storageProviderCapability, mo as BaseAddon } from "../../dist-BF9MiiHX.mjs";
1
+ import { br as filesystemBrowseCapability, ga as storageProviderCapability, mo as BaseAddon } from "../../dist-C5sQPOZX.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
6
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
7
- const require_wal_maintenance = require("../../wal-maintenance-DrLnLCGO.js");
7
+ const require_wal_maintenance = require("../../wal-maintenance-DNE7RTcS.js");
8
8
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
9
9
  //#region src/builtins/sqlite-storage/config-store.ts
10
10
  var ConfigStore = class {
@@ -1,5 +1,5 @@
1
1
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
2
- import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-CTsOr0e7.mjs";
2
+ import { B as SQLITE_ENGINE_STORM_WALL_SHARE, F as SQLITE_MMAP_FLOOR_BYTES, G as SqliteOpProfiler, H as SQLITE_PROFILE_REPORT_INTERVAL_MS, I as SQLITE_PAGE_CACHE_CEILING_KIB, K as sqliteEngineStorm, L as SQLITE_PAGE_CACHE_FLOOR_KIB, N as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, P as SQLITE_MMAP_CEILING_BYTES, R as sqliteMmapSizeFor, U as SQLITE_PROFILE_TOP_N, V as SQLITE_PROFILE_REPORT_FLOOR_MS, W as SQLITE_SLOW_CALL_MS, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as sqlitePageCacheKibFor } from "../../wal-maintenance-CEi8PqMh.mjs";
3
3
  import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
4
4
  //#region src/builtins/sqlite-storage/config-store.ts
5
5
  var ConfigStore = class {
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-DwI4ifnv.js");
6
+ const require_dist = require("../../dist-Cyc4oyGh.js");
7
7
  const require_retired_settings_keys = require("../../retired-settings-keys-C8nOOr5H.js");
8
- const require_wal_maintenance = require("../../wal-maintenance-DrLnLCGO.js");
8
+ const require_wal_maintenance = require("../../wal-maintenance-DNE7RTcS.js");
9
9
  const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
10
10
  const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
11
11
  let zod = require("zod");