@camstack/server 1.2.943 → 1.2.945

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 (170) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/closure-pins.json +350 -0
  3. package/dist/api/core/auth-sessions.procedures.js +18 -0
  4. package/dist/api/core/auth.router.js +19 -6
  5. package/dist/api/server-upload.js +17 -1
  6. package/dist/api/trpc/generated-cap-mounts.js +18 -1
  7. package/dist/api/trpc/generated-cap-routers.js +2662 -2542
  8. package/dist/auth/native-return.js +9 -3
  9. package/dist/auth/sso-routes.js +5 -1
  10. package/dist/core/addon/instance-lifecycle.js +4 -1
  11. package/dist/core/auth/handoff-code.service.js +35 -1
  12. package/dist/server-root/index.js +313 -70
  13. package/package.json +15 -11
  14. package/system/assets/apps-aggregator/icon.svg +5 -0
  15. package/system/dist/{action-index-B_cLRwXJ.js → action-index-Bcnb-jyg.js} +9 -1
  16. package/system/dist/{action-index-B1fgpQBt.mjs → action-index-DwPHO2nz.mjs} +9 -1
  17. package/system/dist/{addon-settings.cap-CZ4MC7ha.mjs → addon-settings.cap-CHpmuaQG.mjs} +1 -1
  18. package/system/dist/{addon-settings.cap-DrLdMFIe.js → addon-settings.cap-nZVHPo3X.js} +1 -1
  19. package/system/dist/{alert-episode-Be--PngO.mjs → alert-episode-D-1VUUkZ.mjs} +1 -1
  20. package/system/dist/{alert-episode-Bqktmt-i.js → alert-episode-DaQ3prSe.js} +1 -1
  21. package/system/dist/apps.cap-Bqb9NpYx.mjs +130 -0
  22. package/system/dist/apps.cap-CLjgnuUe.js +141 -0
  23. package/system/dist/{base-addon-CRsXtYFG.js → base-addon-BG7p06Hb.js} +136 -15
  24. package/system/dist/{base-addon-BcS6r1cT.mjs → base-addon-BcVoYZbC.mjs} +136 -15
  25. package/system/dist/{base-device-DAdWzDOl.js → base-device-DeSNiwZ4.js} +4 -4
  26. package/system/dist/{base-device-DJXF5eDN.mjs → base-device-w_MD0Bf4.mjs} +4 -4
  27. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  28. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  29. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  30. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  31. package/system/dist/builtins/alerts/alerts.addon.js +3 -3
  32. package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
  33. package/system/dist/builtins/apps-aggregator/aggregate-apps.d.ts +24 -0
  34. package/system/dist/builtins/apps-aggregator/apps-aggregator.addon.d.ts +16 -0
  35. package/system/dist/builtins/apps-aggregator/apps-aggregator.addon.js +109 -0
  36. package/system/dist/builtins/apps-aggregator/apps-aggregator.addon.mjs +103 -0
  37. package/system/dist/builtins/apps-aggregator/index.d.ts +1 -0
  38. package/system/dist/builtins/apps-aggregator/index.js +8 -0
  39. package/system/dist/builtins/apps-aggregator/index.mjs +2 -0
  40. package/system/dist/builtins/autotrack/index.js +1 -1
  41. package/system/dist/builtins/autotrack/index.mjs +1 -1
  42. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  43. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  44. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  45. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  46. package/system/dist/builtins/camera-grid/index.js +3 -3
  47. package/system/dist/builtins/camera-grid/index.mjs +3 -3
  48. package/system/dist/builtins/composer/composer.addon.js +7 -7
  49. package/system/dist/builtins/composer/composer.addon.mjs +7 -7
  50. package/system/dist/builtins/console-logging/index.js +1 -1
  51. package/system/dist/builtins/console-logging/index.mjs +1 -1
  52. package/system/dist/builtins/core-blocks/actions-store.d.ts +2 -0
  53. package/system/dist/builtins/core-blocks/block-supervisor.d.ts +16 -4
  54. package/system/dist/builtins/core-blocks/core-block-store.d.ts +2 -0
  55. package/system/dist/builtins/core-blocks/core-blocks.addon.js +1018 -323
  56. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +986 -291
  57. package/system/dist/builtins/core-blocks/migrations/index.d.ts +5 -2
  58. package/system/dist/builtins/core-blocks/migrations/tag-ids.d.ts +42 -0
  59. package/system/dist/builtins/core-blocks/migrations/tags-as-records.d.ts +47 -0
  60. package/system/dist/builtins/core-blocks/record-kinds.d.ts +12 -1
  61. package/system/dist/builtins/core-blocks/runs-api.d.ts +3 -1
  62. package/system/dist/builtins/core-blocks/runs-ledger.d.ts +3 -1
  63. package/system/dist/builtins/core-blocks/scheduler/scheduler-store.d.ts +2 -0
  64. package/system/dist/builtins/core-blocks/tags-service.d.ts +52 -27
  65. package/system/dist/builtins/core-blocks/tags-wiring.d.ts +2 -0
  66. package/system/dist/builtins/core-notifier/core-notifier.addon.js +76 -67
  67. package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +76 -67
  68. package/system/dist/builtins/device-history/device-history.addon.js +4 -4
  69. package/system/dist/builtins/device-history/device-history.addon.mjs +4 -4
  70. package/system/dist/builtins/device-manager/device-manager.addon.js +1618 -755
  71. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1604 -741
  72. package/system/dist/builtins/device-manager/device-meta-actions.d.ts +13 -136
  73. package/system/dist/builtins/device-manager/device-meta-types.d.ts +5 -1
  74. package/system/dist/builtins/device-manager/device-provider-context.d.ts +9 -0
  75. package/system/dist/builtins/device-manager/device-row-store.d.ts +21 -4
  76. package/system/dist/builtins/device-manager/device-search.d.ts +6 -0
  77. package/system/dist/builtins/device-manager/location-alignment.d.ts +9 -2
  78. package/system/dist/builtins/device-manager/migrate-device.d.ts +7 -2
  79. package/system/dist/builtins/device-manager/migrate-hardware-state.d.ts +132 -1
  80. package/system/dist/builtins/device-manager/migrations/device-tag-ids.d.ts +25 -0
  81. package/system/dist/builtins/device-manager/migrations/index.d.ts +16 -0
  82. package/system/dist/builtins/device-manager/migrations/orphan-children.d.ts +33 -0
  83. package/system/dist/builtins/device-manager/migrations/ports.d.ts +17 -0
  84. package/system/dist/builtins/device-manager/migrations/rooms-as-records.d.ts +52 -0
  85. package/system/dist/builtins/device-manager/record-kinds.d.ts +3 -1
  86. package/system/dist/builtins/device-manager/removal-cleanup.d.ts +7 -0
  87. package/system/dist/builtins/device-manager/room-actions.d.ts +27 -0
  88. package/system/dist/builtins/device-manager/room-store.d.ts +19 -0
  89. package/system/dist/builtins/device-manager/tag-names.d.ts +32 -0
  90. package/system/dist/builtins/device-manager/wireable-enum-catalog.d.ts +18 -0
  91. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  92. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  93. package/system/dist/builtins/keychain/index.js +3 -3
  94. package/system/dist/builtins/keychain/index.mjs +3 -3
  95. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  96. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  97. package/system/dist/builtins/local-auth/local-auth.addon.js +1 -1
  98. package/system/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  99. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  100. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  101. package/system/dist/builtins/loki-logging/index.js +2 -2
  102. package/system/dist/builtins/loki-logging/index.mjs +2 -2
  103. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  104. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  105. package/system/dist/builtins/platform-probe/index.js +1 -1
  106. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  107. package/system/dist/builtins/record-entries/index.js +1 -1
  108. package/system/dist/builtins/record-entries/index.mjs +1 -1
  109. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  110. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  111. package/system/dist/builtins/snapshot/index.js +1 -1
  112. package/system/dist/builtins/snapshot/index.mjs +1 -1
  113. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  114. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  115. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  116. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  117. package/system/dist/builtins/sqlite-storage/migrations/migration-engine.d.ts +3 -1
  118. package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +1 -0
  119. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +15 -10
  120. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +15 -10
  121. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  122. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  123. package/system/dist/builtins/system-config/system-config.addon.js +2 -2
  124. package/system/dist/builtins/system-config/system-config.addon.mjs +2 -2
  125. package/system/dist/builtins/winston-logging/index.js +2 -2
  126. package/system/dist/builtins/winston-logging/index.mjs +2 -2
  127. package/system/dist/{command-catalog-C29hVOOg.js → command-catalog-A_ONlLfF.js} +1 -1
  128. package/system/dist/{command-catalog-xAeqxbZk.mjs → command-catalog-CZDlLhxO.mjs} +1 -1
  129. package/system/dist/{composition-sources-Do5qM6EB.js → composition-sources-D1nPv7dJ.js} +1 -1
  130. package/system/dist/{composition-sources-C327LGFn.mjs → composition-sources-DubMf_ii.mjs} +1 -1
  131. package/system/dist/{core-blocks.cap-CdTGUKtr.js → core-blocks.cap-DEYCvF9J.js} +125 -373
  132. package/system/dist/{core-blocks.cap-DLkEfV5b.mjs → core-blocks.cap-sW5HLDlB.mjs} +109 -327
  133. package/system/dist/{device-manager.cap-DJs8izI6.js → device-manager.cap-B9qVf7ag.js} +163 -22
  134. package/system/dist/{device-manager.cap-eYrj1Ezp.mjs → device-manager.cap-CV4KGp3e.mjs} +134 -17
  135. package/system/dist/{error.cap-CU1FB6uE.mjs → error.cap-B8l7L8e4.mjs} +7 -1
  136. package/system/dist/{error.cap-BuKbL3Ac.js → error.cap-BqlvgBJd.js} +7 -1
  137. package/system/dist/file-host-worker.js +1 -1
  138. package/system/dist/file-host-worker.mjs +1 -1
  139. package/system/dist/index.js +8 -8
  140. package/system/dist/index.mjs +7 -7
  141. package/system/dist/{legacy-integration-rows-door-CdqYAj-o.js → legacy-integration-rows-door-BK8eoGlF.js} +1 -1
  142. package/system/dist/{legacy-integration-rows-door-LSgpClpX.mjs → legacy-integration-rows-door-CwzC5XNk.mjs} +1 -1
  143. package/system/dist/{migration-DGAc6ywR.mjs → migration-BvbfW9g-.mjs} +6 -0
  144. package/system/dist/{migration-BOQlFZCN.js → migration-CHPdAdNh.js} +6 -0
  145. package/system/dist/{prefix-walk-Mtij0NNT.mjs → named-entity-store-Cq2oVrN5.mjs} +195 -89
  146. package/system/dist/{prefix-walk-BFnw8NBu.js → named-entity-store-O_hi1y_o.js} +244 -90
  147. package/system/dist/{notification-rules.cap-BUIuYPlQ.mjs → notification-rules.cap-ClvK6QT1.mjs} +10 -5
  148. package/system/dist/{notification-rules.cap-BJKUjizS.js → notification-rules.cap-uSLoe2pA.js} +10 -5
  149. package/system/dist/{notification-targets-DMW7xgR2.js → notification-targets-ChqpBbtR.js} +2 -2
  150. package/system/dist/{notification-targets-4bGYH5J7.mjs → notification-targets-DUA6-F2t.mjs} +2 -2
  151. package/system/dist/{device-row-store-CTocYKqC.mjs → record-kinds-BD2xv4Pd.mjs} +222 -93
  152. package/system/dist/{device-row-store-C0P2H18h.js → record-kinds-BV8Gcpsx.js} +246 -93
  153. package/system/dist/records/named-entity-store.d.ts +60 -0
  154. package/system/dist/{rename-composition-block-D9Uc1AF7.js → rename-composition-block-C60O0P16.js} +137 -33
  155. package/system/dist/{rename-composition-block-Cdh-dRmY.mjs → rename-composition-block-DcX3vkwS.mjs} +137 -33
  156. package/system/dist/{retention-source.cap-C6Hy0hlM.js → retention-source.cap-A-TMhU5O.js} +1 -1
  157. package/system/dist/{retention-source.cap-550kkyp5.mjs → retention-source.cap-Ct07pM30.mjs} +1 -1
  158. package/system/dist/{storage-admin.cap-Ci4QbL6P.mjs → storage-admin.cap-C54s9_B9.mjs} +8 -2
  159. package/system/dist/{storage-admin.cap-DqW1ol4j.js → storage-admin.cap-DSPHi7ut.js} +8 -2
  160. package/system/dist/{stream-catalog.cap-CjEQFknc.js → stream-catalog.cap-7WPsugOy.js} +1 -1
  161. package/system/dist/{stream-catalog.cap-DVniDdRD.mjs → stream-catalog.cap-CzwRDaqT.mjs} +1 -1
  162. package/system/dist/{tag-BxLazvVb.js → tag-BLraBqvp.js} +12 -0
  163. package/system/dist/{tag-uZBAq6ox.mjs → tag-DU8pm9Bi.mjs} +7 -1
  164. package/system/dist/time-window-B6UhCArd.js +679 -0
  165. package/system/dist/time-window-BnUBULgu.mjs +578 -0
  166. package/system/dist/{wal-maintenance-BgYiAy5b.js → wal-maintenance-CkPfVApC.js} +0 -0
  167. package/system/dist/{wal-maintenance-Bey5ChBb.mjs → wal-maintenance-u84_1sVl.mjs} +0 -0
  168. package/system/package.json +16 -1
  169. /package/system/dist/{constants-Ba3FTIHl.js → constants-Ba3FTIHl2.js} +0 -0
  170. /package/system/dist/{constants-DB4piTD5.mjs → constants-DB4piTD52.mjs} +0 -0
@@ -0,0 +1,109 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ require("../../chunk-Cek0wNdY.js");
6
+ const require_base_addon = require("../../base-addon-BG7p06Hb.js");
7
+ const require_apps_cap = require("../../apps.cap-CLjgnuUe.js");
8
+ const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
9
+ //#region src/builtins/apps-aggregator/aggregate-apps.ts
10
+ /** Per-source ceiling: one dead provider must not stall the shell's app list. */
11
+ var APPS_PER_SOURCE_TIMEOUT_MS = 2500;
12
+ function offeredTo(app, caller) {
13
+ if (app.adminOnly && !caller.isAdmin) return false;
14
+ if (app.roles !== void 0 && !app.roles.includes(caller.isAdmin ? "admin" : "user")) return false;
15
+ return true;
16
+ }
17
+ function visibleNav(nav, caller) {
18
+ return nav.map((section) => ({
19
+ ...section,
20
+ items: section.items.filter((item) => caller.isAdmin || item.adminOnly !== true)
21
+ }));
22
+ }
23
+ /** Ordered apps first, ascending; an app with no `order` goes after them. */
24
+ function compareOrder(a, b) {
25
+ if (a === void 0) return b === void 0 ? 0 : 1;
26
+ if (b === void 0) return -1;
27
+ return a - b;
28
+ }
29
+ /**
30
+ * Merge every `app-source` provider into the caller's list (D1096): stamp the
31
+ * provider id, drop what the caller's role may not see, order by `order`.
32
+ * A provider that fails or times out is logged with its reason and answered
33
+ * from its last good snapshot (`lastGood`, owned by the caller) or skipped when
34
+ * it has none. The same app reported by several nodes (a collection registers
35
+ * one provider per node) is listed once, keyed on `(addonId, app.id)`, the
36
+ * first provider winning: the hub-local one precedes remote ones.
37
+ */
38
+ async function aggregateApps(sources, caller, logger, lastGood = /* @__PURE__ */ new Map()) {
39
+ const settled = await require_settle_sources.settleSourcesWithTimeout(sources.map((source) => [source.id, () => Promise.resolve(source.listApps())]), APPS_PER_SOURCE_TIMEOUT_MS);
40
+ const out = [];
41
+ const seen = /* @__PURE__ */ new Set();
42
+ const live = /* @__PURE__ */ new Set();
43
+ for (const [sourceId, result] of settled) {
44
+ live.add(sourceId);
45
+ let declared;
46
+ if (result.ok) {
47
+ declared = result.value;
48
+ lastGood.set(sourceId, declared);
49
+ } else {
50
+ logger.warn("app-source provider failed", { meta: {
51
+ sourceId,
52
+ error: result.error.message
53
+ } });
54
+ declared = lastGood.get(sourceId);
55
+ if (declared !== void 0) logger.warn("app-source serving its last good snapshot", { meta: {
56
+ sourceId,
57
+ apps: declared.length
58
+ } });
59
+ }
60
+ for (const app of declared ?? []) {
61
+ if (!offeredTo(app, caller)) continue;
62
+ const key = `${sourceId}::${app.id}`;
63
+ if (seen.has(key)) continue;
64
+ seen.add(key);
65
+ out.push({
66
+ addonId: sourceId,
67
+ app: {
68
+ ...app,
69
+ nav: visibleNav(app.nav, caller)
70
+ }
71
+ });
72
+ }
73
+ }
74
+ for (const cachedId of lastGood.keys()) if (!live.has(cachedId)) lastGood.delete(cachedId);
75
+ return out.sort((a, b) => compareOrder(a.app.order, b.app.order));
76
+ }
77
+ //#endregion
78
+ //#region src/builtins/apps-aggregator/apps-aggregator.addon.ts
79
+ /**
80
+ * Apps Aggregator — hub-local builtin that owns the singleton `apps` cap (D1096).
81
+ *
82
+ * Walks every `app-source` (collection) provider, stamps each app with the
83
+ * provider's addon id and filters by the caller's role. The shell reads it; no
84
+ * app id is spelled anywhere else.
85
+ */
86
+ var AppsAggregatorAddon = class extends require_base_addon.BaseAddon {
87
+ id = "apps-aggregator";
88
+ /** Last good declarations per source, the fallback for a transient failure. */
89
+ lastGood = /* @__PURE__ */ new Map();
90
+ constructor() {
91
+ super({});
92
+ }
93
+ async onInitialize() {
94
+ const provider = {
95
+ listApps: async (input) => {
96
+ return aggregateApps(this.capabilities?.getCollection("app-source") ?? [], input.caller, this.ctx.logger, this.lastGood);
97
+ },
98
+ getNavBadges: async () => ({})
99
+ };
100
+ this.ctx.logger.info("Initialized — aggregating app-source providers");
101
+ return [{
102
+ capability: require_apps_cap.appsCapability,
103
+ provider
104
+ }];
105
+ }
106
+ };
107
+ //#endregion
108
+ exports.AppsAggregatorAddon = AppsAggregatorAddon;
109
+ exports.default = AppsAggregatorAddon;
@@ -0,0 +1,103 @@
1
+ import { t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
2
+ import { t as appsCapability } from "../../apps.cap-Bqb9NpYx.mjs";
3
+ import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
4
+ //#region src/builtins/apps-aggregator/aggregate-apps.ts
5
+ /** Per-source ceiling: one dead provider must not stall the shell's app list. */
6
+ var APPS_PER_SOURCE_TIMEOUT_MS = 2500;
7
+ function offeredTo(app, caller) {
8
+ if (app.adminOnly && !caller.isAdmin) return false;
9
+ if (app.roles !== void 0 && !app.roles.includes(caller.isAdmin ? "admin" : "user")) return false;
10
+ return true;
11
+ }
12
+ function visibleNav(nav, caller) {
13
+ return nav.map((section) => ({
14
+ ...section,
15
+ items: section.items.filter((item) => caller.isAdmin || item.adminOnly !== true)
16
+ }));
17
+ }
18
+ /** Ordered apps first, ascending; an app with no `order` goes after them. */
19
+ function compareOrder(a, b) {
20
+ if (a === void 0) return b === void 0 ? 0 : 1;
21
+ if (b === void 0) return -1;
22
+ return a - b;
23
+ }
24
+ /**
25
+ * Merge every `app-source` provider into the caller's list (D1096): stamp the
26
+ * provider id, drop what the caller's role may not see, order by `order`.
27
+ * A provider that fails or times out is logged with its reason and answered
28
+ * from its last good snapshot (`lastGood`, owned by the caller) or skipped when
29
+ * it has none. The same app reported by several nodes (a collection registers
30
+ * one provider per node) is listed once, keyed on `(addonId, app.id)`, the
31
+ * first provider winning: the hub-local one precedes remote ones.
32
+ */
33
+ async function aggregateApps(sources, caller, logger, lastGood = /* @__PURE__ */ new Map()) {
34
+ const settled = await settleSourcesWithTimeout(sources.map((source) => [source.id, () => Promise.resolve(source.listApps())]), APPS_PER_SOURCE_TIMEOUT_MS);
35
+ const out = [];
36
+ const seen = /* @__PURE__ */ new Set();
37
+ const live = /* @__PURE__ */ new Set();
38
+ for (const [sourceId, result] of settled) {
39
+ live.add(sourceId);
40
+ let declared;
41
+ if (result.ok) {
42
+ declared = result.value;
43
+ lastGood.set(sourceId, declared);
44
+ } else {
45
+ logger.warn("app-source provider failed", { meta: {
46
+ sourceId,
47
+ error: result.error.message
48
+ } });
49
+ declared = lastGood.get(sourceId);
50
+ if (declared !== void 0) logger.warn("app-source serving its last good snapshot", { meta: {
51
+ sourceId,
52
+ apps: declared.length
53
+ } });
54
+ }
55
+ for (const app of declared ?? []) {
56
+ if (!offeredTo(app, caller)) continue;
57
+ const key = `${sourceId}::${app.id}`;
58
+ if (seen.has(key)) continue;
59
+ seen.add(key);
60
+ out.push({
61
+ addonId: sourceId,
62
+ app: {
63
+ ...app,
64
+ nav: visibleNav(app.nav, caller)
65
+ }
66
+ });
67
+ }
68
+ }
69
+ for (const cachedId of lastGood.keys()) if (!live.has(cachedId)) lastGood.delete(cachedId);
70
+ return out.sort((a, b) => compareOrder(a.app.order, b.app.order));
71
+ }
72
+ //#endregion
73
+ //#region src/builtins/apps-aggregator/apps-aggregator.addon.ts
74
+ /**
75
+ * Apps Aggregator — hub-local builtin that owns the singleton `apps` cap (D1096).
76
+ *
77
+ * Walks every `app-source` (collection) provider, stamps each app with the
78
+ * provider's addon id and filters by the caller's role. The shell reads it; no
79
+ * app id is spelled anywhere else.
80
+ */
81
+ var AppsAggregatorAddon = class extends BaseAddon {
82
+ id = "apps-aggregator";
83
+ /** Last good declarations per source, the fallback for a transient failure. */
84
+ lastGood = /* @__PURE__ */ new Map();
85
+ constructor() {
86
+ super({});
87
+ }
88
+ async onInitialize() {
89
+ const provider = {
90
+ listApps: async (input) => {
91
+ return aggregateApps(this.capabilities?.getCollection("app-source") ?? [], input.caller, this.ctx.logger, this.lastGood);
92
+ },
93
+ getNavBadges: async () => ({})
94
+ };
95
+ this.ctx.logger.info("Initialized — aggregating app-source providers");
96
+ return [{
97
+ capability: appsCapability,
98
+ provider
99
+ }];
100
+ }
101
+ };
102
+ //#endregion
103
+ export { AppsAggregatorAddon, AppsAggregatorAddon as default };
@@ -0,0 +1 @@
1
+ export { AppsAggregatorAddon, default } from "./apps-aggregator.addon.js";
@@ -0,0 +1,8 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ require("../../chunk-Cek0wNdY.js");
6
+ const require_builtins_apps_aggregator_apps_aggregator_addon = require("./apps-aggregator.addon.js");
7
+ exports.AppsAggregatorAddon = require_builtins_apps_aggregator_apps_aggregator_addon.AppsAggregatorAddon;
8
+ exports.default = require_builtins_apps_aggregator_apps_aggregator_addon.AppsAggregatorAddon;
@@ -0,0 +1,2 @@
1
+ import { AppsAggregatorAddon } from "./apps-aggregator.addon.mjs";
2
+ export { AppsAggregatorAddon, AppsAggregatorAddon as default };
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-CRsXtYFG.js");
6
+ const require_base_addon = require("../../base-addon-BG7p06Hb.js");
7
7
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
8
8
  const require_labels = require("../../labels-DX5S8deC.js");
9
9
  const require_ptz_autotrack_cap = require("../../ptz-autotrack.cap-B9eyZU8w.js");
@@ -1,4 +1,4 @@
1
- import { b as EventCategory, h as isEvent, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
1
+ import { b as EventCategory, h as isEvent, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
2
2
  import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
3
3
  import { n as FIRST_LEVEL_MACRO_CLASSES } from "../../labels-DsBcU7md.mjs";
4
4
  import { t as ptzAutotrackCapability } from "../../ptz-autotrack.cap-Dw2k-po9.mjs";
@@ -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_base_addon = require("../../base-addon-CRsXtYFG.js");
6
+ const require_base_addon = require("../../base-addon-BG7p06Hb.js");
7
7
  const require_storage_location_mode = require("../../storage-location-mode-CS4sMzo-.js");
8
8
  const require_storage_occupancy_cap = require("../../storage-occupancy.cap-B-Z8f8TZ.js");
9
9
  const require_cap_call_context = require("../../cap-call-context-Bd76CbOW.js");
@@ -1,4 +1,4 @@
1
- import { b as EventCategory, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
1
+ import { b as EventCategory, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
2
2
  import { o as mayWriteToLocation } from "../../storage-location-mode-B21UVRRX.mjs";
3
3
  import { n as backupCapability, t as storageOccupancyCapability } from "../../storage-occupancy.cap-B-wbMPmx.mjs";
4
4
  import { n as nodePin, r as toNodeId } from "../../cap-call-context-DNwdgGSQ.mjs";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-CRsXtYFG.js");
6
+ const require_base_addon = require("../../base-addon-BG7p06Hb.js");
7
7
  const require_record_kind = require("../../record-kind-DoBfYHCs.js");
8
8
  const require_calendars_cap = require("../../calendars.cap-CGeOtL7Q.js");
9
9
  const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
@@ -1,4 +1,4 @@
1
- import { t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
1
+ import { t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
2
2
  import { s as defineRecordKinds } from "../../record-kind-ub6NXqfh.mjs";
3
3
  import { n as calendarsCapability, t as CalendarPreferencesSchema } from "../../calendars.cap-DQc6Q6qS.mjs";
4
4
  import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_stream_catalog_cap = require("../../stream-catalog.cap-CjEQFknc.js");
7
- const require_base_addon = require("../../base-addon-CRsXtYFG.js");
6
+ const require_stream_catalog_cap = require("../../stream-catalog.cap-7WPsugOy.js");
7
+ const require_base_addon = require("../../base-addon-BG7p06Hb.js");
8
8
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
9
9
  const require_pinned_binary = require("../../pinned-binary-BOhOSNff.js");
10
10
  const require_device_identifiers = require("../../device-identifiers-BQg9EQi1.js");
@@ -12,7 +12,7 @@ const require_device_type = require("../../device-type-Cnc0NiSX.js");
12
12
  const require_compile = require("../../compile-SpeAhaZ6.js");
13
13
  const require_snapshot_cap = require("../../snapshot.cap-CHm29hBs.js");
14
14
  const require_declared_device = require("../../declared-device-BWphj9WE.js");
15
- const require_base_device = require("../../base-device-DAdWzDOl.js");
15
+ const require_base_device = require("../../base-device-DeSNiwZ4.js");
16
16
  const require_addon_id = require("../../addon-id-Di0lNJ89.js");
17
17
  let zod = require("zod");
18
18
  let _camstack_types_node = require("@camstack/types/node");
@@ -1,5 +1,5 @@
1
- import { D as cameraGridLayoutCapability, i as motionCapability, n as MOTION_CLOSE_AFTER_MS, t as streamCatalogCapability } from "../../stream-catalog.cap-DVniDdRD.mjs";
2
- import { _ as hydrateSchema, b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
1
+ import { D as cameraGridLayoutCapability, i as motionCapability, n as MOTION_CLOSE_AFTER_MS, t as streamCatalogCapability } from "../../stream-catalog.cap-CzwRDaqT.mjs";
2
+ import { _ as hydrateSchema, b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
3
3
  import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
4
4
  import { t as memoizePinnedFfmpeg } from "../../pinned-binary-CrIRAi4G.mjs";
5
5
  import { f as DERIVED_CAMERA_SILENCED_CAP_NAMES } from "../../device-identifiers-iSuQCKmK.mjs";
@@ -7,7 +7,7 @@ import { t as DeviceFeature } from "../../device-type-TUGqGmaI.mjs";
7
7
  import { F as COMPOSED_DEVICE_STABLE_ID_PREFIX, t as compileHelper, v as COMPOSER_ADDON_ID } from "../../compile-OBMHlqD-.mjs";
8
8
  import { t as snapshotCapability } from "../../snapshot.cap-CO68YvJU.mjs";
9
9
  import { n as declarationOwnerNodeId, t as DeclaredDevices } from "../../declared-device-CKERA1Hi.mjs";
10
- import { t as BaseDevice } from "../../base-device-DJXF5eDN.mjs";
10
+ import { t as BaseDevice } from "../../base-device-w_MD0Bf4.mjs";
11
11
  import { t as bareAddonId } from "../../addon-id-CVg1_r5E.mjs";
12
12
  import { z } from "zod";
13
13
  import { FfmpegProcess } from "@camstack/types/node";
@@ -3,19 +3,19 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_stream_catalog_cap = require("../../stream-catalog.cap-CjEQFknc.js");
7
- const require_base_addon = require("../../base-addon-CRsXtYFG.js");
6
+ const require_stream_catalog_cap = require("../../stream-catalog.cap-7WPsugOy.js");
7
+ const require_base_addon = require("../../base-addon-BG7p06Hb.js");
8
8
  const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
9
- const require_rename_composition_block = require("../../rename-composition-block-D9Uc1AF7.js");
9
+ const require_rename_composition_block = require("../../rename-composition-block-C60O0P16.js");
10
10
  const require_quantity = require("../../quantity-lY1KiTSZ.js");
11
11
  const require_device_type = require("../../device-type-Cnc0NiSX.js");
12
- const require_addon_settings_cap = require("../../addon-settings.cap-DrLdMFIe.js");
13
- const require_core_blocks_cap = require("../../core-blocks.cap-CdTGUKtr.js");
12
+ const require_core_blocks_cap = require("../../core-blocks.cap-DEYCvF9J.js");
13
+ const require_addon_settings_cap = require("../../addon-settings.cap-nZVHPo3X.js");
14
14
  const require_compile = require("../../compile-SpeAhaZ6.js");
15
15
  const require_source_info = require("../../source-info-DtWf4k2j.js");
16
- const require_composition_sources = require("../../composition-sources-Do5qM6EB.js");
16
+ const require_composition_sources = require("../../composition-sources-D1nPv7dJ.js");
17
17
  const require_declared_device = require("../../declared-device-BWphj9WE.js");
18
- const require_base_device = require("../../base-device-DAdWzDOl.js");
18
+ const require_base_device = require("../../base-device-DeSNiwZ4.js");
19
19
  const require_capture_engine = require("../../capture-engine-D_1IJmMs.js");
20
20
  const require_retention = require("../../retention-xcjk_k1w.js");
21
21
  let zod = require("zod");
@@ -1,16 +1,16 @@
1
- import { i as motionCapability } from "../../stream-catalog.cap-DVniDdRD.mjs";
2
- import { b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
1
+ import { i as motionCapability } from "../../stream-catalog.cap-CzwRDaqT.mjs";
2
+ import { b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
3
3
  import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
4
- import { An as colorCapability, E as valveCapability, En as consumablesCapability, Jt as groupCommandsCapability, Kt as GroupCommandResultSchema, Ln as brightnessCapability, Nn as HvacModeSchema, On as composerCapability, Pn as climateControlCapability, U as RUNNING_CUSTOMIZE_DEVICE_TYPES, c as kebabToCamel, ct as petFountainWaterItem, gt as lockControlCapability, in as FanDirectionSchema, jn as parseColorInput, m as ALL_CAPABILITY_DEFINITIONS, n as renameCompositionBlock, ot as PetFountainStatusSchema, sn as fanControlCapability, st as petFountainCapability, wn as ConsumableItemSchema, xn as coverCapability, z as switchCapability } from "../../rename-composition-block-Cdh-dRmY.mjs";
4
+ import { An as colorCapability, E as valveCapability, En as consumablesCapability, Jt as groupCommandsCapability, Kt as GroupCommandResultSchema, Ln as brightnessCapability, Nn as HvacModeSchema, On as composerCapability, Pn as climateControlCapability, U as RUNNING_CUSTOMIZE_DEVICE_TYPES, c as kebabToCamel, ct as petFountainWaterItem, gt as lockControlCapability, in as FanDirectionSchema, jn as parseColorInput, m as ALL_CAPABILITY_DEFINITIONS, n as renameCompositionBlock, ot as PetFountainStatusSchema, sn as fanControlCapability, st as petFountainCapability, wn as ConsumableItemSchema, xn as coverCapability, z as switchCapability } from "../../rename-composition-block-DcX3vkwS.mjs";
5
5
  import { i as isReadingQuantity } from "../../quantity-D3g5SxsZ.mjs";
6
6
  import { i as featuresOfBoundCaps, r as DeviceType, t as DeviceFeature } from "../../device-type-TUGqGmaI.mjs";
7
- import { a as tryConvertUnit } from "../../addon-settings.cap-CZ4MC7ha.mjs";
8
- import { D as featureForwards, E as commandedMethods, O as COMPOSED_ITEM_FIXED_FIELDS, g as planComposition, j as mediaPlayerCapability, k as expressionContainsBuiltinCall, nt as compositionFieldKey, p as buildCapabilityLookup } from "../../core-blocks.cap-DLkEfV5b.mjs";
7
+ import { D as featureForwards, E as commandedMethods, O as COMPOSED_ITEM_FIXED_FIELDS, g as planComposition, j as mediaPlayerCapability, k as expressionContainsBuiltinCall, nt as compositionFieldKey, p as buildCapabilityLookup } from "../../core-blocks.cap-sW5HLDlB.mjs";
8
+ import { a as tryConvertUnit } from "../../addon-settings.cap-CHpmuaQG.mjs";
9
9
  import { $ as statisticCadenceMs, A as compositionSourceKey, D as compositionItemFieldPath, E as compositionFeatureEnabled, G as HOUR_MS, H as DEFAULT_HISTORY_RETENTION, J as nextLocalMidnight, K as MINUTE_MS, P as isForwardInputRef, Q as planStatisticTier, R as isEngineHostedHelper, T as composedDeviceStableId, U as HISTORY_FAST_MS, W as HISTORY_SLOW_MS, X as openStatistic, Y as openReset, Z as planResetTier, at as cloneStatefulExpressionMemory, ct as evaluateStatefulExpressionCall, d as fanOutTargets, et as evaluateDerivative, f as runFanOut, gt as evaluateCount, ht as disarmRoseMemory, k as compositionSliceKey, lt as toExpressionValue, m as groupTemplate, nt as integrateReading, ot as createStatefulExpressionMemory, p as sharedColorModes, q as historyRetentionFromSettings, st as evaluateExpressionSource, tt as evaluateStatistic, u as declaredSeriesKind, v as COMPOSER_ADDON_ID, w as composedDeviceRef, z as isHistoryHelper } from "../../compile-OBMHlqD-.mjs";
10
10
  import { a as normalizeUnit } from "../../source-info-DGB7SdB_.mjs";
11
- import { n as normalizedNativeOwner, r as compileScalarOverride } from "../../composition-sources-C327LGFn.mjs";
11
+ import { n as normalizedNativeOwner, r as compileScalarOverride } from "../../composition-sources-DubMf_ii.mjs";
12
12
  import { t as DeclaredDevices } from "../../declared-device-CKERA1Hi.mjs";
13
- import { t as BaseDevice } from "../../base-device-DJXF5eDN.mjs";
13
+ import { t as BaseDevice } from "../../base-device-w_MD0Bf4.mjs";
14
14
  import { i as capSeriesKey, m as parseConfirmedStateChanged, p as isRecord$4 } from "../../capture-engine-B2MmoNND.mjs";
15
15
  import { i as DAY_MS, t as DEFAULT_RETENTION } from "../../retention-CQs8QR1B.mjs";
16
16
  import { z } from "zod";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_base_addon = require("../../base-addon-CRsXtYFG.js");
6
+ const require_base_addon = require("../../base-addon-BG7p06Hb.js");
7
7
  const require_log_destination_cap = require("../../log-destination.cap-BzTWMj-T.js");
8
8
  const require_formatter = require("../../formatter-xbxeV4GD.js");
9
9
  //#region src/builtins/console-logging/console-destination.ts
@@ -1,4 +1,4 @@
1
- import { t as BaseAddon } from "../../base-addon-BcS6r1cT.mjs";
1
+ import { t as BaseAddon } from "../../base-addon-BcVoYZbC.mjs";
2
2
  import { t as logDestinationCapability } from "../../log-destination.cap-QYMJPJwK.mjs";
3
3
  import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
4
4
  //#region src/builtins/console-logging/console-destination.ts
@@ -31,6 +31,8 @@ export declare class ActionsStore {
31
31
  update(actionId: string, input: ActionInput): Promise<ActionEntry>;
32
32
  /** Replace the tags of an internal action; its steps and `updatedAt` are left as they are. */
33
33
  setTags(actionId: string, tags: readonly string[]): Promise<void>;
34
+ /** Replace the tag ids of an internal action (D1089); everything else is left as it is. */
35
+ setTagIds(actionId: string, tagIds: readonly string[]): Promise<void>;
34
36
  delete(actionId: string): Promise<boolean>;
35
37
  /** The action ids a camera links (possibly dangling: the caller joins them with the live list). */
36
38
  linksOf(deviceId: number): Promise<readonly string[]>;
@@ -133,9 +133,13 @@ export declare class BlockSupervisor {
133
133
  * then never re-launch it.
134
134
  */
135
135
  /**
136
- * The block row is already gone. The next apply names it retired so its
137
- * claims are released before this resolves. A release that does not land is
138
- * returned; the id stays retired so the following pass tries again.
136
+ * The block row is already gone. ONE composer apply names it retired so its
137
+ * claims are released before this resolves. It is NOT queued on the converge
138
+ * chain: that chain also launches, stops and reports every code block, and a
139
+ * delete waiting behind a pass that is compiling or spawning one paid for all
140
+ * of it. The composer serialises its own applies, so this one is ordered
141
+ * against a concurrent pass there. A release that does not land is returned;
142
+ * the id stays retired so the following pass tries again.
139
143
  */
140
144
  retireComposition(blockId: string): Promise<readonly UnreleasedClaim[]>;
141
145
  /**
@@ -154,7 +158,15 @@ export declare class BlockSupervisor {
154
158
  * pass of this same converge is the retry — no timer of its own (D3).
155
159
  */
156
160
  private convergeCompositions;
157
- private claimsOf;
161
+ private releaseRetired;
162
+ /**
163
+ * After an apply that acted: an id it SENT stays retired only while it still
164
+ * holds a claim; an id added meanwhile (not in `sent`) is left alone — a
165
+ * concurrent apply must not forget a retirement it never carried.
166
+ */
167
+ private settleRetired;
168
+ /** What one composer apply carries: every composition placed here, plus the retired ids. */
169
+ private compositionApplyInput;
158
170
  /** Remember which retired ids still hold a claim. An apply that did not act keeps every id. */
159
171
  private noteRelease;
160
172
  /** Compile, write the package, spawn. Each failure is reported ON the block
@@ -95,6 +95,8 @@ export declare class CoreBlockStore {
95
95
  * `expectedUpdatedAt`, and a tag rename must not make its next save stale.
96
96
  */
97
97
  setTags(blockId: string, tags: readonly string[]): Promise<void>;
98
+ /** Replace the tag ids of a block (D1089); everything else is left as it is. */
99
+ setTagIds(blockId: string, tagIds: readonly string[]): Promise<void>;
98
100
  /**
99
101
  * Store a composition block (D659): hub-placed, no code, never `running` on
100
102
  * creation — the composer's verdict, mirrored by the supervisor, says that.