@camstack/addon-admin-ui 1.2.708 → 1.2.710

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 (111) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/assets/{AccessSection-CmL_Onb2.js → AccessSection-Cgv04lJf.js} +1 -1
  3. package/dist/assets/Addons-BJL6WRKD.js +5 -0
  4. package/dist/assets/{AdminPage-Q8iyQ6l8.js → AdminPage-CFltVUtJ.js} +1 -1
  5. package/dist/assets/{AdminSectionedPage-BD_fZFRe.js → AdminSectionedPage-DfZeI0TS.js} +1 -1
  6. package/dist/assets/AiProfiles-DW29u0zA.js +3 -0
  7. package/dist/assets/Archive-DJk2nZPq.js +1 -0
  8. package/dist/assets/BootstrapSettingsForm-DKjedbyR.js +1 -0
  9. package/dist/assets/{Build-DvKE6nTb.js → Build-CaXtQUh_.js} +4 -4
  10. package/dist/assets/{Calendars-DHzAhyJ7.js → Calendars-Bfl32yKa.js} +1 -1
  11. package/dist/assets/Cluster-BT8yE3Jd.js +1 -0
  12. package/dist/assets/{CompositionBlockEditor-Bgx8eHTM.js → CompositionBlockEditor-DmYv5ln7.js} +2 -2
  13. package/dist/assets/{CompositionEditorPage-B9gDFYDb.js → CompositionEditorPage-DAZ2EbrI.js} +1 -1
  14. package/dist/assets/Data-CCLq4I9_.js +2 -0
  15. package/dist/assets/{DeviceDetail-NBocrvbT.js → DeviceDetail-DNKg72IG.js} +1 -1
  16. package/dist/assets/{Devices-D8DTAwFv.js → Devices-BbWkqyWN.js} +1 -1
  17. package/dist/assets/{EmbedDevicePage-CPQdBTEQ.js → EmbedDevicePage-C3hraaEM.js} +1 -1
  18. package/dist/assets/{EmbedPlayerPage-B5_-KzBH.js → EmbedPlayerPage-RHniI2xA.js} +1 -1
  19. package/dist/assets/History-B5SE1vph.js +1 -0
  20. package/dist/assets/Identity-COMelIL5.js +1 -0
  21. package/dist/assets/InstancesTable-Gi6mvKws.js +1 -0
  22. package/dist/assets/IntegrationDetail-BJgK3HQZ.js +1 -0
  23. package/dist/assets/{Integrations-CZBdHxHR.js → Integrations-BAxIjtmf.js} +2 -2
  24. package/dist/assets/Integrations-DBIDhCAF.js +1 -0
  25. package/dist/assets/Library-j-P8SKgP.js +1 -0
  26. package/dist/assets/Locations-BPRZSbLT.js +3 -0
  27. package/dist/assets/{Logs-BFhMej4c.js → Logs-RCKlFer4.js} +1 -1
  28. package/dist/assets/{MaskShapeCanvas-DJAQ2y3P.js → MaskShapeCanvas-BN6ufTmt.js} +1 -1
  29. package/dist/assets/{MotionZonesSettings-CwHYVPtN.js → MotionZonesSettings-DsM7FPZE.js} +1 -1
  30. package/dist/assets/MyAccess-B3gTfVDq.js +2 -0
  31. package/dist/assets/{Network-CZWNHZbt.js → Network-CBAabM0h.js} +1 -1
  32. package/dist/assets/{NewExportModal-Djoe8Y50.js → NewExportModal-DGq6CWpy.js} +1 -1
  33. package/dist/assets/NodeAddonsSettingsPanel-DCa3tgOb.js +1 -0
  34. package/dist/assets/Notifications-DccqInu6.js +1 -0
  35. package/dist/assets/{PanelContent-BvMFsT5L.js → PanelContent-CVkHXftN.js} +2 -2
  36. package/dist/assets/Pipeline-CdKKet5N.js +1 -0
  37. package/dist/assets/{PrivacyMaskSettings-hArLTspd.js → PrivacyMaskSettings-m809AVSj.js} +1 -1
  38. package/dist/assets/{SceneMonitorEditor-BQ4Ow_Zr.js → SceneMonitorEditor-BRoTpS7V.js} +1 -1
  39. package/dist/assets/SessionsList-Dqh1pfhl.js +2 -0
  40. package/dist/assets/{Showroom-BV_20igh.js → Showroom-DO5dhVVy.js} +1 -1
  41. package/dist/assets/{StorageLocationsTable-BlY2ZuRD.js → StorageLocationsTable-DjJKdT5E.js} +1 -1
  42. package/dist/assets/System-nfPLxCLF.js +2 -0
  43. package/dist/assets/TemplateEditorDialog-eOBMrmCP.js +1 -0
  44. package/dist/assets/{Terminal-CCvtDRX3.js → Terminal-AxKgimJQ.js} +3 -3
  45. package/dist/assets/{TrainingProviders-QpCAaIRs.js → TrainingProviders-DqSWU0Ff.js} +1 -1
  46. package/dist/assets/{Viewer-DZ8d24s6.js → Viewer-BBtW52-D.js} +1 -1
  47. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CU5UJUMr.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CnAAoU-a.js} +1 -1
  48. package/dist/assets/{action-draft-B7-vMM4C.js → action-draft-xWZeLJBc.js} +1 -1
  49. package/dist/assets/{ai-page.helpers-CH98Xnez.js → ai-page.helpers-DutvjEb-.js} +1 -1
  50. package/dist/assets/{assignment-candidates-CMfCAjbD.js → assignment-candidates-BJPEmgFZ.js} +1 -1
  51. package/dist/assets/{authed-media-mKoUB7Wx.js → authed-media-BTPD9Rqy.js} +1 -1
  52. package/dist/assets/{board-model-D0VuBTSN.js → board-model-p3qXSelJ.js} +1 -1
  53. package/dist/assets/{camera-block-model-1_LIwub0.js → camera-block-model-BmK3dL9c.js} +1 -1
  54. package/dist/assets/client-D93RkunP.js +1125 -0
  55. package/dist/assets/{command-vocab-CRRlGeAg.js → command-vocab-DGcpiUvY.js} +1 -1
  56. package/dist/assets/{device-integration-icon-evTdq6FJ.js → device-integration-icon-Cfi7eokn.js} +1 -1
  57. package/dist/assets/device-picker-model-Bbj8t_iL.js +1 -0
  58. package/dist/assets/dist-ClyHN0ce.js +1125 -0
  59. package/dist/assets/{dist-BBOm1A6D.js → dist-SwLD2DK1.js} +1 -1
  60. package/dist/assets/{format-B9MC39Sk.js → format-Dzip80Uj.js} +1 -1
  61. package/dist/assets/{hostInit-B1RT7r2L.js → hostInit-C3sYu6u4.js} +1 -1
  62. package/dist/assets/i18n-ILINfI4k.js +1 -0
  63. package/dist/assets/{icons-BIPkMWld.js → icons-C4C8iPI_.js} +1 -1
  64. package/dist/assets/index-BFuQYqWe.css +2 -0
  65. package/dist/assets/{index-D3mVWYUM.js → index-BZLBXpx-.js} +4 -4
  66. package/dist/assets/{linked-devices-model-CKiEiEUw.js → linked-devices-model-ChJFxnJQ.js} +1 -1
  67. package/dist/assets/{mf-entry-bootstrap-0-2bdfde26.js → mf-entry-bootstrap-0-31325a3f.js} +2 -2
  68. package/dist/assets/mount-Bbj8t_iL.js +1 -0
  69. package/dist/assets/{notification-rule-status-B6U4GFtq.js → notification-rule-status-BWxeQ-_D.js} +1 -1
  70. package/dist/assets/{player-overlays-D1NExXj2.js → player-overlays-hLBmOC8C.js} +1 -1
  71. package/dist/assets/remoteEntry-9sIn-FFM.js +1 -0
  72. package/dist/assets/src-CR4MjS0h.js +279 -0
  73. package/dist/assets/{sso-popup-C96ZvJqF.js → sso-popup-D5c1Dbz3.js} +1 -1
  74. package/dist/assets/{step-inspector-model-9ly-JWp5.js → step-inspector-model-kpUIIlrE.js} +1 -1
  75. package/dist/assets/{use-scenes-feed-czWy_ho6.js → use-scenes-feed-D60vwQnn.js} +1 -1
  76. package/dist/assets/{useAdminDeviceRemoval-QjQBZ6tM.js → useAdminDeviceRemoval-DHZF8Bhc.js} +1 -1
  77. package/dist/assets/useEventInvalidation-Bbj8t_iL.js +1 -0
  78. package/dist/assets/{useNodeUrlSelection-DHio5p0q.js → useNodeUrlSelection-CxldmcjV.js} +1 -1
  79. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-J9oLjMJ0.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DgZGj8av.js} +2 -2
  80. package/dist/index.html +9 -9
  81. package/dist/server/addon.js +370 -23
  82. package/package.json +2 -2
  83. package/dist/assets/Addons-DWymb9Vl.js +0 -5
  84. package/dist/assets/AiProfiles-BIxZ2_6q.js +0 -3
  85. package/dist/assets/Archive-C6_m1wEE.js +0 -1
  86. package/dist/assets/BootstrapSettingsForm-CaT3bTFg.js +0 -1
  87. package/dist/assets/Cluster-DbxqzICC.js +0 -1
  88. package/dist/assets/Data-CcpaQCFA.js +0 -2
  89. package/dist/assets/History-ft50TIgH.js +0 -1
  90. package/dist/assets/Identity-D0tXeMJI.js +0 -1
  91. package/dist/assets/InstancesTable-BECFInNU.js +0 -1
  92. package/dist/assets/IntegrationDetail-HyHJN95v.js +0 -1
  93. package/dist/assets/Integrations-9Im6toi_.js +0 -1
  94. package/dist/assets/Library-_igcImHQ.js +0 -1
  95. package/dist/assets/Locations-BXSHCcGW.js +0 -3
  96. package/dist/assets/MyAccess-d4Dxkbs9.js +0 -2
  97. package/dist/assets/NodeAddonsSettingsPanel-B9ozPPw1.js +0 -1
  98. package/dist/assets/Notifications-BvvHJsaT.js +0 -1
  99. package/dist/assets/Pipeline-BOw5x-8P.js +0 -1
  100. package/dist/assets/SessionsList-Dd_M6VZ_.js +0 -2
  101. package/dist/assets/System-kmtCUnQG.js +0 -2
  102. package/dist/assets/TemplateEditorDialog-qiaEmHIC.js +0 -1
  103. package/dist/assets/client-BN2LRjot.js +0 -1125
  104. package/dist/assets/device-picker-model-CZRDLeqa.js +0 -1
  105. package/dist/assets/dist-C4JNZdd3.js +0 -1125
  106. package/dist/assets/i18n-D0ym_MsQ.js +0 -1
  107. package/dist/assets/index-BeEV7XaB.css +0 -2
  108. package/dist/assets/mount-CZRDLeqa.js +0 -1
  109. package/dist/assets/remoteEntry-B-bcpFgG.js +0 -1
  110. package/dist/assets/src-6lZ5_wSy.js +0 -279
  111. package/dist/assets/useEventInvalidation-CZRDLeqa.js +0 -1
@@ -5990,7 +5990,7 @@ var ZodIssueCode = {
5990
5990
  var ZodFirstPartyTypeKind;
5991
5991
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5992
5992
  //#endregion
5993
- //#region ../types/dist/runtime-capabilities-B36VcCR6.mjs
5993
+ //#region ../types/dist/runtime-capabilities-ql3VRzQu.mjs
5994
5994
  /**
5995
5995
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5996
5996
  * window to float samples (D455).
@@ -6085,6 +6085,57 @@ var AddonMigrationsBlockedError = class extends Error {
6085
6085
  this.migrationIds = migrationIds;
6086
6086
  }
6087
6087
  };
6088
+ var SWITCHES = /* @__PURE__ */ new Map();
6089
+ /** The ids the registry is known to hold a row for (hydrated, or told by the hub). */
6090
+ var ROWS = /* @__PURE__ */ new Set();
6091
+ /** The owner addon of an id, learned from its rows and from the helper that serves it. */
6092
+ var OWNER_OF = /* @__PURE__ */ new Map();
6093
+ /** The addons whose registry read answered at least once. */
6094
+ var ANSWERED = /* @__PURE__ */ new Set();
6095
+ /** The addons whose boot has begun reading the registry: only they can be held back. */
6096
+ var HYDRATING = /* @__PURE__ */ new Set();
6097
+ /**
6098
+ * The addons that serve an instance kind and have not been answered by the registry yet. Scoped
6099
+ * per owner: one addon's failed read never turns off another addon's instances, and an addon that
6100
+ * serves no instance kind never enters it.
6101
+ */
6102
+ var PENDING = /* @__PURE__ */ new Set();
6103
+ /**
6104
+ * An addon's boot is about to read the registry for its rows. From now on, until the registry
6105
+ * answers, its served instance kinds (already built or built later in its boot) fail closed. A
6106
+ * helper used with no addon boot around it (a spec, a tool) is never held back.
6107
+ */
6108
+ function beginHydration(ownerId) {
6109
+ if (ANSWERED.has(ownerId)) return;
6110
+ HYDRATING.add(ownerId);
6111
+ if (KINDS.has(ownerId)) PENDING.add(ownerId);
6112
+ }
6113
+ /** Whether `ownerId` still waits for the registry to answer (it serves a kind and has no rows yet). */
6114
+ function isHydrationPending(ownerId) {
6115
+ return PENDING.has(ownerId);
6116
+ }
6117
+ /** Record what the hub told: the registry holds a row of `id` in this state. */
6118
+ function recordRegistrySwitch(id, enabled) {
6119
+ SWITCHES.set(id, enabled);
6120
+ ROWS.add(id);
6121
+ }
6122
+ /** Seed the store from the registry rows of `ownerId`; the registry answered, so the owner is known. */
6123
+ function hydrateInstanceSwitches(ownerId, rows) {
6124
+ ANSWERED.add(ownerId);
6125
+ for (const row of rows) {
6126
+ recordRegistrySwitch(row.id, row.enabled);
6127
+ OWNER_OF.set(row.id, ownerId);
6128
+ }
6129
+ }
6130
+ /** The addon's boot has built every instance kind and read the registry: unknown ids now read on. */
6131
+ function settleHydration(ownerId) {
6132
+ PENDING.delete(ownerId);
6133
+ }
6134
+ var KINDS = /* @__PURE__ */ new Map();
6135
+ /** The instance kinds announced for `ownerId` so far. */
6136
+ function servedInstanceKindsOf(ownerId) {
6137
+ return [...KINDS.get(ownerId)?.values() ?? []];
6138
+ }
6088
6139
  /** Is this field's stored value a credential? */
6089
6140
  function isSecretConfigField(field) {
6090
6141
  if (field.type === "password") return true;
@@ -6758,6 +6809,32 @@ function switchRecordsOverMigrationApi(api) {
6758
6809
  };
6759
6810
  } };
6760
6811
  }
6812
+ /** The record calls the body-to-registry switch migration makes, over the migration API. */
6813
+ function bodySwitchRecordsOverMigrationApi(api) {
6814
+ return { kind: (definition) => {
6815
+ const handle = api.records.kind(definition);
6816
+ return {
6817
+ query: async () => {
6818
+ const rows = [];
6819
+ let cursor;
6820
+ do {
6821
+ const page = await handle.query({
6822
+ limit: 500,
6823
+ ...cursor === void 0 ? {} : { cursor }
6824
+ });
6825
+ rows.push(...page.records);
6826
+ cursor = page.nextCursor ?? void 0;
6827
+ } while (cursor !== void 0);
6828
+ return { records: rows };
6829
+ },
6830
+ get: (id) => handle.get({ id }),
6831
+ put: (input, opts) => handle.put({
6832
+ ...input,
6833
+ ...opts?.ifRev === void 0 ? {} : { ifRev: opts.ifRev }
6834
+ })
6835
+ };
6836
+ } };
6837
+ }
6761
6838
  function integrationRowsApiOver(api) {
6762
6839
  return {
6763
6840
  list: async () => (await api.integrations.list({})).integrations,
@@ -6876,7 +6953,10 @@ var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
6876
6953
  var RECORD_MAX_DATA_BYTES = 1024 * 1024;
6877
6954
  var RECORD_BATCH_MAX = 1e3;
6878
6955
  var RECORD_QUERY_MAX = 1e3;
6879
- /** The body key of the switch; only {@link RecordIntegrationInstances.setInstanceEnabled} writes it. */
6956
+ /**
6957
+ * The body key the switch USED to live under (D1007, D1015). Nothing writes or reads it any more;
6958
+ * the migrations that move it between the body and the registry name it.
6959
+ */
6880
6960
  var SWITCH_KEY = "enabled";
6881
6961
  /**
6882
6962
  * The one-switch migration (epic #440, step 3). An integration's on/off state used to live in the
@@ -6986,6 +7066,107 @@ function registrySwitchPortsOver(deps) {
6986
7066
  };
6987
7067
  }
6988
7068
  /**
7069
+ * The switch comes back to the registry (D1066), the reverse of {@link registrySwitchToBodyMigration}.
7070
+ * An instance's on/off state lived in its record body (`enabled`, D1007 superseded by D1015); the hub
7071
+ * registry row, keyed by (addon, integration id) like a device, is now the only stored switch.
7072
+ *
7073
+ * For every record of the addon's kind:
7074
+ * - the state is the body's `enabled` (absent means on). When the registry row of that id disagrees,
7075
+ * the BODY wins: it was the only live copy while the body held the switch, and the registry
7076
+ * column of a migrated row was never read;
7077
+ * - a record with no registry row gets one (a services instance, under its addon-minted id);
7078
+ * - the key is then removed from the body, so no second copy remains.
7079
+ * A rerun finds no body that states `enabled` and writes nothing. The registry write goes first, so
7080
+ * a crash between the two steps repeats the pair (idempotent) and never loses a switched-off state.
7081
+ *
7082
+ * It runs in the addon process, after {@link registrySwitchToBodyMigration}, BEFORE the addon
7083
+ * registers its provider.
7084
+ */
7085
+ function bodySwitchToRegistryId(addonId, date, kindName) {
7086
+ return `${addonId}/${date}-body-switch-to-registry-${kindName}`;
7087
+ }
7088
+ async function moveBodySwitchToRegistry(ports, spec) {
7089
+ const records = await ports.listRecords();
7090
+ const adopted = records.length === 0 ? {
7091
+ created: 0,
7092
+ updated: 0,
7093
+ conflicts: []
7094
+ } : await ports.adoptRows(spec.addonId, records.map((r) => ({
7095
+ id: r.id,
7096
+ name: r.name,
7097
+ enabled: r.enabled,
7098
+ stated: r.stated
7099
+ })));
7100
+ const foreign = new Map(adopted.conflicts.map((c) => [c.id, c.ownerAddonId]));
7101
+ for (const [id, owner] of foreign) await ports.warn(`body switch kept: the registry row "${id}" belongs to addon "${owner}", not "${spec.addonId}"`);
7102
+ const stated = records.filter((r) => r.stated && !foreign.has(r.id));
7103
+ for (const row of stated) await ports.stripSwitch(row.id);
7104
+ const summary = {
7105
+ records: records.length,
7106
+ stripped: stated.length,
7107
+ rowsCreated: adopted.created,
7108
+ rowsCorrected: adopted.updated,
7109
+ conflicts: adopted.conflicts.length
7110
+ };
7111
+ return stated.length === 0 && adopted.created === 0 && adopted.updated === 0 ? {
7112
+ outcome: "already-done",
7113
+ summary
7114
+ } : {
7115
+ outcome: "done",
7116
+ summary
7117
+ };
7118
+ }
7119
+ /** A migration entry: an addon states its kind, nothing else. */
7120
+ function bodySwitchToRegistryMigration(spec) {
7121
+ return {
7122
+ meta: {
7123
+ id: bodySwitchToRegistryId(spec.addonId, spec.date, spec.kindName),
7124
+ owner: spec.addonId,
7125
+ level: "addon-state",
7126
+ seq: spec.seq,
7127
+ dependsOn: spec.followsDate === void 0 ? [] : [registrySwitchToBodyId(spec.addonId, spec.followsDate)],
7128
+ store: "settings",
7129
+ scope: "cluster",
7130
+ onFailure: "block-owner",
7131
+ bodyKind: "procedure",
7132
+ description: "Move the switch of every instance record back to its registry row (creating the row of a services instance) and remove it from the body",
7133
+ fixtureMark: "enabled"
7134
+ },
7135
+ procedure: (ports) => moveBodySwitchToRegistry(ports, { addonId: spec.addonId })
7136
+ };
7137
+ }
7138
+ function bodySwitchPortsOver(deps) {
7139
+ const handle = deps.records.kind({
7140
+ name: deps.kind.name,
7141
+ declaration: deps.kind.declaration,
7142
+ schema: record(string(), unknown())
7143
+ });
7144
+ return {
7145
+ listRecords: async () => {
7146
+ return (await handle.query({ limit: 1e3 })).records.map((r) => {
7147
+ const name = r.data[deps.nameField];
7148
+ return {
7149
+ id: r.id,
7150
+ name: typeof name === "string" ? name : r.id,
7151
+ enabled: r.data[SWITCH_KEY] !== false,
7152
+ stated: SWITCH_KEY in r.data
7153
+ };
7154
+ });
7155
+ },
7156
+ adoptRows: deps.adopt,
7157
+ warn: deps.warn,
7158
+ stripSwitch: async (id) => {
7159
+ const row = await handle.get(id);
7160
+ if (row === null || !("enabled" in row.data)) return;
7161
+ const { [SWITCH_KEY]: _dropped, ...rest } = row.data;
7162
+ await handle.put({
7163
+ id,
7164
+ data: rest
7165
+ }, { ifRev: row.rev });
7166
+ }
7167
+ };
7168
+ }
7169
+ /**
6989
7170
  * Build a {@link DurableState} over a single store key. Transport-agnostic:
6990
7171
  * `read`/`write` are the addon-store or device-store accessors. The whole
6991
7172
  * validated value round-trips on every read/write — the schema is the
@@ -7017,6 +7198,20 @@ function createDurableState(deps) {
7017
7198
  };
7018
7199
  }
7019
7200
  /**
7201
+ * The registry could not be read for the switches of an addon that serves instance kinds, so its
7202
+ * instances read off (D1066). A forked runner treats it as a failed boot: the supervisor respawns
7203
+ * it, bounded and marked terminally failed (D6), rather than leave instances off silently.
7204
+ */
7205
+ var INSTANCE_SWITCHES_UNREAD_ERROR_NAME = "InstanceSwitchesUnreadError";
7206
+ var InstanceSwitchesUnreadError = class extends Error {
7207
+ ownerId;
7208
+ constructor(ownerId) {
7209
+ super(`'${ownerId}': the registry did not answer for the instance switches; its instances stay off`);
7210
+ this.ownerId = ownerId;
7211
+ this.name = INSTANCE_SWITCHES_UNREAD_ERROR_NAME;
7212
+ }
7213
+ };
7214
+ /**
7020
7215
  * Per-node scoping for the shared addon-settings blob.
7021
7216
  *
7022
7217
  * An addon's settings store is hub-central (the `addon-settings` cap is
@@ -8000,7 +8195,14 @@ var BaseAddon = class {
8000
8195
  if (secrets !== void 0) this._secretChangeUnsub = secrets.onChange((ref) => {
8001
8196
  if (this._configSecretRefs.has(ref)) this.scheduleSecretReresolve(SECRET_CHANGE_DEBOUNCE_MS);
8002
8197
  });
8198
+ await this.hydrateSwitches();
8003
8199
  const result = await this.onInitialize();
8200
+ await this.moveLateInstanceKinds();
8201
+ await this.adoptUnrowed();
8202
+ if (this.switchesHydrated) {
8203
+ settleHydration(this.ctx.id);
8204
+ for (const served of servedInstanceKindsOf(this.ctx.id)) await served.reapply();
8205
+ }
8004
8206
  this.emitLifecycle(EventCategory.AddonStarted);
8005
8207
  const normalized = normalizeAddonInitResult(result);
8006
8208
  const providers = normalized && "providers" in normalized && normalized.providers ? normalized.providers : [];
@@ -8040,17 +8242,22 @@ var BaseAddon = class {
8040
8242
  this.retiredMigrationIds = ids;
8041
8243
  }
8042
8244
  registrySwitchSpec = null;
8245
+ /** The instance kinds whose switch move this process already ran (or tried), by record kind name. */
8246
+ switchMoved = /* @__PURE__ */ new Set();
8247
+ lastDeclared = [];
8043
8248
  registrySwitchBound() {
8044
- const spec = this.registrySwitchSpec;
8045
- if (spec === null) return [];
8046
8249
  const api = this.ctx.migrationApi;
8250
+ const spec = this.registrySwitchSpec;
8251
+ const kinds = servedInstanceKindsOf(this.ctx.id).filter((k) => !this.switchMoved.has(k.kind.name));
8252
+ if (spec === null && kinds.length === 0) return [];
8047
8253
  if (api === void 0) {
8048
8254
  this.ctx.logger.warn("the registry switch migration is skipped: the migration API is not available on this context");
8049
8255
  return [];
8050
8256
  }
8051
- return migrationSet([registrySwitchToBodyMigration({
8257
+ const date = "2026-11-06";
8258
+ const moveIn = spec === null ? [] : migrationSet([registrySwitchToBodyMigration({
8052
8259
  addonId: this.ctx.id,
8053
- date: "2026-11-06",
8260
+ date,
8054
8261
  seq: 1e3,
8055
8262
  initialBody: spec.initialBody
8056
8263
  })], (a) => registrySwitchPortsOver({
@@ -8058,13 +8265,53 @@ var BaseAddon = class {
8058
8265
  records: switchRecordsOverMigrationApi(a),
8059
8266
  kind: spec.kind
8060
8267
  })).bind(api);
8268
+ const moveBack = kinds.flatMap(({ kind }, index) => {
8269
+ this.switchMoved.add(kind.name);
8270
+ return migrationSet([bodySwitchToRegistryMigration({
8271
+ addonId: this.ctx.id,
8272
+ date: "2026-11-19",
8273
+ seq: 1001 + index,
8274
+ kindName: kind.name,
8275
+ ...spec === null ? {} : { followsDate: date }
8276
+ })], (a) => bodySwitchPortsOver({
8277
+ records: bodySwitchRecordsOverMigrationApi(a),
8278
+ kind,
8279
+ nameField: kind.declaration.entry?.nameField ?? "name",
8280
+ adopt: (addonId, rows) => this.ctx.api.integrations.adoptInstanceRows.mutate({
8281
+ addonId,
8282
+ rows: [...rows]
8283
+ }),
8284
+ warn: async (message) => {
8285
+ await a.log.warn({ message });
8286
+ }
8287
+ })).bind(api);
8288
+ });
8289
+ return [...moveIn, ...moveBack];
8290
+ }
8291
+ /**
8292
+ * A helper built AFTER the addon's migrations ran has a kind that moved nothing yet. Run its
8293
+ * switch move now (the engine replaces an owner's catalogue on every declare, so the whole
8294
+ * declared set goes with it, phased to the late ids), read the registry again, and tell the
8295
+ * addon about every instance that is off so it stops what it started on the default.
8296
+ */
8297
+ async moveLateInstanceKinds() {
8298
+ const late = servedInstanceKindsOf(this.ctx.id).filter((k) => !this.switchMoved.has(k.kind.name));
8299
+ if (late.length === 0) return;
8300
+ try {
8301
+ const only = late.map((k) => bodySwitchToRegistryId(this.ctx.id, "2026-11-19", k.kind.name));
8302
+ await this.runBound(this.lastDeclared, { only });
8303
+ } catch (err) {
8304
+ if (err instanceof AddonMigrationsBlockedError) throw err;
8305
+ this.ctx.logger.error("the late instance switch move failed", { meta: { error: errMsg(err) } });
8306
+ }
8061
8307
  }
8062
8308
  async runBound(declared, options) {
8309
+ this.lastDeclared = declared;
8063
8310
  const added = this.registrySwitchBound();
8064
8311
  const migrations = [...declared, ...added];
8065
8312
  const widened = options?.only === void 0 || added.length === 0 ? options : {
8066
8313
  ...options,
8067
- only: [...options.only, ...added.map((m) => m.meta.id)]
8314
+ only: [...new Set([...options.only, ...added.map((m) => m.meta.id)])]
8068
8315
  };
8069
8316
  const phased = this.retiredMigrationIds.length === 0 ? widened ?? {} : {
8070
8317
  ...widened,
@@ -8077,9 +8324,87 @@ var BaseAddon = class {
8077
8324
  finishMigration: (input) => api.finishMigration.mutate(input)
8078
8325
  }, migrations, this.ctx.logger, phased);
8079
8326
  if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
8327
+ await this.hydrateSwitches();
8328
+ await this.adoptUnrowed();
8080
8329
  return report;
8081
8330
  }
8082
8331
  /**
8332
+ * Learn the on/off state of this addon's instances from the registry rows (D1066), at boot, after
8333
+ * a migration run, and again through {@link rehydrateSwitches}. It runs on the addon's own boot
8334
+ * path, never inside a method the hub calls into. A registry that cannot answer leaves the
8335
+ * instances of THIS addon reading off (fail closed, per owner) until a read answers.
8336
+ */
8337
+ switchesHydrated = false;
8338
+ async hydrateSwitches() {
8339
+ beginHydration(this.ctx.id);
8340
+ try {
8341
+ const rows = await this.ctx.api.integrations.listByAddon.query({ addonId: this.ctx.id });
8342
+ hydrateInstanceSwitches(this.ctx.id, rows);
8343
+ this.switchesHydrated = true;
8344
+ return true;
8345
+ } catch (err) {
8346
+ this.ctx.logger.warn("instance switches not read from the registry: instances stay off", { meta: { error: errMsg(err) } });
8347
+ return false;
8348
+ }
8349
+ }
8350
+ /**
8351
+ * Every record of a served kind the registry holds no row for (created outside the hub door:
8352
+ * a seed, a store write) is adopted with the state it effectively had, on unless this process
8353
+ * stated it off, so the hub can switch it. A failure is logged; the next hydration retries.
8354
+ */
8355
+ async adoptUnrowed() {
8356
+ if (!this.switchesHydrated) return;
8357
+ try {
8358
+ for (const served of servedInstanceKindsOf(this.ctx.id)) {
8359
+ const rows = await served.unrowed();
8360
+ if (rows.length === 0) continue;
8361
+ await this.ctx.api.integrations.adoptInstanceRows.mutate({
8362
+ addonId: this.ctx.id,
8363
+ rows: rows.map((r) => ({
8364
+ id: r.id,
8365
+ name: r.name,
8366
+ enabled: r.enabled,
8367
+ stated: false
8368
+ }))
8369
+ });
8370
+ for (const r of rows) recordRegistrySwitch(r.id, r.enabled);
8371
+ }
8372
+ } catch (err) {
8373
+ this.ctx.logger.warn("records without a registry row were not adopted", { meta: { error: errMsg(err) } });
8374
+ }
8375
+ }
8376
+ /**
8377
+ * Read the switches from the registry again and announce the states now known, so an addon that
8378
+ * started on the fail-closed default (off) starts what is on. Throws
8379
+ * {@link InstanceSwitchesUnreadError} when the registry still does not answer while this addon
8380
+ * serves instance kinds: a forked runner turns that into a failed boot (the supervisor respawns
8381
+ * it, bounded, D6), an agent or the hub reads again on the next hub connect (event-driven, D3).
8382
+ * An addon with no instance kind has nothing waiting and never throws.
8383
+ */
8384
+ async rehydrateSwitches() {
8385
+ if (this._ctx === null) return;
8386
+ if (await this.hydrateSwitches()) {
8387
+ await this.adoptUnrowed();
8388
+ settleHydration(this.ctx.id);
8389
+ for (const served of servedInstanceKindsOf(this.ctx.id)) await served.reapply();
8390
+ return;
8391
+ }
8392
+ if (isHydrationPending(this.ctx.id)) throw new InstanceSwitchesUnreadError(this.ctx.id);
8393
+ }
8394
+ /**
8395
+ * Called on the hub-reachable event (instead of `onHubReachable` directly): the switches are
8396
+ * read again, then `onHubReachable` runs. A registry that still does not answer is logged and
8397
+ * left for the next connect.
8398
+ */
8399
+ async hubReachable() {
8400
+ try {
8401
+ await this.rehydrateSwitches();
8402
+ } catch (err) {
8403
+ this.ctx.logger.warn("instance switches still unread at the hub connect", { meta: { error: errMsg(err) } });
8404
+ }
8405
+ await this.onHubReachable();
8406
+ }
8407
+ /**
8083
8408
  * Called by the isolated-process runner AFTER `broker.start()`.
8084
8409
  * In-process addons never need this because the hub broker is already
8085
8410
  * running when `initialize()` fires. For forked children the broker
@@ -65221,14 +65546,8 @@ var IntegrationWithStateSchema = object({
65221
65546
  id: string(),
65222
65547
  addonId: string(),
65223
65548
  name: string(),
65224
- /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
65549
+ /** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
65225
65550
  enabled: boolean(),
65226
- /**
65227
- * True when the addon that holds the switch did not answer (down, failed, or keeps no record for
65228
- * this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
65229
- * must not draw it as on or off (D315).
65230
- */
65231
- switchUnknown: literal(true).optional(),
65232
65551
  info: record(string(), unknown()).readonly(),
65233
65552
  /** The discovery candidate this integration was set up from (D984). */
65234
65553
  originStableId: string().optional(),
@@ -65240,14 +65559,8 @@ var IntegrationLiteSchema = object({
65240
65559
  id: string(),
65241
65560
  addonId: string(),
65242
65561
  name: string(),
65243
- /** A projection of the instance body's switch (`setInstanceEnabled` is the only writer). */
65562
+ /** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
65244
65563
  enabled: boolean(),
65245
- /**
65246
- * True when the addon that holds the switch did not answer (down, failed, or keeps no record for
65247
- * this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
65248
- * must not draw it as on or off (D315).
65249
- */
65250
- switchUnknown: literal(true).optional(),
65251
65564
  info: record(string(), unknown()).readonly(),
65252
65565
  /** The discovery candidate this integration was set up from (D984). */
65253
65566
  originStableId: string().optional(),
@@ -65363,7 +65676,27 @@ var DeleteIntegrationResultSchema = object({
65363
65676
  success: boolean(),
65364
65677
  deletedId: string()
65365
65678
  });
65366
- method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string() }), IntegrationWithStateSchema), method(object({ addonId: string() }), IntegrationLiteSchema.nullable()), method(UpdateIntegrationInputSchema, IntegrationLiteSchema, {
65679
+ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string() }), IntegrationWithStateSchema), method(object({ addonId: string() }), IntegrationLiteSchema.nullable()), method(object({ addonId: string() }), array(IntegrationLiteSchema)), method(object({
65680
+ addonId: string(),
65681
+ rows: array(object({
65682
+ id: string().min(1),
65683
+ name: string(),
65684
+ enabled: boolean(),
65685
+ /** True when the record body STATED the switch: only then does it override an existing row. */
65686
+ stated: boolean()
65687
+ }))
65688
+ }), object({
65689
+ created: number$1().int(),
65690
+ updated: number$1().int(),
65691
+ /** Rows whose id belongs to ANOTHER addon: left untouched, so the caller keeps its own copy. */
65692
+ conflicts: array(object({
65693
+ id: string(),
65694
+ ownerAddonId: string()
65695
+ }))
65696
+ }), {
65697
+ kind: "mutation",
65698
+ auth: "admin"
65699
+ }), method(UpdateIntegrationInputSchema, IntegrationLiteSchema, {
65367
65700
  kind: "mutation",
65368
65701
  auth: "admin"
65369
65702
  }), method(object({ id: string() }), DeleteIntegrationResultSchema, {
@@ -96370,6 +96703,13 @@ Object.freeze({
96370
96703
  access: "create",
96371
96704
  role: "admin"
96372
96705
  },
96706
+ "integrations.adoptInstanceRows": {
96707
+ capName: "integrations",
96708
+ capScope: "system",
96709
+ addonId: null,
96710
+ access: "create",
96711
+ role: "admin"
96712
+ },
96373
96713
  "integrations.delete": {
96374
96714
  capName: "integrations",
96375
96715
  capScope: "system",
@@ -96405,6 +96745,13 @@ Object.freeze({
96405
96745
  access: "view",
96406
96746
  role: "admin"
96407
96747
  },
96748
+ "integrations.listByAddon": {
96749
+ capName: "integrations",
96750
+ capScope: "system",
96751
+ addonId: null,
96752
+ access: "view",
96753
+ role: "admin"
96754
+ },
96408
96755
  "integrations.update": {
96409
96756
  capName: "integrations",
96410
96757
  capScope: "system",
@@ -107989,7 +108336,7 @@ var AdminUIAddon = class extends BaseAddon {
107989
108336
  capability: adminUiCapability,
107990
108337
  provider: {
107991
108338
  getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
107992
- getVersion: async () => ({ version: "1.2.708" })
108339
+ getVersion: async () => ({ version: "1.2.710" })
107993
108340
  }
107994
108341
  }];
107995
108342
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.708",
3
+ "version": "1.2.710",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -50,7 +50,7 @@
50
50
  }
51
51
  ],
52
52
  "requires": {
53
- "server": ">=1.2.910"
53
+ "server": ">=1.2.912"
54
54
  }
55
55
  },
56
56
  "scripts": {