@camstack/server 1.2.594 → 1.2.596

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 (255) hide show
  1. package/dist/addon-root-inventory.js +50 -11
  2. package/dist/agent/addon-scan.js +44 -6
  3. package/dist/agent/agent-addon-runtime.js +8 -3
  4. package/dist/agent/agent-addon-updates.js +52 -12
  5. package/dist/agent/agent-cap-dispatch-service.js +5 -3
  6. package/dist/agent/agent-config.js +42 -7
  7. package/dist/agent/agent-deploy-swap.js +41 -5
  8. package/dist/agent/agent-group-runner.js +47 -8
  9. package/dist/agent/agent-http-auth.js +22 -10
  10. package/dist/agent/agent-http.js +113 -64
  11. package/dist/agent/agent-hub-addon-update.js +16 -10
  12. package/dist/agent/agent-hub-registration.js +7 -4
  13. package/dist/agent/agent-infra-capabilities.js +9 -5
  14. package/dist/agent/agent-json-file.js +42 -5
  15. package/dist/agent/agent-mesh-gate.js +8 -5
  16. package/dist/agent/agent-node-certificates.js +28 -25
  17. package/dist/agent/agent-pairing-local.js +47 -10
  18. package/dist/agent/agent-pairing-routes.js +20 -16
  19. package/dist/agent/agent-pairing-store.js +58 -18
  20. package/dist/agent/agent-reconnect.js +4 -1
  21. package/dist/agent/agent-service.js +71 -35
  22. package/dist/agent/agent-sniffing-listener.js +48 -11
  23. package/dist/agent/agent-undeploy.js +41 -5
  24. package/dist/agent/agent-update-routes.js +19 -14
  25. package/dist/agent/agent-update-service.js +80 -38
  26. package/dist/agent/apply-model-distribution.js +4 -1
  27. package/dist/agent/apply-stage-dev-uploads.js +9 -6
  28. package/dist/agent/derive-hub-url.js +8 -3
  29. package/dist/agent/fetch-bundle-from-hub.js +9 -6
  30. package/dist/agent/hubs-found.js +43 -6
  31. package/dist/agent/infra-boot-guard.js +4 -1
  32. package/dist/agent/infra-boot-plan.js +6 -2
  33. package/dist/agent/main.js +183 -148
  34. package/dist/agent/register-agent-cap-dispatch.js +6 -3
  35. package/dist/agent/serial-queue.js +7 -2
  36. package/dist/agent-status-page.js +4 -1
  37. package/dist/api/addon-upload.js +61 -22
  38. package/dist/api/agent-addon-delivery.js +11 -6
  39. package/dist/api/auth-whoami.js +4 -1
  40. package/dist/api/backup-download-pump.js +9 -5
  41. package/dist/api/backup-download.js +10 -7
  42. package/dist/api/core/addon-settings.router.js +19 -16
  43. package/dist/api/core/agent-pairing.router.js +79 -76
  44. package/dist/api/core/agents.router.js +24 -21
  45. package/dist/api/core/auth-admin-tokens.procedures.js +52 -48
  46. package/dist/api/core/auth-device-cert.procedures.js +67 -62
  47. package/dist/api/core/auth-limits.js +25 -16
  48. package/dist/api/core/auth-reauth.procedures.js +37 -32
  49. package/dist/api/core/auth-revoke-credentials.procedures.js +26 -22
  50. package/dist/api/core/auth-sessions.procedures.js +56 -52
  51. package/dist/api/core/auth.router.js +304 -300
  52. package/dist/api/core/cap-providers.js +121 -74
  53. package/dist/api/core/capabilities.router.js +37 -34
  54. package/dist/api/core/capability-preference-writes.js +17 -10
  55. package/dist/api/core/certificates.router.js +109 -106
  56. package/dist/api/core/cluster-nodes.router.js +18 -15
  57. package/dist/api/core/collection-preference.js +6 -2
  58. package/dist/api/core/event-bus-proxy.router.js +37 -34
  59. package/dist/api/core/failure-contributions.js +8 -4
  60. package/dist/api/core/hwaccel.router.js +20 -17
  61. package/dist/api/core/integration-secrets.js +12 -8
  62. package/dist/api/core/lifecycle-job-runner.js +49 -13
  63. package/dist/api/core/live-events.router.js +32 -29
  64. package/dist/api/core/load-contributions.js +8 -4
  65. package/dist/api/core/logging-settings.js +43 -30
  66. package/dist/api/core/logs.router.js +43 -40
  67. package/dist/api/core/notifications.router.js +18 -15
  68. package/dist/api/core/public-event-filter.js +8 -4
  69. package/dist/api/core/repl.router.js +21 -18
  70. package/dist/api/core/request-census-settings.js +16 -11
  71. package/dist/api/core/server-management.provider.js +4 -1
  72. package/dist/api/core/server-name.js +17 -9
  73. package/dist/api/core/site-location.js +24 -16
  74. package/dist/api/core/stream-probe.router.js +24 -21
  75. package/dist/api/core/system-events.router.js +26 -23
  76. package/dist/api/cors/cors-policy.js +29 -20
  77. package/dist/api/cors/register-cors-policy.js +14 -9
  78. package/dist/api/deploy-stage-registry.js +10 -6
  79. package/dist/api/dev-uploads-bundle.js +50 -12
  80. package/dist/api/health/adaptive-probe.routes.js +13 -9
  81. package/dist/api/health/health.routes.js +13 -8
  82. package/dist/api/hub-cluster-url.js +9 -3
  83. package/dist/api/model-distributor.js +50 -12
  84. package/dist/api/oauth2/consent-page.js +13 -10
  85. package/dist/api/oauth2/oauth2-routes.js +25 -17
  86. package/dist/api/oauth2/private-host.js +4 -1
  87. package/dist/api/server-upload-propagate.js +51 -15
  88. package/dist/api/server-upload.js +50 -13
  89. package/dist/api/sse-no-compression.js +4 -1
  90. package/dist/api/static/frame-policy.js +9 -4
  91. package/dist/api/static/precompressed-asset.js +57 -15
  92. package/dist/api/static/spa-mount.js +47 -8
  93. package/dist/api/static/spa-static.js +12 -5
  94. package/dist/api/tarball-manifest.js +44 -7
  95. package/dist/api/trpc/cap-mount-helpers.js +12 -7
  96. package/dist/api/trpc/cap-route-error-formatter.js +13 -10
  97. package/dist/api/trpc/cap-router-runtime.js +51 -40
  98. package/dist/api/trpc/client-ip.js +20 -9
  99. package/dist/api/trpc/core-cap-bridge.js +42 -32
  100. package/dist/api/trpc/device-collection-dispatch.js +27 -23
  101. package/dist/api/trpc/device-config-secret-redaction.js +40 -24
  102. package/dist/api/trpc/generated-cap-mounts.js +225 -219
  103. package/dist/api/trpc/generated-cap-routers.js +5167 -4852
  104. package/dist/api/trpc/http-request-census-hook.js +11 -8
  105. package/dist/api/trpc/http-request-census.js +41 -34
  106. package/dist/api/trpc/http-request-census.singleton.js +8 -4
  107. package/dist/api/trpc/localized-schema-paths.js +4 -1
  108. package/dist/api/trpc/principal-visibility.js +22 -14
  109. package/dist/api/trpc/remote-addon-update-grant.js +4 -1
  110. package/dist/api/trpc/scope-access.js +15 -10
  111. package/dist/api/trpc/server-provided-caps.js +7 -3
  112. package/dist/api/trpc/share-view-access.js +14 -6
  113. package/dist/api/trpc/trpc-error-device-tags.js +6 -3
  114. package/dist/api/trpc/trpc-error-principal.js +6 -2
  115. package/dist/api/trpc/trpc.context.js +25 -20
  116. package/dist/api/trpc/trpc.middleware.js +46 -38
  117. package/dist/api/trpc/trpc.router.js +99 -58
  118. package/dist/api/trpc/user-error.js +8 -5
  119. package/dist/api/trpc/ws-request-census.js +24 -17
  120. package/dist/api/trpc/ws-slow-consumer-guard.js +16 -11
  121. package/dist/api/upload-auth.js +9 -5
  122. package/dist/auth/addon-route-jwt-gate.js +7 -4
  123. package/dist/auth/addon-route-share-gate.js +12 -7
  124. package/dist/auth/app-confirm-page.js +22 -17
  125. package/dist/auth/app-confirm-routes.js +31 -26
  126. package/dist/auth/app-confirmations.js +44 -7
  127. package/dist/auth/app-page-shell.js +30 -17
  128. package/dist/auth/app-page-strings.js +17 -11
  129. package/dist/auth/app-passkey-page.js +21 -16
  130. package/dist/auth/app-passkey-routes.js +41 -37
  131. package/dist/auth/app-refused-route.js +18 -13
  132. package/dist/auth/auth-network-policy.js +15 -11
  133. package/dist/auth/auth-provider-gate.js +9 -4
  134. package/dist/auth/auth-rate-limit.js +7 -3
  135. package/dist/auth/client-address.js +9 -6
  136. package/dist/auth/device-enroll-proofs.js +43 -6
  137. package/dist/auth/external-link-intents.js +7 -3
  138. package/dist/auth/hub-sessions.js +12 -6
  139. package/dist/auth/native-link-completions.js +11 -7
  140. package/dist/auth/native-return.js +13 -9
  141. package/dist/auth/passkey-provider.js +32 -26
  142. package/dist/auth/second-factors.js +10 -6
  143. package/dist/auth/session-connections.js +12 -6
  144. package/dist/auth/session-cookie.js +23 -12
  145. package/dist/auth/session-lifetimes.js +12 -8
  146. package/dist/auth/session-mint.js +11 -4
  147. package/dist/auth/sso-finish-app.js +16 -13
  148. package/dist/auth/sso-finish-deps.js +27 -21
  149. package/dist/auth/sso-finish.js +38 -28
  150. package/dist/auth/sso-routes.js +25 -22
  151. package/dist/auth/used-bridge-ids.js +5 -1
  152. package/dist/boot/boot-config.js +55 -16
  153. package/dist/boot/init-sequence.js +4 -1
  154. package/dist/boot/integration-id-backfill.js +8 -3
  155. package/dist/boot/platform-keychain-key.js +42 -5
  156. package/dist/boot/post-boot.service.js +18 -14
  157. package/dist/boot/reconcile-lifecycle-jobs.js +6 -3
  158. package/dist/boot/retired-public-url-env.js +8 -4
  159. package/dist/bootstrap-packages.js +4 -1
  160. package/dist/closure-node-modules.js +38 -2
  161. package/dist/core/addon/addon-call-gateway.js +5 -1
  162. package/dist/core/addon/addon-package.service.js +123 -83
  163. package/dist/core/addon/addon-process-view.js +6 -2
  164. package/dist/core/addon/addon-realign-plan.js +4 -1
  165. package/dist/core/addon/addon-registry.service.js +187 -146
  166. package/dist/core/addon/addon-row-manifest.js +4 -1
  167. package/dist/core/addon/addon-search.service.js +7 -3
  168. package/dist/core/addon/addon-settings-provider.js +3 -1
  169. package/dist/core/addon/addon-uninstall.js +11 -4
  170. package/dist/core/addon/addon.tokens.js +5 -2
  171. package/dist/core/addon/device-meta-mirror.js +13 -8
  172. package/dist/core/addon/forked-custom-actions.js +11 -6
  173. package/dist/core/addon/integration-visibility.js +6 -3
  174. package/dist/core/addon/materialize-route-path.js +4 -1
  175. package/dist/core/addon/package-dir-utils.js +45 -8
  176. package/dist/core/addon/prune-misplaced-addons.js +43 -5
  177. package/dist/core/addon/runner-convergence.js +4 -1
  178. package/dist/core/addon/runner-serialization.js +4 -1
  179. package/dist/core/addon/runner-spawn-fanout.js +8 -3
  180. package/dist/core/addon/settings-door-wiring.js +8 -5
  181. package/dist/core/addon/single-flight-refresh.js +4 -1
  182. package/dist/core/addon-bridge/addon-bridge.service.js +44 -7
  183. package/dist/core/addon-pages/addon-pages.service.js +40 -3
  184. package/dist/core/addon-widgets/addon-widgets.service.js +42 -4
  185. package/dist/core/agent/agent-addon-backfill.js +17 -9
  186. package/dist/core/agent/agent-delivery-ledger.js +7 -3
  187. package/dist/core/agent/agent-liveness-event.js +6 -2
  188. package/dist/core/agent/agent-pairing-http.js +45 -41
  189. package/dist/core/agent/agent-registry.service.js +89 -50
  190. package/dist/core/agent/cluster-node-history-mirror.js +7 -3
  191. package/dist/core/agent/cluster-node-history-store.js +35 -31
  192. package/dist/core/agent/hub-agent-pairing.js +5 -1
  193. package/dist/core/agent/node-certificates-client.js +6 -3
  194. package/dist/core/agent/node-directory.js +4 -1
  195. package/dist/core/app-links/well-known-app-links.js +6 -2
  196. package/dist/core/auth/auth.service.js +8 -3
  197. package/dist/core/auth/handoff-code.service.js +49 -11
  198. package/dist/core/auth/record-kinds.js +19 -16
  199. package/dist/core/auth/share-token.service.js +79 -42
  200. package/dist/core/capability/capability.service.js +5 -1
  201. package/dist/core/config/config.schema.js +6 -1
  202. package/dist/core/config/config.service.js +6 -2
  203. package/dist/core/events/event-bus.service.js +7 -3
  204. package/dist/core/feature/feature.service.js +6 -2
  205. package/dist/core/lifecycle/lifecycle-runner.singleton.js +10 -5
  206. package/dist/core/lifecycle/lifecycle-state-machine.js +5 -1
  207. package/dist/core/logging/log-ring-buffer.js +5 -1
  208. package/dist/core/logging/logging.service.js +9 -5
  209. package/dist/core/logging/scoped-logger.js +5 -1
  210. package/dist/core/moleculer/agent-readiness-pull.js +4 -1
  211. package/dist/core/moleculer/agent-registration-request.js +7 -3
  212. package/dist/core/moleculer/cap-call-fn.js +7 -4
  213. package/dist/core/moleculer/cap-route-authority.js +8 -3
  214. package/dist/core/moleculer/hub-mesh-guard.js +9 -5
  215. package/dist/core/moleculer/moleculer.service.js +86 -79
  216. package/dist/core/network/network-quality.service.js +6 -2
  217. package/dist/core/notification/notification-wrapper.service.js +7 -3
  218. package/dist/core/notification/toast-wrapper.service.js +7 -3
  219. package/dist/core/provider/provider.tokens.js +4 -1
  220. package/dist/core/repl/repl-engine.service.js +8 -4
  221. package/dist/core/runner-health/runner-boot-check.js +15 -7
  222. package/dist/core/runner-health/update-preflight.js +14 -9
  223. package/dist/core/server-update/server-update.service.js +49 -12
  224. package/dist/core/server-update/system-apply-closure-patches.js +42 -6
  225. package/dist/core/server-update/system-ensure-prebuilds.js +6 -3
  226. package/dist/core/server-update/system-exec-npm.js +5 -2
  227. package/dist/core/storage/fs-storage-backend.js +5 -1
  228. package/dist/core/storage/storage-location-manager.js +5 -1
  229. package/dist/core/storage/storage.service.js +6 -2
  230. package/dist/core/streaming/ffmpeg-stream-info.js +8 -3
  231. package/dist/core/streaming/stream-probe.service.js +16 -12
  232. package/dist/core/streaming/ttl-cache.js +5 -1
  233. package/dist/core/topology/topology-emitter.service.js +23 -19
  234. package/dist/core/update-availability-emitter.js +7 -3
  235. package/dist/core/update-availability-store.js +45 -8
  236. package/dist/core/updates/agent-installed-packages.js +9 -5
  237. package/dist/core/updates/restart-marker.js +8 -3
  238. package/dist/core/updates/update-check-scheduler.js +18 -13
  239. package/dist/core/updates/wrapper-update-checker.js +7 -3
  240. package/dist/first-boot-addon-plan.js +6 -2
  241. package/dist/framework-nodepath.js +38 -2
  242. package/dist/i18n/request-lang.js +11 -7
  243. package/dist/launcher.js +65 -30
  244. package/dist/lifecycle-journal-path.js +38 -2
  245. package/dist/main.js +324 -286
  246. package/dist/manual-boot.js +156 -117
  247. package/dist/node-role.js +4 -1
  248. package/dist/package-inventory.js +48 -7
  249. package/dist/pending-restore.js +43 -7
  250. package/dist/single-copy-cleanup-runner.js +45 -9
  251. package/dist/single-copy-cleanup.js +15 -7
  252. package/dist/sqlite-restore.js +48 -9
  253. package/dist/starter.js +39 -4
  254. package/dist/ui-serving/lazy-ui-serving.js +39 -3
  255. package/package.json +7 -7
@@ -1,43 +1,79 @@
1
- import * as fs from 'node:fs';
2
- import { RunnerBootCheckService, } from '../core/runner-health/runner-boot-check.js';
3
- import * as path from 'node:path';
4
- import { AddonInstaller, AddonLoader, AGENT_READINESS_SERVICE_NAME, buildNodeManifest, CapabilityRegistry, createAddonContext, createAddonService, buildTransporter, connectBrokerTransport, createAgentTransport, createBroker, currentBrokerTransporter, disconnectBrokerTransport, installBrokerTransporter, isInstalledTransporter, createLocalTransport, createParentUnownedCallHandler, createProcessService, createReadinessServiceForRegistry, createUdsEventBridge, deriveAgentListenPort, detectWorkspacePackagesDir, getBrokerEventBus, getOrInitReadinessRegistry, HUB_CAP_FWD_ACTION, HubNodeRegistry, LocalChildRegistry, localEndpointPath, registerEventBusService, setNodeEventInterest, subscribePassthrough, udsChildLogToWorkerEntry, redactLogMeta, redactLogText, AgentMdnsAdvertiser, AgentPairing, createCiaoPublisher, TlsTcpTransporter, } from '@camstack/system';
5
- import { EventCategory } from '@camstack/types';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.startAgent = startAgent;
37
+ const fs = __importStar(require("node:fs"));
38
+ const runner_boot_check_js_1 = require("../core/runner-health/runner-boot-check.js");
39
+ const path = __importStar(require("node:path"));
40
+ const system_1 = require("@camstack/system");
41
+ const types_1 = require("@camstack/types");
6
42
  // Capability definitions — must be declared before addon registerProvider() calls
7
- import { ALL_CAPABILITY_DEFINITIONS, audioAnalyzerCapability, dataStoreProviderCapability, decoderCapability, errMsg, filesystemBrowseCapability, isDeployableToAgent, logDestinationCapability, metricsProviderCapability, motionDetectionCapability, nodeCertificatesCapability, normalizeAddonInitResult, pipelineExecutorCapability, pipelineRunnerCapability, platformProbeCapability, resolveAddonPlacement, resolveRunnerId, serverManagementCapability, settingsStoreCapability, storageCapability, storageProviderCapability, } from '@camstack/types';
8
- import { buildServerManagementProvider } from '../api/core/server-management.provider.js';
9
- import { resolveHubClosurePackageDir } from '../core/addon/package-dir-utils.js';
10
- import { runSingleCopyCleanup } from '../single-copy-cleanup-runner.js';
11
- import { BUILTINS_PACKAGE, planAgentAddonScan, resolveAddonPackageDirs } from './addon-scan.js';
12
- import { buildAgentAddonUpdateReport } from './agent-addon-updates.js';
13
- import { createAgentHubRegistration } from './agent-hub-registration.js';
14
- import { createAgentMeshGate } from './agent-mesh-gate.js';
15
- import { createLocalPairingAnnouncer } from './agent-pairing-local.js';
16
- import { forgetPairing, isAgentPaired, pairedLeafFingerprint, persistPairing, } from './agent-pairing-store.js';
17
- import { loadAgentConfig } from './agent-config.js';
18
- import { ensureGroupRunner, isGroupRunnerAddon, readPackageManifestAddons, registerGroupRunnerProviders, } from './agent-group-runner.js';
19
- import { startAgentHttpServer } from './agent-http.js';
20
- import { createAgentNodeCertificates } from './agent-node-certificates.js';
21
- import { createReconnectRunner } from './agent-reconnect.js';
22
- import { createSerialQueue } from './serial-queue.js';
23
- import { resolveAgentInfraCapabilities } from './agent-infra-capabilities.js';
24
- import { createAgentService } from './agent-service.js';
25
- import { createAgentHubAddonControls } from './agent-hub-addon-update.js';
26
- import { createAgentServerUpdateControls } from './agent-update-routes.js';
27
- import { AGENT_RUNTIME_ADDON_ID, AgentUpdateService, agentRuntimeManifestEntry, } from './agent-update-service.js';
28
- import { deriveHubUrlForExport } from './derive-hub-url.js';
29
- import { assertRequiredInfraResolved } from './infra-boot-guard.js';
30
- import { planInfraBoot, planToResolutions } from './infra-boot-plan.js';
31
- import { registerAgentCapDispatch } from './register-agent-cap-dispatch.js';
43
+ const types_2 = require("@camstack/types");
44
+ const server_management_provider_js_1 = require("../api/core/server-management.provider.js");
45
+ const package_dir_utils_js_1 = require("../core/addon/package-dir-utils.js");
46
+ const single_copy_cleanup_runner_js_1 = require("../single-copy-cleanup-runner.js");
47
+ const addon_scan_js_1 = require("./addon-scan.js");
48
+ const agent_addon_updates_js_1 = require("./agent-addon-updates.js");
49
+ const agent_hub_registration_js_1 = require("./agent-hub-registration.js");
50
+ const agent_mesh_gate_js_1 = require("./agent-mesh-gate.js");
51
+ const agent_pairing_local_js_1 = require("./agent-pairing-local.js");
52
+ const agent_pairing_store_js_1 = require("./agent-pairing-store.js");
53
+ const agent_config_js_1 = require("./agent-config.js");
54
+ const agent_group_runner_js_1 = require("./agent-group-runner.js");
55
+ const agent_http_js_1 = require("./agent-http.js");
56
+ const agent_node_certificates_js_1 = require("./agent-node-certificates.js");
57
+ const agent_reconnect_js_1 = require("./agent-reconnect.js");
58
+ const serial_queue_js_1 = require("./serial-queue.js");
59
+ const agent_infra_capabilities_js_1 = require("./agent-infra-capabilities.js");
60
+ const agent_service_js_1 = require("./agent-service.js");
61
+ const agent_hub_addon_update_js_1 = require("./agent-hub-addon-update.js");
62
+ const agent_update_routes_js_1 = require("./agent-update-routes.js");
63
+ const agent_update_service_js_1 = require("./agent-update-service.js");
64
+ const derive_hub_url_js_1 = require("./derive-hub-url.js");
65
+ const infra_boot_guard_js_1 = require("./infra-boot-guard.js");
66
+ const infra_boot_plan_js_1 = require("./infra-boot-plan.js");
67
+ const register_agent_cap_dispatch_js_1 = require("./register-agent-cap-dispatch.js");
32
68
  // ---------------------------------------------------------------------------
33
69
  // Agent LogManager — shared log pipeline for all addon loggers.
34
70
  // The hub-forwarder addon registers as a destination, so all log
35
71
  // entries flow through it (console output + hub forwarding).
36
72
  // ---------------------------------------------------------------------------
37
- import { LogManager, systemHostFacts } from '@camstack/system';
73
+ const system_2 = require("@camstack/system");
38
74
  /** A reconnect (stop + rebuild + start) that takes longer than this is abandoned. */
39
75
  const RECONNECT_DEADLINE_MS = 90_000;
40
- const agentLogManager = new LogManager(5000);
76
+ const agentLogManager = new system_2.LogManager(5000);
41
77
  /**
42
78
  * Caps whose `nodeId` arg is provider DATA (`nodeIdMode: 'data'` —
43
79
  * `addon-settings`, `addons`, `nodes`, `pipeline-orchestrator`), never a
@@ -49,12 +85,12 @@ const agentLogManager = new LogManager(5000);
49
85
  * the hub singleton (which reads `nodeId` as data) instead of being pinned to
50
86
  * a node with no provider (dead broker fallback → ServiceNotFoundError).
51
87
  */
52
- const DATA_NODEID_CAPS = new Set(ALL_CAPABILITY_DEFINITIONS.filter((c) => c.nodeIdMode === 'data').map((c) => c.name));
88
+ const DATA_NODEID_CAPS = new Set(types_2.ALL_CAPABILITY_DEFINITIONS.filter((c) => c.nodeIdMode === 'data').map((c) => c.name));
53
89
  // ---------------------------------------------------------------------------
54
90
  // Main
55
91
  // ---------------------------------------------------------------------------
56
92
  async function startAgent(configPath) {
57
- const config = loadAgentConfig(configPath);
93
+ const config = (0, agent_config_js_1.loadAgentConfig)(configPath);
58
94
  // Derive CAMSTACK_HUB_URL from the configured hub address so remote agents
59
95
  // no longer need a second, redundant env var set by hand (the cross-node
60
96
  // source trap). An explicit operator value ALWAYS wins — capture whether it
@@ -63,7 +99,7 @@ async function startAgent(configPath) {
63
99
  // loadDeployedAddons below), and process-service spreads `process.env` into
64
100
  // child env, so pipeline-runner + recorder children inherit it for free.
65
101
  const hubUrlWasExplicit = process.env['CAMSTACK_HUB_URL'] !== undefined;
66
- const derivedHubUrl = deriveHubUrlForExport(hubUrlWasExplicit, config.hubAddress);
102
+ const derivedHubUrl = (0, derive_hub_url_js_1.deriveHubUrlForExport)(hubUrlWasExplicit, config.hubAddress);
67
103
  if (derivedHubUrl !== undefined) {
68
104
  process.env['CAMSTACK_HUB_URL'] = derivedHubUrl;
69
105
  console.log(`[Agent] Derived CAMSTACK_HUB_URL=${derivedHubUrl} from hub address "${config.hubAddress}"`);
@@ -94,14 +130,14 @@ async function startAgent(configPath) {
94
130
  console.log(`[Agent] Using bundled addons from ${bundledDir}`);
95
131
  }
96
132
  else if (explicitSource === 'local') {
97
- workspaceDir = detectWorkspacePackagesDir(config.dataDir);
133
+ workspaceDir = (0, system_1.detectWorkspacePackagesDir)(config.dataDir);
98
134
  }
99
- const installer = new AddonInstaller({
135
+ const installer = new system_1.AddonInstaller({
100
136
  addonsDir: config.addonsDir,
101
137
  workspacePackagesDir: workspaceDir ?? undefined,
102
138
  installSource: resolvedSource,
103
139
  });
104
- await installer.ensureRequiredPackages(AddonInstaller.AGENT_PACKAGES);
140
+ await installer.ensureRequiredPackages(system_1.AddonInstaller.AGENT_PACKAGES);
105
141
  // Restore repair, mirroring the hub launcher (D338): reinstall ONLY the
106
142
  // runtime deps that are neither present nor resolvable from the closure.
107
143
  if (typeof installer.ensureAddonRuntimeDeps === 'function') {
@@ -123,11 +159,11 @@ async function startAgent(configPath) {
123
159
  // D802, D857: the inbound mesh gate. Only the hub may call this agent, and the hub is
124
160
  // recognised by the certificate the agent's own TLS listener verified. The transport is
125
161
  // read at call time because a reconnect replaces it.
126
- const meshGate = createAgentMeshGate({
162
+ const meshGate = (0, agent_mesh_gate_js_1.createAgentMeshGate)({
127
163
  nodeId: config.nodeId,
128
164
  isVerifiedPeer: (nodeId) => {
129
- const tx = currentBrokerTransporter(broker).tx;
130
- return tx instanceof TlsTcpTransporter && tx.verifiedPeer(nodeId) !== undefined;
165
+ const tx = (0, system_1.currentBrokerTransporter)(broker).tx;
166
+ return tx instanceof system_1.TlsTcpTransporter && tx.verifiedPeer(nodeId) !== undefined;
131
167
  },
132
168
  log: (msg) => console.log(`[Agent] ${msg}`),
133
169
  });
@@ -137,7 +173,7 @@ async function startAgent(configPath) {
137
173
  // The HTTP/HTTPS listener on the agent port (D856); set once it is up.
138
174
  let agentHttpListener = null;
139
175
  console.log(`[Agent] Mesh transport: ${currentMeshTls !== null ? 'tls (paired)' : 'none (unpaired)'}`);
140
- const broker = createBroker({
176
+ const broker = (0, system_1.createBroker)({
141
177
  nodeID: config.nodeId,
142
178
  mode: 'agent',
143
179
  hubAddress: config.hubAddress,
@@ -155,7 +191,7 @@ async function startAgent(configPath) {
155
191
  */
156
192
  // ONE reconnect at a time (serial-queue.ts): the UI, a mesh leaf swap and its rollback can
157
193
  // all ask for one, and two interleaved disconnect/connect cycles would leave two wires or none.
158
- const reconnect = createSerialQueue(() => reconnectNow(), {
194
+ const reconnect = (0, serial_queue_js_1.createSerialQueue)(() => reconnectNow(), {
159
195
  deadlineMs: RECONNECT_DEADLINE_MS,
160
196
  onTimeout: () => {
161
197
  // A transport whose connect never settles must not hold every later reconnect (including
@@ -164,26 +200,26 @@ async function startAgent(configPath) {
164
200
  consoleLogger.error('Reconnect did not finish in time - dropping the half-connected transport', {
165
201
  meta: { deadlineMs: RECONNECT_DEADLINE_MS },
166
202
  });
167
- void disconnectBrokerTransport(broker).catch(() => undefined);
203
+ void (0, system_1.disconnectBrokerTransport)(broker).catch(() => undefined);
168
204
  },
169
205
  });
170
206
  // The cycle itself runs through a generation guard: a run the queue abandoned at its deadline
171
207
  // that resumes later installs nothing (agent-reconnect.ts), so two transports never share a broker.
172
208
  let pendingConfig = null;
173
- const reconnectNow = createReconnectRunner({
174
- current: () => currentBrokerTransporter(broker),
175
- assign: (next) => installBrokerTransporter(broker, next),
209
+ const reconnectNow = (0, agent_reconnect_js_1.createReconnectRunner)({
210
+ current: () => (0, system_1.currentBrokerTransporter)(broker),
211
+ assign: (next) => (0, system_1.installBrokerTransporter)(broker, next),
176
212
  stop: async (target) => {
177
213
  // Only the transport installed right now: a late, abandoned run must not tear down a
178
214
  // newer run's transport.
179
- if (isInstalledTransporter(broker, target)) {
180
- await disconnectBrokerTransport(broker);
215
+ if ((0, system_1.isInstalledTransporter)(broker, target)) {
216
+ await (0, system_1.disconnectBrokerTransport)(broker);
181
217
  }
182
218
  },
183
219
  prepare: () => {
184
220
  console.log('[Agent] Reconnecting with updated config...');
185
221
  // Reload config from file (pairing, the UI or a local call may have written it)
186
- const fresh = loadAgentConfig(undefined, config.dataDir);
222
+ const fresh = (0, agent_config_js_1.loadAgentConfig)(undefined, config.dataDir);
187
223
  pendingConfig = fresh;
188
224
  console.log(`[Agent] New config: hub=${fresh.hubAddress ?? 'none'}, ` +
189
225
  `mesh=${fresh.meshTls !== undefined ? 'tls (paired)' : 'none (unpaired)'}`);
@@ -193,7 +229,7 @@ async function startAgent(configPath) {
193
229
  // keep the env they inherited; picking up a changed hub address in live
194
230
  // children would need a runner respawn. Boot-time — the actual trap — is
195
231
  // fully covered.
196
- const freshHubUrl = deriveHubUrlForExport(hubUrlWasExplicit, fresh.hubAddress);
232
+ const freshHubUrl = (0, derive_hub_url_js_1.deriveHubUrlForExport)(hubUrlWasExplicit, fresh.hubAddress);
197
233
  if (freshHubUrl !== undefined && process.env['CAMSTACK_HUB_URL'] !== freshHubUrl) {
198
234
  process.env['CAMSTACK_HUB_URL'] = freshHubUrl;
199
235
  console.log(`[Agent] Derived CAMSTACK_HUB_URL=${freshHubUrl} from hub address "${fresh.hubAddress}"`);
@@ -204,7 +240,7 @@ async function startAgent(configPath) {
204
240
  const fresh = pendingConfig;
205
241
  if (fresh === null)
206
242
  throw new Error('reconnect: no configuration was prepared');
207
- return buildTransporter(createAgentTransport({
243
+ return (0, system_1.buildTransporter)((0, system_1.createAgentTransport)({
208
244
  nodeID: config.nodeId,
209
245
  mode: 'agent',
210
246
  hubAddress: fresh.hubAddress,
@@ -215,7 +251,7 @@ async function startAgent(configPath) {
215
251
  // The new wire's hub connection re-sends the manifest (`registration.onHubConnected`):
216
252
  // the subtree union, every child included (D3).
217
253
  start: async () => {
218
- await connectBrokerTransport(broker);
254
+ await (0, system_1.connectBrokerTransport)(broker);
219
255
  console.log('[Agent] Reconnected successfully');
220
256
  },
221
257
  onSuperseded: (stage) => consoleLogger.warn('A superseded reconnect stopped without installing a second transport', {
@@ -226,7 +262,7 @@ async function startAgent(configPath) {
226
262
  // D3 subtree registry: accumulates manifests from every group-runner child
227
263
  // that calls `$agent.registerNode`. The agent re-registers the UNION of its
228
264
  // own in-process addons + all children with the hub on every child update.
229
- const subtree = new HubNodeRegistry();
265
+ const subtree = new system_1.HubNodeRegistry();
230
266
  // ---------------------------------------------------------------------------
231
267
  // Hub connection state tracking (for richer UI status)
232
268
  // ---------------------------------------------------------------------------
@@ -250,7 +286,7 @@ async function startAgent(configPath) {
250
286
  catch {
251
287
  /* fall through */
252
288
  }
253
- if (!isAgentPaired(config.configPath))
289
+ if (!(0, agent_pairing_store_js_1.isAgentPaired)(config.configPath))
254
290
  return 'unpaired';
255
291
  const configNow = readConfigFile(config.configPath);
256
292
  const hubAddressConfigured = typeof configNow.hubAddress === 'string' && configNow.hubAddress.length > 0;
@@ -312,7 +348,7 @@ async function startAgent(configPath) {
312
348
  // The agent runtime's OWN providers (server-management) are registered by
313
349
  // the bootstrap, not an addon — append their synthetic manifest entry so
314
350
  // the hub's HubNodeRegistry (and nodeId-pinned cap routing) sees them.
315
- result.push(agentRuntimeManifestEntry());
351
+ result.push((0, agent_update_service_js_1.agentRuntimeManifestEntry)());
316
352
  return result;
317
353
  }
318
354
  /**
@@ -337,7 +373,7 @@ async function startAgent(configPath) {
337
373
  // carries the agent's root-package identity so the hub's HubNodeRegistry
338
374
  // (and the Server management UI) sees every node's exact version.
339
375
  const rootPackage = agentUpdateService.getRunningRootPackage();
340
- return buildNodeManifest(config.nodeId, allAddons, allNativeCaps.length > 0 ? allNativeCaps : undefined, rootPackage.version === null
376
+ return (0, system_1.buildNodeManifest)(config.nodeId, allAddons, allNativeCaps.length > 0 ? allNativeCaps : undefined, rootPackage.version === null
341
377
  ? undefined
342
378
  : { name: rootPackage.name, version: rootPackage.version });
343
379
  }
@@ -351,7 +387,7 @@ async function startAgent(configPath) {
351
387
  * D857: no join to wait for and no secret in the manifest — the hub knows
352
388
  * who this agent is from its certificate.
353
389
  */
354
- const registration = createAgentHubRegistration({
390
+ const registration = (0, agent_hub_registration_js_1.createAgentHubRegistration)({
355
391
  buildManifest: () => aggregateManifest(),
356
392
  broker: () => broker,
357
393
  signal: registerAbortController.signal,
@@ -379,36 +415,36 @@ async function startAgent(configPath) {
379
415
  child: () => consoleLogger,
380
416
  withTags: () => consoleLogger,
381
417
  };
382
- const capabilityRegistry = new CapabilityRegistry(consoleLogger);
418
+ const capabilityRegistry = new system_1.CapabilityRegistry(consoleLogger);
383
419
  // Declare all capabilities the agent uses — required before registerProvider()
384
420
  const agentCapabilities = [
385
- storageCapability,
386
- storageProviderCapability,
421
+ types_2.storageCapability,
422
+ types_2.storageProviderCapability,
387
423
  // The path browser for "add a storage location on this node" — the agent
388
424
  // registers the provider since day one, but without DECLARING the cap
389
425
  // here the hub's manifest never learns of it and node-routed browse
390
426
  // answers "not available on node X" (2026-07-30 fix).
391
- filesystemBrowseCapability,
427
+ types_2.filesystemBrowseCapability,
392
428
  // The agent runs the same two-addon data topology as the hub (D44):
393
429
  // `settings-store` is the door served by storage-orchestrator,
394
430
  // `data-store-provider` is the engine sqlite-settings registers. BOTH
395
431
  // must be declared here — this array is hand-curated and nothing else
396
432
  // teaches an agent a capability, so omitting the engine leaves the
397
433
  // agent's door with nothing behind it.
398
- settingsStoreCapability,
399
- dataStoreProviderCapability,
400
- logDestinationCapability,
401
- metricsProviderCapability,
402
- decoderCapability,
403
- motionDetectionCapability,
404
- pipelineExecutorCapability,
405
- pipelineRunnerCapability,
406
- audioAnalyzerCapability,
407
- platformProbeCapability,
408
- serverManagementCapability,
434
+ types_2.settingsStoreCapability,
435
+ types_2.dataStoreProviderCapability,
436
+ types_2.logDestinationCapability,
437
+ types_2.metricsProviderCapability,
438
+ types_2.decoderCapability,
439
+ types_2.motionDetectionCapability,
440
+ types_2.pipelineExecutorCapability,
441
+ types_2.pipelineRunnerCapability,
442
+ types_2.audioAnalyzerCapability,
443
+ types_2.platformProbeCapability,
444
+ types_2.serverManagementCapability,
409
445
  // Certificates of THIS node, called by the hub (D856): mesh leaf renewal and the
410
446
  // hub-issued HTTPS leaf. Provided by the runtime, like `server-management`.
411
- nodeCertificatesCapability,
447
+ types_2.nodeCertificatesCapability,
412
448
  ];
413
449
  for (const cap of agentCapabilities) {
414
450
  capabilityRegistry.declareCapability(cap);
@@ -424,16 +460,16 @@ async function startAgent(configPath) {
424
460
  // agent runs, so the agent compares what its process service holds (a runner
425
461
  // that failed or refused is named; one that never spawned is not knowable here).
426
462
  let agentRunnerBootCheck = null;
427
- const agentUpdateService = new AgentUpdateService({
463
+ const agentUpdateService = new agent_update_service_js_1.AgentUpdateService({
428
464
  logger: consoleLogger,
429
465
  dataDir: config.dataDir,
430
466
  runnerBootCheck: () => agentRunnerBootCheck?.current(),
431
467
  });
432
- capabilityRegistry.registerProvider('server-management', AGENT_RUNTIME_ADDON_ID, buildServerManagementProvider(agentUpdateService));
468
+ capabilityRegistry.registerProvider('server-management', agent_update_service_js_1.AGENT_RUNTIME_ADDON_ID, (0, server_management_provider_js_1.buildServerManagementProvider)(agentUpdateService));
433
469
  // The agent's certificates (D856): mesh leaf swap with automatic rollback, and the
434
470
  // hub-issued HTTPS leaf hot-swapped into the sniffing listener. The listener is
435
471
  // created later in boot, so it is read through a getter.
436
- capabilityRegistry.registerProvider('node-certificates', AGENT_RUNTIME_ADDON_ID, createAgentNodeCertificates({
472
+ capabilityRegistry.registerProvider('node-certificates', agent_update_service_js_1.AGENT_RUNTIME_ADDON_ID, (0, agent_node_certificates_js_1.createAgentNodeCertificates)({
437
473
  nodeId: config.nodeId,
438
474
  dataDir: config.dataDir,
439
475
  configPath: config.configPath,
@@ -444,7 +480,7 @@ async function startAgent(configPath) {
444
480
  timer.unref?.();
445
481
  },
446
482
  getHttpsListener: () => agentHttpListener,
447
- hostFacts: systemHostFacts(),
483
+ hostFacts: (0, system_2.systemHostFacts)(),
448
484
  log: {
449
485
  info: (message, extras) => consoleLogger.info(message, extras),
450
486
  warn: (message, extras) => consoleLogger.warn(message, extras),
@@ -476,7 +512,7 @@ async function startAgent(configPath) {
476
512
  // — a copy nothing loads (both roles pass `['@camstack/system']` as the
477
513
  // loader's skip list) and that WINS over the closure for anything resolving
478
514
  // through it.
479
- void runSingleCopyCleanup({
515
+ void (0, single_copy_cleanup_runner_js_1.runSingleCopyCleanup)({
480
516
  dataDir: config.dataDir,
481
517
  addonRoot: config.addonsDir,
482
518
  log: (line) => consoleLogger.info(line),
@@ -487,7 +523,7 @@ async function startAgent(configPath) {
487
523
  // No scope — the brand bracket `[agent/addonId]` already identifies the addon.
488
524
  // `addonId` tag is required for the brand bracket resolver.
489
525
  const loggerFactory = (addonId) => agentLogManager.createLogger().withTags({ addonId });
490
- const agentServiceSchema = createAgentService({
526
+ const agentServiceSchema = (0, agent_service_js_1.createAgentService)({
491
527
  addonsDir: config.addonsDir,
492
528
  dataDir: config.dataDir,
493
529
  agentName: config.name,
@@ -545,7 +581,7 @@ async function startAgent(configPath) {
545
581
  bootstrapPackages: new Set([
546
582
  '@camstack/system',
547
583
  '@camstack/addon-agent-ui',
548
- ...AddonInstaller.AGENT_PACKAGES,
584
+ ...system_1.AddonInstaller.AGENT_PACKAGES,
549
585
  ]),
550
586
  unregisterProvider: (capName, addonId) => {
551
587
  if (capabilityRegistry.hasProvider(capName, addonId)) {
@@ -559,7 +595,7 @@ async function startAgent(configPath) {
559
595
  // back here instead of falling back to port 6000 (the hub). Bug-4:
560
596
  // without this, runners called `$agent.registerNode` through the hub
561
597
  // which has no `$agent` service → retry storm (attempt 80+).
562
- const agentTcpPort = deriveAgentListenPort(broker.nodeID);
598
+ const agentTcpPort = (0, system_1.deriveAgentListenPort)(broker.nodeID);
563
599
  // UDS local transport — the agent hosts a LocalChildRegistry so its
564
600
  // forked addon-runners route cap calls over a Unix-domain socket. The
565
601
  // broker stays as the no-route fallback. On failure the children fall
@@ -578,7 +614,7 @@ async function startAgent(configPath) {
578
614
  // mesh (and any cluster node) via the same service-discovery + action-name
579
615
  // convention the child's brokerTransportLink used before F0. F1+F2 removes
580
616
  // the child broker, so the agent must own this outbound path.
581
- const onUnownedCall = createParentUnownedCallHandler({
617
+ const onUnownedCall = (0, system_1.createParentUnownedCallHandler)({
582
618
  getResolver: () => null,
583
619
  broker: broker,
584
620
  // The agent's subtree registry — lets the broker fallback pin a
@@ -601,7 +637,7 @@ async function startAgent(configPath) {
601
637
  // makes an agent's forked addon reach a hub-hosted cap (`stream-broker`,
602
638
  // `settings-store`, …) instead of 30s-deadlining on raw `${cap}.*`
603
639
  // discovery (hub-local addon runners expose no Moleculer service).
604
- forwardToHub: (input) => broker.call(HUB_CAP_FWD_ACTION, {
640
+ forwardToHub: (input) => broker.call(system_1.HUB_CAP_FWD_ACTION, {
605
641
  capName: input.capName,
606
642
  method: input.method,
607
643
  args: input.args,
@@ -620,8 +656,8 @@ async function startAgent(configPath) {
620
656
  }, { timeout: 60_000 }),
621
657
  logger: { warn: (msg) => consoleLogger.warn(`[uds-fallback] ${msg}`) },
622
658
  });
623
- agentUdsRegistry = new LocalChildRegistry({
624
- server: createLocalTransport().createServer(agentNodeId),
659
+ agentUdsRegistry = new system_1.LocalChildRegistry({
660
+ server: (0, system_1.createLocalTransport)().createServer(agentNodeId),
625
661
  // `WorkerOnline` / `WorkerOffline` `<agent>/<childId>` for a forked runner
626
662
  // (no broker of its own, so no `$node.connected`), on the agent's
627
663
  // cluster-broadcasting bus. The bus exists only after `broker.start()`;
@@ -688,11 +724,11 @@ async function startAgent(configPath) {
688
724
  agentUdsRegistry.onChildLog((childId, entry) => {
689
725
  // Key names and URL credentials redacted before the line leaves this
690
726
  // node (D787 §8). The child already scrubbed the values it resolved.
691
- const raw = udsChildLogToWorkerEntry(childId, entry);
727
+ const raw = (0, system_1.udsChildLogToWorkerEntry)(childId, entry);
692
728
  const workerEntry = {
693
729
  ...raw,
694
- message: redactLogText(raw.message),
695
- ...(raw.meta !== undefined ? { meta: redactLogMeta(raw.meta) } : {}),
730
+ message: (0, system_1.redactLogText)(raw.message),
731
+ ...(raw.meta !== undefined ? { meta: (0, system_1.redactLogMeta)(raw.meta) } : {}),
696
732
  };
697
733
  broker.call('log-receiver.ingest', workerEntry).catch(() => {
698
734
  // Hub unreachable or not yet discovered — silently drop.
@@ -700,13 +736,13 @@ async function startAgent(configPath) {
700
736
  // child UDS logs emitted before hub connection are not buffered here.
701
737
  });
702
738
  });
703
- agentParentUdsPath = localEndpointPath(agentNodeId);
739
+ agentParentUdsPath = (0, system_1.localEndpointPath)(agentNodeId);
704
740
  consoleLogger.info(`UDS child registry listening on ${agentParentUdsPath}`);
705
741
  }
706
742
  catch (err) {
707
743
  consoleLogger.warn(`UDS child registry failed to start; children stay broker-only: ${err instanceof Error ? err.message : String(err)}`);
708
744
  }
709
- const processServiceSchema = createProcessService(broker.nodeID, config.dataDir, undefined, agentTcpPort, agentParentUdsPath);
745
+ const processServiceSchema = (0, system_1.createProcessService)(broker.nodeID, config.dataDir, undefined, agentTcpPort, agentParentUdsPath);
710
746
  broker.createService(processServiceSchema);
711
747
  // Slice-5, Task 7 — register the agent-side cap-dispatch service so the hub
712
748
  // can route `agent-child-forward` cap calls to this agent's UDS children.
@@ -734,14 +770,14 @@ async function startAgent(configPath) {
734
770
  },
735
771
  };
736
772
  };
737
- registerAgentCapDispatch(broker, agentUdsRegistry, agentInProcessLookup, consoleLogger);
773
+ (0, register_agent_cap_dispatch_js_1.registerAgentCapDispatch)(broker, agentUdsRegistry, agentInProcessLookup, consoleLogger);
738
774
  // $addonHost — REMOVED (Sprint 6). Three-level settings are now
739
775
  // exposed per-addon via `settings.*` actions in createAddonService.
740
776
  // Register $event-bus BEFORE start so the service subscription
741
777
  // is announced during discovery. See addon-context-factory.ts for
742
778
  // the rationale — post-start registration propagates via heartbeat
743
779
  // and is unreliable for the first ~10s.
744
- registerEventBusService(broker);
780
+ (0, system_1.registerEventBusService)(broker);
745
781
  // Start broker BEFORE bootCoreAddons. Core infra addons (storage,
746
782
  // sqlite-settings, ...) run their own BaseAddon.initialize() which
747
783
  // calls `ctx.settings.readAddonStore()` on every addon; that call
@@ -751,7 +787,7 @@ async function startAgent(configPath) {
751
787
  // discovery resolve (or time out cleanly via the read-blob fallback)
752
788
  // so agent boot completes instead of hanging on the first infra addon.
753
789
  await broker.start();
754
- agentRunnerBootCheck = new RunnerBootCheckService({
790
+ agentRunnerBootCheck = new runner_boot_check_js_1.RunnerBootCheckService({
755
791
  logger: consoleLogger,
756
792
  nodeId: config.nodeId,
757
793
  planned: () => null,
@@ -763,25 +799,25 @@ async function startAgent(configPath) {
763
799
  });
764
800
  agentRunnerBootCheck.scheduleAfterBoot();
765
801
  // Re-evaluate a verdict that still had runners on their way, on each runner state change.
766
- getBrokerEventBus(broker).subscribe({ category: EventCategory.ProcessStateChanged }, () => agentRunnerBootCheck?.noteRunnerChange());
802
+ (0, system_1.getBrokerEventBus)(broker).subscribe({ category: types_1.EventCategory.ProcessStateChanged }, () => agentRunnerBootCheck?.noteRunnerChange());
767
803
  // C2: wire the UDS ↔ Moleculer event bridge so events emitted by UDS
768
804
  // children fan to siblings and reach the cluster, and cluster / parent-
769
805
  // local events propagate to every UDS child. Inert when agentUdsRegistry
770
806
  // was not started (no UDS children). Wired after broker.start() so
771
807
  // getBrokerEventBus returns the fully operational shared bus.
772
- const agentBrokerEventBus = getBrokerEventBus(broker);
808
+ const agentBrokerEventBus = (0, system_1.getBrokerEventBus)(broker);
773
809
  agentLifecycleBus = agentBrokerEventBus;
774
810
  agentUpdateService.bindAvailability(agentBrokerEventBus, broker.nodeID);
775
811
  let udsEventBridgeDispose = null;
776
812
  if (agentUdsRegistry !== undefined) {
777
- udsEventBridgeDispose = createUdsEventBridge({
813
+ udsEventBridgeDispose = (0, system_1.createUdsEventBridge)({
778
814
  registry: agentUdsRegistry,
779
815
  parentBus: agentBrokerEventBus,
780
816
  parentNodeId: broker.nodeID,
781
817
  // D2: relay to children via the pass-through subscription so the bridge's
782
818
  // wildcard does NOT count toward this node's local interest (otherwise the
783
819
  // gate could never filter anything).
784
- subscribePassthrough: (handler) => subscribePassthrough(broker, handler),
820
+ subscribePassthrough: (handler) => (0, system_1.subscribePassthrough)(broker, handler),
785
821
  });
786
822
  // D2: teach the agent's `$event-bus` inbound handler which cross-node
787
823
  // (Moleculer) event categories any of its UDS children actually want, so the
@@ -790,7 +826,7 @@ async function startAgent(configPath) {
790
826
  // (un)subscribing takes effect immediately. Fails OPEN when a child is
791
827
  // undeclared (aggregateEventInterest → null).
792
828
  const interestRegistry = agentUdsRegistry;
793
- setNodeEventInterest(broker, () => interestRegistry.aggregateEventInterest());
829
+ (0, system_1.setNodeEventInterest)(broker, () => interestRegistry.aggregateEventInterest());
794
830
  // D1: answer readiness-snapshot requests from UDS children over the
795
831
  // agent's own readiness registry view. The agent hydrates its registry
796
832
  // from the hub's `$readiness.getSnapshot` Moleculer action (broker
@@ -801,7 +837,7 @@ async function startAgent(configPath) {
801
837
  // uses, so the shared per-broker instance is returned on the first call
802
838
  // and reused on subsequent calls — no separate registry is created.
803
839
  // Wired after broker.start() so the broker event bus is operational.
804
- const agentReadinessRegistry = getOrInitReadinessRegistry(broker, agentBrokerEventBus, consoleLogger);
840
+ const agentReadinessRegistry = (0, system_1.getOrInitReadinessRegistry)(broker, agentBrokerEventBus, consoleLogger);
805
841
  agentUdsRegistry.onReadinessSnapshotRequest(() => agentReadinessRegistry.getSnapshotForTransport());
806
842
  // D8 reverse leg: expose THIS agent's readiness snapshot so the hub can
807
843
  // snapshot-reconcile agent-origin records on every (re)connect and
@@ -811,7 +847,7 @@ async function startAgent(configPath) {
811
847
  // the synthesized `down` forever. Registered under
812
848
  // `$agent-readiness` (NOT `$readiness`) so the agent's own unqualified
813
849
  // `$readiness.getSnapshot` hub-hydrate call is never shadowed locally.
814
- broker.createService(createReadinessServiceForRegistry(agentReadinessRegistry, AGENT_READINESS_SERVICE_NAME));
850
+ broker.createService((0, system_1.createReadinessServiceForRegistry)(agentReadinessRegistry, system_1.AGENT_READINESS_SERVICE_NAME));
815
851
  }
816
852
  // ── HTTP server (Fastify) — status API + process management + UI ──
817
853
  // Started early (before addon boot) so the status page is reachable
@@ -823,21 +859,21 @@ async function startAgent(configPath) {
823
859
  // repair its own version. Addons: report only (the install is a hub push;
824
860
  // see `agent-addon-updates.ts`).
825
861
  const updateControls = {
826
- server: createAgentServerUpdateControls(agentUpdateService, (message) => {
862
+ server: (0, agent_update_routes_js_1.createAgentServerUpdateControls)(agentUpdateService, (message) => {
827
863
  // A refused/failed update that logs nothing reads as "never happened".
828
864
  consoleLogger.warn(`framework update not applied: ${message}`, {
829
865
  tags: { nodeId: config.nodeId },
830
866
  });
831
867
  }),
832
868
  addons: {
833
- hub: createAgentHubAddonControls({
869
+ hub: (0, agent_hub_addon_update_js_1.createAgentHubAddonControls)({
834
870
  nodeId: config.nodeId,
835
871
  // The mesh channel the agent already holds; the hub names this caller
836
872
  // `node:<id>` and answers per its remote privilege grant.
837
873
  callHub: (action, params, timeoutMs) => broker.call(action, params, { nodeID: 'hub', timeout: timeoutMs }),
838
874
  onProblem: (message) => consoleLogger.warn(message, { tags: { nodeId: config.nodeId } }),
839
875
  }),
840
- getReport: () => buildAgentAddonUpdateReport({
876
+ getReport: () => (0, agent_addon_updates_js_1.buildAgentAddonUpdateReport)({
841
877
  addonsDir: config.addonsDir,
842
878
  ...(process.env['CAMSTACK_NPM_REGISTRY'] !== undefined
843
879
  ? { registryUrl: process.env['CAMSTACK_NPM_REGISTRY'] }
@@ -851,8 +887,8 @@ async function startAgent(configPath) {
851
887
  // A hub pairs this agent from outside; the agent installs the certificate only after
852
888
  // its own operator confirmed the code. Its pairing state is advertised over mDNS.
853
889
  const agentVersion = process.env['CAMSTACK_AGENT_APP_VERSION'] ?? agentUpdateService.getRunningRootPackage().version;
854
- const agentMdns = new AgentMdnsAdvertiser({
855
- publisher: createCiaoPublisher(),
890
+ const agentMdns = new system_1.AgentMdnsAdvertiser({
891
+ publisher: (0, system_1.createCiaoPublisher)(),
856
892
  logger: consoleLogger,
857
893
  });
858
894
  const advertise = () => {
@@ -861,16 +897,16 @@ async function startAgent(configPath) {
861
897
  version: agentVersion,
862
898
  port: config.statusPort ?? 4444,
863
899
  state: pairing.state(),
864
- leafFingerprint: pairedLeafFingerprint(config.configPath),
900
+ leafFingerprint: (0, agent_pairing_store_js_1.pairedLeafFingerprint)(config.configPath),
865
901
  });
866
902
  };
867
- const localPairing = createLocalPairingAnnouncer(config.dataDir, consoleLogger);
868
- const pairing = new AgentPairing({
903
+ const localPairing = (0, agent_pairing_local_js_1.createLocalPairingAnnouncer)(config.dataDir, consoleLogger);
904
+ const pairing = new system_1.AgentPairing({
869
905
  nodeId: config.nodeId,
870
906
  version: agentVersion,
871
- isPaired: () => isAgentPaired(config.configPath),
907
+ isPaired: () => (0, agent_pairing_store_js_1.isAgentPaired)(config.configPath),
872
908
  install: async (installed) => {
873
- persistPairing(config.configPath, installed);
909
+ (0, agent_pairing_store_js_1.persistPairing)(config.configPath, installed);
874
910
  hubConnectionStateOverride = null;
875
911
  consoleLogger.info('Paired with the hub - reconnecting with the new certificate', {
876
912
  meta: { hubUrl: installed.hubUrl, hubAddress: installed.hubAddress },
@@ -888,14 +924,14 @@ async function startAgent(configPath) {
888
924
  });
889
925
  const forgetHubNow = async (why) => {
890
926
  consoleLogger.warn(`Leaving the hub: ${why}. This agent is unpaired and advertises again`);
891
- forgetPairing(config.configPath, config.dataDir);
927
+ (0, agent_pairing_store_js_1.forgetPairing)(config.configPath, config.dataDir);
892
928
  pairing.noteUnpaired();
893
929
  hubConnectionStateOverride = null;
894
- await reconnect().catch((err) => consoleLogger.error(`reconnect after unpairing failed: ${errMsg(err)}`));
930
+ await reconnect().catch((err) => consoleLogger.error(`reconnect after unpairing failed: ${(0, types_2.errMsg)(err)}`));
895
931
  advertise();
896
932
  };
897
933
  advertise();
898
- void startAgentHttpServer(getBrokerFn, {
934
+ void (0, agent_http_js_1.startAgentHttpServer)(getBrokerFn, {
899
935
  log: {
900
936
  info: (message, extras) => consoleLogger.info(message, extras),
901
937
  warn: (message, extras) => consoleLogger.warn(message, extras),
@@ -1004,7 +1040,7 @@ async function startAgent(configPath) {
1004
1040
  // here would only open a database nothing reads. See
1005
1041
  // `agent-infra-capabilities.ts` for the measurement behind that and for the
1006
1042
  // one-env-var rollback (`CAMSTACK_AGENT_LOCAL_DATA_STORE=1`).
1007
- const AGENT_INFRA = resolveAgentInfraCapabilities(process.env);
1043
+ const AGENT_INFRA = (0, agent_infra_capabilities_js_1.resolveAgentInfraCapabilities)(process.env);
1008
1044
  async function bootCoreAddons(broker, config, registry, loadedAddons, loggerFactory) {
1009
1045
  // Builtins come from the CLOSURE this process is running, exactly as the hub
1010
1046
  // has done since 2026-07-18 — never from a `<addonsDir>/@camstack/system`
@@ -1012,27 +1048,27 @@ async function bootCoreAddons(broker, config, registry, loadedAddons, loggerFact
1012
1048
  // 17 versions behind on 2026-08-11). `planAgentAddonScan` owns the decision
1013
1049
  // and the fallback; see `addon-scan.ts`. Non-framework infra providers
1014
1050
  // (e.g. `@camstack/addon-platform-probe-native`) still come from the scan.
1015
- const closureSystemDir = resolveHubClosurePackageDir(BUILTINS_PACKAGE);
1051
+ const closureSystemDir = (0, package_dir_utils_js_1.resolveHubClosurePackageDir)(addon_scan_js_1.BUILTINS_PACKAGE);
1016
1052
  if (closureSystemDir === null) {
1017
1053
  // Louder than the hub's warn: on an agent the builtins ARE the infra, so
1018
1054
  // this is pre-fatal. Boot continues to the D87 guard, which names every
1019
1055
  // required cap it could not resolve.
1020
- console.error(`[Agent] ${BUILTINS_PACKAGE} not resolvable from the running closure — ` +
1056
+ console.error(`[Agent] ${addon_scan_js_1.BUILTINS_PACKAGE} not resolvable from the running closure — ` +
1021
1057
  'falling back to the addon-root copy, if there is one');
1022
1058
  }
1023
- const packageDirs = planAgentAddonScan(config.addonsDir, closureSystemDir);
1059
+ const packageDirs = (0, addon_scan_js_1.planAgentAddonScan)(config.addonsDir, closureSystemDir);
1024
1060
  if (packageDirs.length === 0) {
1025
1061
  console.warn('[Agent] No addon packages found — running without infrastructure addons');
1026
1062
  return;
1027
1063
  }
1028
1064
  console.log(`[Agent] Scanning ${packageDirs.length} addon package(s) for infra providers`);
1029
- const loader = new AddonLoader();
1065
+ const loader = new system_1.AddonLoader();
1030
1066
  for (const dir of packageDirs) {
1031
1067
  try {
1032
1068
  await loader.loadFromAddonDir(dir);
1033
1069
  }
1034
1070
  catch (err) {
1035
- console.warn(`[Agent] Failed to scan ${dir}: ${errMsg(err)}`);
1071
+ console.warn(`[Agent] Failed to scan ${dir}: ${(0, types_2.errMsg)(err)}`);
1036
1072
  }
1037
1073
  }
1038
1074
  // Resolution is per-CAPABILITY (the guard names every missing required
@@ -1044,11 +1080,11 @@ async function bootCoreAddons(broker, config, registry, loadedAddons, loggerFact
1044
1080
  // 2026-08-08 the moment D87 promoted infra failures to fatal. The plan
1045
1081
  // makes the dedupe explicit and testable (see `infra-boot-plan.ts`).
1046
1082
  const byId = new Map(loader.listAddons().map((a) => [a.declaration.id, a]));
1047
- const plan = planInfraBoot(loader.listAddons().map((a) => ({
1083
+ const plan = (0, infra_boot_plan_js_1.planInfraBoot)(loader.listAddons().map((a) => ({
1048
1084
  id: a.declaration.id,
1049
1085
  capabilities: (a.declaration.capabilities ?? []).map((c) => typeof c === 'string' ? c : c.name),
1050
1086
  })), AGENT_INFRA);
1051
- const resolutions = planToResolutions(plan);
1087
+ const resolutions = (0, infra_boot_plan_js_1.planToResolutions)(plan);
1052
1088
  for (const step of plan) {
1053
1089
  if (step.addonId === null) {
1054
1090
  // Say it per-capability (an OPTIONAL miss is the only thing this line
@@ -1074,7 +1110,7 @@ async function bootCoreAddons(broker, config, registry, loadedAddons, loggerFact
1074
1110
  // in the registry (the storage addon declares itself before the
1075
1111
  // addons that depend on it per AGENT_INFRA order).
1076
1112
  const storageProvider = registry.getSingleton('storage') ?? undefined;
1077
- const context = await createAddonContext(broker, addon.declaration, config.dataDir, {
1113
+ const context = await (0, system_1.createAddonContext)(broker, addon.declaration, config.dataDir, {
1078
1114
  storageProvider,
1079
1115
  addonConfig: { rootPath: config.dataDir },
1080
1116
  createLogger: loggerFactory,
@@ -1085,7 +1121,7 @@ async function bootCoreAddons(broker, config, registry, loadedAddons, loggerFact
1085
1121
  // configured for type addons-data" → fatal crash-loop.
1086
1122
  listStorageLocationDeclarations: () => loader.listStorageLocationDeclarations(),
1087
1123
  });
1088
- const initResult = normalizeAddonInitResult(await instance.initialize(context));
1124
+ const initResult = (0, types_2.normalizeAddonInitResult)(await instance.initialize(context));
1089
1125
  for (const reg of initResult?.providers ?? []) {
1090
1126
  const capName = reg.capability.name;
1091
1127
  registry.registerProvider(capName, addonId, reg.provider);
@@ -1103,7 +1139,7 @@ async function bootCoreAddons(broker, config, registry, loadedAddons, loggerFact
1103
1139
  console.log(`[Agent] Core addon "${addonId}" initialized`);
1104
1140
  }
1105
1141
  catch (err) {
1106
- const msg = errMsg(err);
1142
+ const msg = (0, types_2.errMsg)(err);
1107
1143
  console.error(`[Agent] Failed to initialize core addon "${addonId}": ${msg}`);
1108
1144
  if (step.required) {
1109
1145
  throw new Error(`Required infrastructure addon "${addonId}" failed: ${msg}`, { cause: err });
@@ -1115,7 +1151,7 @@ async function bootCoreAddons(broker, config, registry, loadedAddons, loggerFact
1115
1151
  // the SILENT branch. Abort here instead of booting a node that cannot
1116
1152
  // store, configure or probe itself and whose manifest then makes every hub
1117
1153
  // routing decision about it wrong. See `infra-boot-guard.ts`.
1118
- assertRequiredInfraResolved(resolutions, config.addonsDir);
1154
+ (0, infra_boot_guard_js_1.assertRequiredInfraResolved)(resolutions, config.addonsDir);
1119
1155
  }
1120
1156
  // ---------------------------------------------------------------------------
1121
1157
  // Phase 1.5: Load cluster-capable addon packages
@@ -1127,7 +1163,7 @@ async function loadClusterCapableAddons(broker, config, capabilityRegistry, load
1127
1163
  // the single-copy collapse removes. The closure dir is deliberately NOT added:
1128
1164
  // adding it would newly expose `hub-forwarder` / `platform-probe` (the only
1129
1165
  // builtins carrying `execution`) as spawn candidates.
1130
- const addonPackageDirs = resolveAddonPackageDirs(config.addonsDir, systemSkipList());
1166
+ const addonPackageDirs = (0, addon_scan_js_1.resolveAddonPackageDirs)(config.addonsDir, systemSkipList());
1131
1167
  if (addonPackageDirs.length === 0)
1132
1168
  return;
1133
1169
  // ── Phase 0 (cross-package): collect every group-eligible addon
@@ -1141,12 +1177,12 @@ async function loadClusterCapableAddons(broker, config, capabilityRegistry, load
1141
1177
  // so each dir is parsed once.
1142
1178
  const dirToLoader = new Map();
1143
1179
  for (const dir of addonPackageDirs) {
1144
- const loader = new AddonLoader();
1180
+ const loader = new system_1.AddonLoader();
1145
1181
  try {
1146
1182
  await loader.loadFromAddonDir(dir);
1147
1183
  }
1148
1184
  catch (err) {
1149
- console.warn(`[Agent] Skipping ${dir}: ${errMsg(err)}`);
1185
+ console.warn(`[Agent] Skipping ${dir}: ${(0, types_2.errMsg)(err)}`);
1150
1186
  continue;
1151
1187
  }
1152
1188
  dirToLoader.set(dir, loader);
@@ -1155,11 +1191,11 @@ async function loadClusterCapableAddons(broker, config, capabilityRegistry, load
1155
1191
  continue;
1156
1192
  if (registered.declaration.execution === undefined)
1157
1193
  continue;
1158
- const placement = resolveAddonPlacement(registered.declaration);
1194
+ const placement = (0, types_2.resolveAddonPlacement)(registered.declaration);
1159
1195
  if (placement === 'hub-only')
1160
1196
  continue;
1161
1197
  allGroupCandidates.push({
1162
- groupId: resolveRunnerId(registered.declaration, registered.declaration.id),
1198
+ groupId: (0, types_2.resolveRunnerId)(registered.declaration, registered.declaration.id),
1163
1199
  addonId: registered.declaration.id,
1164
1200
  addonDir: dir,
1165
1201
  version: registered.declaration.version ?? '0.0.0',
@@ -1185,7 +1221,7 @@ async function loadClusterCapableAddons(broker, config, capabilityRegistry, load
1185
1221
  // Shared with the reload path (`ensureGroupRunner`) so the boot and
1186
1222
  // reload registrations can never drift — the drift was the in-process
1187
1223
  // reload-wedge's root cause.
1188
- registerGroupRunnerProviders({ broker, capabilityRegistry, loadedAddons }, addons);
1224
+ (0, agent_group_runner_js_1.registerGroupRunnerProviders)({ broker, capabilityRegistry, loadedAddons }, addons);
1189
1225
  console.log(`[Agent] Group "${groupId}" spawned with ${addons.length} addon(s): ${addons.map((a) => a.addonId).join(', ')}`);
1190
1226
  }
1191
1227
  catch (err) {
@@ -1207,7 +1243,7 @@ async function loadClusterCapableAddons(broker, config, capabilityRegistry, load
1207
1243
  const addonId = registered.declaration.id;
1208
1244
  if (loadedAddons.has(addonId))
1209
1245
  continue;
1210
- if (!isDeployableToAgent(registered.declaration))
1246
+ if (!(0, types_2.isDeployableToAgent)(registered.declaration))
1211
1247
  continue;
1212
1248
  console.warn(`[Agent] Addon "${addonId}" is deployable but missing from any spawned group — verify package.json execution field`);
1213
1249
  }
@@ -1227,25 +1263,25 @@ async function loadDeployedAddons(broker, addonsDir, dataDir, loadedAddons, stor
1227
1263
  // (re)dispatched to a subprocess, which loads the real module itself.
1228
1264
  // Same skip: a `$agent.deploy` of `@camstack/system` still lands bytes in the
1229
1265
  // addon root, but a reload must not adopt them over the closure.
1230
- const packageDirs = resolveAddonPackageDirs(addonsDir, systemSkipList());
1266
+ const packageDirs = (0, addon_scan_js_1.resolveAddonPackageDirs)(addonsDir, systemSkipList());
1231
1267
  const groupCandidates = [];
1232
1268
  // Dirs holding a deployable NON-group addon — and ONLY these — need the
1233
1269
  // importing loader. None exist under the default `hub-only` placement
1234
1270
  // (deployable ⟹ cluster-capable), so the heavy import path is never taken.
1235
1271
  const inProcessDirs = new Set();
1236
1272
  for (const dir of packageDirs) {
1237
- const manifest = readPackageManifestAddons(dir);
1273
+ const manifest = (0, agent_group_runner_js_1.readPackageManifestAddons)(dir);
1238
1274
  if (!manifest)
1239
1275
  continue;
1240
1276
  for (const decl of manifest.declarations) {
1241
1277
  const addonId = decl.id;
1242
1278
  if (loadedAddons.has(addonId))
1243
1279
  continue;
1244
- if (!isDeployableToAgent(decl))
1280
+ if (!(0, types_2.isDeployableToAgent)(decl))
1245
1281
  continue;
1246
- if (isGroupRunnerAddon(decl)) {
1282
+ if ((0, agent_group_runner_js_1.isGroupRunnerAddon)(decl)) {
1247
1283
  groupCandidates.push({
1248
- groupId: resolveRunnerId(decl, addonId),
1284
+ groupId: (0, types_2.resolveRunnerId)(decl, addonId),
1249
1285
  addonId,
1250
1286
  addonDir: dir,
1251
1287
  version: decl.version ?? '0.0.0',
@@ -1280,7 +1316,7 @@ async function loadDeployedAddons(broker, addonsDir, dataDir, loadedAddons, stor
1280
1316
  }
1281
1317
  const deployLogger = loggerFactory('agent-group-runner');
1282
1318
  for (const [groupId, addons] of grouped) {
1283
- await ensureGroupRunner({ broker, capabilityRegistry, loadedAddons, logger: deployLogger }, groupId, addons);
1319
+ await (0, agent_group_runner_js_1.ensureGroupRunner)({ broker, capabilityRegistry, loadedAddons, logger: deployLogger }, groupId, addons);
1284
1320
  }
1285
1321
  }
1286
1322
  /**
@@ -1302,28 +1338,28 @@ async function loadInProcessDeployedAddons(broker, dirs, dataDir, loadedAddons,
1302
1338
  capabilityRegistry,
1303
1339
  };
1304
1340
  for (const dir of dirs) {
1305
- const loader = new AddonLoader();
1341
+ const loader = new system_1.AddonLoader();
1306
1342
  try {
1307
1343
  await loader.loadFromAddonDir(dir);
1308
1344
  }
1309
1345
  catch (err) {
1310
- console.warn(`[Agent] Skipping ${dir}: ${errMsg(err)}`);
1346
+ console.warn(`[Agent] Skipping ${dir}: ${(0, types_2.errMsg)(err)}`);
1311
1347
  continue;
1312
1348
  }
1313
1349
  for (const registered of loader.listAddons()) {
1314
1350
  const addonId = registered.declaration.id;
1315
1351
  if (loadedAddons.has(addonId))
1316
1352
  continue;
1317
- if (!isDeployableToAgent(registered.declaration))
1353
+ if (!(0, types_2.isDeployableToAgent)(registered.declaration))
1318
1354
  continue;
1319
1355
  // Group-runner addons are dispatched to subprocesses by the caller.
1320
- if (isGroupRunnerAddon(registered.declaration))
1356
+ if ((0, agent_group_runner_js_1.isGroupRunnerAddon)(registered.declaration))
1321
1357
  continue;
1322
1358
  try {
1323
1359
  const instance = new registered.addonClass();
1324
- const context = await createAddonContext(broker, registered.declaration, dataDir, contextOptions);
1360
+ const context = await (0, system_1.createAddonContext)(broker, registered.declaration, dataDir, contextOptions);
1325
1361
  await instance.initialize(context);
1326
- const serviceSchema = createAddonService(instance, registered.declaration);
1362
+ const serviceSchema = (0, system_1.createAddonService)(instance, registered.declaration);
1327
1363
  broker.createService(serviceSchema);
1328
1364
  loadedAddons.set(addonId, {
1329
1365
  id: addonId,
@@ -1336,7 +1372,7 @@ async function loadInProcessDeployedAddons(broker, dirs, dataDir, loadedAddons,
1336
1372
  console.log(`[Agent] Deployed addon "${addonId}" loaded in-process`);
1337
1373
  }
1338
1374
  catch (err) {
1339
- const msg = errMsg(err);
1375
+ const msg = (0, types_2.errMsg)(err);
1340
1376
  console.error(`[Agent] Failed to load deployed addon "${addonId}": ${msg}`);
1341
1377
  loadedAddons.set(addonId, { id: addonId, status: 'error' });
1342
1378
  }
@@ -1378,7 +1414,7 @@ function readAgentVersion() {
1378
1414
  * copy is authoritative.
1379
1415
  */
1380
1416
  function systemSkipList() {
1381
- return resolveHubClosurePackageDir(BUILTINS_PACKAGE) === null ? [] : [BUILTINS_PACKAGE];
1417
+ return (0, package_dir_utils_js_1.resolveHubClosurePackageDir)(addon_scan_js_1.BUILTINS_PACKAGE) === null ? [] : [addon_scan_js_1.BUILTINS_PACKAGE];
1382
1418
  }
1383
1419
  // ---------------------------------------------------------------------------
1384
1420
  // E1 helper — agent-local UDS child manifest adaptation
@@ -1415,4 +1451,3 @@ function buildAgentChildUdsManifest(nodeId, childId, caps) {
1415
1451
  const addons = [...capsByAddon.entries()].map(([addonId, capNames]) => ({ addonId, capabilities: [...capNames] }));
1416
1452
  return { nodeId, addons };
1417
1453
  }
1418
- export { startAgent };