@camstack/server 1.2.178 → 1.2.180

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.
@@ -80,6 +80,7 @@ const lifecycle_runner_singleton_js_1 = require("../../core/lifecycle/lifecycle-
80
80
  const agent_installed_packages_js_1 = require("../../core/updates/agent-installed-packages.js");
81
81
  const http_request_census_singleton_js_1 = require("../trpc/http-request-census.singleton.js");
82
82
  const collection_preference_js_1 = require("./collection-preference.js");
83
+ const load_contributions_js_1 = require("./load-contributions.js");
83
84
  const logging_settings_js_1 = require("./logging-settings.js");
84
85
  const request_census_settings_js_1 = require("./request-census-settings.js");
85
86
  const site_location_js_1 = require("./site-location.js");
@@ -105,6 +106,12 @@ function buildSystemProvider(feature, registry, logger, census = (0, http_reques
105
106
  const channels = (0, logging_settings_js_1.buildLogChannelPlane)({ entries: () => registry?.getCollectionEntries('log-channels') ?? [] }, (addonId, phase, error) => {
106
107
  logger?.warn('log-channels provider unreachable', { meta: { addonId, phase, error } });
107
108
  });
109
+ // Every addon's OWN reported cost, assembled by enumeration. Nothing here
110
+ // knows which pid belongs to which camera — the addon that spawned the child
111
+ // does, and it is the one that says so.
112
+ const loadContributions = (0, load_contributions_js_1.buildLoadContributionPlane)({ entries: () => registry?.getCollectionEntries('load-contribution') ?? [] }, (addonId, error) => {
113
+ logger?.warn('load-contribution provider unreachable', { meta: { addonId, error } });
114
+ });
108
115
  const loggingSettings = new logging_settings_js_1.LoggingSettingsService({
109
116
  store,
110
117
  gate: (0, system_1.getLoggingGate)(),
@@ -131,6 +138,7 @@ function buildSystemProvider(feature, registry, logger, census = (0, http_reques
131
138
  }
132
139
  return result;
133
140
  },
141
+ getLoadContributions: async () => loadContributions.contributions(),
134
142
  getRetentionConfig: async () => getRetention(registry)?.getConfig() ?? null,
135
143
  setRetentionConfig: async (input) => {
136
144
  getRetention(registry)?.setConfig(input);
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EMPTY_LOAD_CONTRIBUTION_PLANE = void 0;
4
+ exports.buildLoadContributionPlane = buildLoadContributionPlane;
5
+ const types_1 = require("@camstack/types");
6
+ /** A plane that reaches nothing. The shape of a hub with no addon booted yet. */
7
+ exports.EMPTY_LOAD_CONTRIBUTION_PLANE = {
8
+ contributions: async () => [],
9
+ };
10
+ function buildLoadContributionPlane(source, onProviderError) {
11
+ return {
12
+ contributions: async () => {
13
+ const out = [];
14
+ for (const [addonId, provider] of source.entries()) {
15
+ try {
16
+ for (const entry of await provider.list()) {
17
+ out.push({ ...entry, addonId });
18
+ }
19
+ }
20
+ catch (err) {
21
+ onProviderError?.(addonId, (0, types_1.errMsg)(err));
22
+ }
23
+ }
24
+ return out;
25
+ },
26
+ };
27
+ }
@@ -2,7 +2,7 @@
2
2
  // AUTO-GENERATED by scripts/generate-cap-mounts.ts — DO NOT EDIT
3
3
  // Re-run: npx tsx scripts/generate-cap-mounts.ts
4
4
  //
5
- // Mounted: 147 Skipped (legacy): 3
5
+ // Mounted: 148 Skipped (legacy): 3
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.LEGACY_SHAPE_SKIP = void 0;
8
8
  exports.mountAllCaps = mountAllCaps;
@@ -254,6 +254,22 @@ function mountAllCaps(services) {
254
254
  };
255
255
  }, remoteCapProxy),
256
256
  llmRuntime: (0, generated_cap_routers_js_1.createCapRouter_llmRuntime)((_ctx) => reg?.getSingleton('llm-runtime') ?? null, remoteCapProxy),
257
+ loadContribution: (0, generated_cap_routers_js_1.createCapRouter_loadContribution)((_ctx, addonId) => {
258
+ if (!reg)
259
+ return null;
260
+ if (addonId !== undefined) {
261
+ return reg.getProviderByAddonId('load-contribution', addonId);
262
+ }
263
+ const entries = reg.getCollectionEntries('load-contribution');
264
+ if (entries.length === 0)
265
+ return null;
266
+ const providers = entries.map(([, p]) => p);
267
+ const first = providers[0];
268
+ return {
269
+ ...first,
270
+ list: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'list'),
271
+ };
272
+ }, remoteCapProxy),
257
273
  localNetwork: (0, generated_cap_routers_js_1.createCapRouter_localNetwork)((_ctx) => reg?.getSingleton('local-network') ?? null, remoteCapProxy),
258
274
  lockControl: (0, generated_cap_routers_js_1.createCapRouter_lockControl)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'lock-control'), remoteCapProxy),
259
275
  logChannels: (0, generated_cap_routers_js_1.createCapRouter_logChannels)((_ctx, addonId) => {