@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,3 +1,39 @@
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.applyPendingRestore = applyPendingRestore;
1
37
  /**
2
38
  * The boot-time system restore — the ONLY restore there is. The launcher calls
3
39
  * it before the addon installer and before any runner starts, so nothing has a
@@ -18,10 +54,10 @@
18
54
  * - archive missing → log + clear marker (auto-recover from stale)
19
55
  * - tar fails → throw → launcher exits non-zero, marker preserved
20
56
  */
21
- import * as fs from 'node:fs';
22
- import * as path from 'node:path';
23
- import * as tar from 'tar';
24
- import { applySqliteRestore, missingPromisedSnapshots, planSqliteRestore, } from './sqlite-restore.js';
57
+ const fs = __importStar(require("node:fs"));
58
+ const path = __importStar(require("node:path"));
59
+ const tar = __importStar(require("tar"));
60
+ const sqlite_restore_js_1 = require("./sqlite-restore.js");
25
61
  /** Path of the manifest file embedded inside every archive. */
26
62
  const ARCHIVE_MANIFEST_NAME = '.camstack-backup-manifest.json';
27
63
  const RESTORE_MARKER_FILE = '.pending-restore.json';
@@ -30,7 +66,7 @@ const RESTORE_MARKER_FILE = '.pending-restore.json';
30
66
  * present. Runs BEFORE the addon installer so the restored snapshot's
31
67
  * `addons/` folder is what `ensureRequiredPackages` picks up.
32
68
  */
33
- export async function applyPendingRestore(dataDir, log) {
69
+ async function applyPendingRestore(dataDir, log) {
34
70
  const markerPath = path.join(dataDir, RESTORE_MARKER_FILE);
35
71
  if (!fs.existsSync(markerPath))
36
72
  return;
@@ -91,10 +127,10 @@ export async function applyPendingRestore(dataDir, log) {
91
127
  return keep;
92
128
  },
93
129
  });
94
- applySqliteRestore(dataDir, planSqliteRestore(extracted), log);
130
+ (0, sqlite_restore_js_1.applySqliteRestore)(dataDir, (0, sqlite_restore_js_1.planSqliteRestore)(extracted), log);
95
131
  // A database the archive promised and the extraction did not write was NOT
96
132
  // restored. Say so before "Restore complete" — silence would read as done.
97
- const { missing, outOfScope } = missingPromisedSnapshots(promised, extracted, inScope);
133
+ const { missing, outOfScope } = (0, sqlite_restore_js_1.missingPromisedSnapshots)(promised, extracted, inScope);
98
134
  for (const rel of missing) {
99
135
  log(`[launcher] WARNING Restore: the archive promised the database snapshot ${rel} but carried none — that database was NOT restored`);
100
136
  }
@@ -1,3 +1,39 @@
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.runSingleCopyCleanup = runSingleCopyCleanup;
1
37
  /**
2
38
  * The one adapter that runs the post-boot single-copy sweep on BOTH roles.
3
39
  *
@@ -14,9 +50,9 @@
14
50
  * sweep that ends a process is an outage, and the copies it removes exist
15
51
  * precisely because a node once could not boot.
16
52
  */
17
- import * as fs from 'node:fs';
18
- import * as path from 'node:path';
19
- import { discoverRedundantCopies, executeSingleCopyCleanup, formatCleanupPlan, isCleanupEnabled, planSingleCopyCleanup, } from './single-copy-cleanup.js';
53
+ const fs = __importStar(require("node:fs"));
54
+ const path = __importStar(require("node:path"));
55
+ const single_copy_cleanup_js_1 = require("./single-copy-cleanup.js");
20
56
  const EMPTY_RESULT = { removed: [], failed: [], refused: true };
21
57
  /**
22
58
  * Discover, plan, report, sweep. Called only from a point where the role has
@@ -24,13 +60,13 @@ const EMPTY_RESULT = { removed: [], failed: [], refused: true };
24
60
  * re-stated as `bootHealthy: true` here so the pure planner can be exercised
25
61
  * from both sides in a test.
26
62
  */
27
- export async function runSingleCopyCleanup(opts) {
63
+ async function runSingleCopyCleanup(opts) {
28
64
  try {
29
- if (!isCleanupEnabled(process.env)) {
65
+ if (!(0, single_copy_cleanup_js_1.isCleanupEnabled)(process.env)) {
30
66
  opts.log('single-copy cleanup disabled by CAMSTACK_SINGLE_COPY_CLEANUP — nothing removed');
31
67
  return EMPTY_RESULT;
32
68
  }
33
- const candidates = discoverRedundantCopies({
69
+ const candidates = (0, single_copy_cleanup_js_1.discoverRedundantCopies)({
34
70
  dataDir: opts.dataDir,
35
71
  addonRoot: opts.addonRoot,
36
72
  closureProvides: (pkg) => {
@@ -46,7 +82,7 @@ export async function runSingleCopyCleanup(opts) {
46
82
  exists: (p) => fs.existsSync(p),
47
83
  readVersion: (dir) => readVersion(dir),
48
84
  });
49
- const plan = planSingleCopyCleanup({
85
+ const plan = (0, single_copy_cleanup_js_1.planSingleCopyCleanup)({
50
86
  activeRoot: process.env['CAMSTACK_SERVER_ACTIVE_ROOT'] ?? null,
51
87
  closureResolvedFrom: resolveSystemPath(),
52
88
  bootHealthy: true,
@@ -56,9 +92,9 @@ export async function runSingleCopyCleanup(opts) {
56
92
  .filter((entry) => entry.length > 0),
57
93
  candidates,
58
94
  });
59
- for (const line of formatCleanupPlan(plan))
95
+ for (const line of (0, single_copy_cleanup_js_1.formatCleanupPlan)(plan))
60
96
  opts.log(line);
61
- return await executeSingleCopyCleanup(plan, {
97
+ return await (0, single_copy_cleanup_js_1.executeSingleCopyCleanup)(plan, {
62
98
  exists: (p) => fs.existsSync(p),
63
99
  rename: (from, to) => fs.renameSync(from, to),
64
100
  remove: async (p) => {
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  /**
2
3
  * Post-boot convergence to ONE copy per node — [D45](../../../docs/decisions/adr-0045.md),
3
4
  * task 32.
@@ -35,6 +36,13 @@
35
36
  * Pure planning + an injected filesystem, so the whole thing is testable
36
37
  * against a described layout rather than a real disk.
37
38
  */
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.CLOSURE_PROVIDED_PACKAGES = void 0;
41
+ exports.planSingleCopyCleanup = planSingleCopyCleanup;
42
+ exports.executeSingleCopyCleanup = executeSingleCopyCleanup;
43
+ exports.formatCleanupPlan = formatCleanupPlan;
44
+ exports.discoverRedundantCopies = discoverRedundantCopies;
45
+ exports.isCleanupEnabled = isCleanupEnabled;
38
46
  /** Image trees. The fallback source lives here and is never data-side. */
39
47
  const IMAGE_PREFIX = '/opt/';
40
48
  /**
@@ -43,7 +51,7 @@ const IMAGE_PREFIX = '/opt/';
43
51
  * The node-wide gates come first and are absolute: a blocked plan removes
44
52
  * nothing at all, whatever the individual candidates look like.
45
53
  */
46
- export function planSingleCopyCleanup(input) {
54
+ function planSingleCopyCleanup(input) {
47
55
  const blockedReason = nodeWideBlock(input);
48
56
  if (blockedReason !== null) {
49
57
  return {
@@ -110,7 +118,7 @@ function isInside(child, parent) {
110
118
  * only intended producer, but a hand-assembled plan must not be able to walk
111
119
  * past the one gate that keeps this from running at the wrong moment.
112
120
  */
113
- export async function executeSingleCopyCleanup(plan, fs, log) {
121
+ async function executeSingleCopyCleanup(plan, fs, log) {
114
122
  if (plan.blocked) {
115
123
  log(`single-copy cleanup REFUSED — ${plan.blockedReason ?? 'blocked'}`);
116
124
  return { removed: [], failed: [], refused: true };
@@ -152,7 +160,7 @@ function errMsg(err) {
152
160
  * BLOCKED sweep names every copy it left behind, because those are exactly the
153
161
  * ones an operator would otherwise believe were gone.
154
162
  */
155
- export function formatCleanupPlan(plan) {
163
+ function formatCleanupPlan(plan) {
156
164
  const lines = [];
157
165
  if (plan.blocked) {
158
166
  lines.push(`single-copy cleanup blocked — ${plan.blockedReason ?? 'unknown reason'}; ` +
@@ -177,7 +185,7 @@ export function formatCleanupPlan(plan) {
177
185
  * and the reason `<dataDir>/addons/@camstack/system` is on the agent's disk at
178
186
  * 1.2.78 while it runs a newer closure.
179
187
  */
180
- export const CLOSURE_PROVIDED_PACKAGES = [
188
+ exports.CLOSURE_PROVIDED_PACKAGES = [
181
189
  '@camstack/system',
182
190
  '@camstack/types',
183
191
  '@camstack/sdk',
@@ -191,7 +199,7 @@ export const CLOSURE_PROVIDED_PACKAGES = [
191
199
  * version — dropping it would under-report exactly the kind that has been
192
200
  * sitting somewhere since an interrupted install.
193
201
  */
194
- export function discoverRedundantCopies(input, fs) {
202
+ function discoverRedundantCopies(input, fs) {
195
203
  const found = [];
196
204
  const legacyFramework = `${trimSlash(input.dataDir)}/framework`;
197
205
  if (fs.exists(legacyFramework)) {
@@ -202,7 +210,7 @@ export function discoverRedundantCopies(input, fs) {
202
210
  version: fs.readVersion(`${legacyFramework}/node_modules/@camstack/system`),
203
211
  });
204
212
  }
205
- for (const pkg of CLOSURE_PROVIDED_PACKAGES) {
213
+ for (const pkg of exports.CLOSURE_PROVIDED_PACKAGES) {
206
214
  if (!input.closureProvides(pkg))
207
215
  continue;
208
216
  const dir = `${trimSlash(input.addonRoot)}/${pkg}`;
@@ -226,7 +234,7 @@ function trimSlash(p) {
226
234
  * an operator has to edit code to stop. `CAMSTACK_SINGLE_COPY_CLEANUP=off`
227
235
  * (or `0` / `false`) leaves every copy where it is, and the boot says so.
228
236
  */
229
- export function isCleanupEnabled(env) {
237
+ function isCleanupEnabled(env) {
230
238
  const raw = env['CAMSTACK_SINGLE_COPY_CLEANUP']?.trim().toLowerCase();
231
239
  return raw !== 'off' && raw !== '0' && raw !== 'false';
232
240
  }
@@ -1,3 +1,42 @@
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.SQLITE_SNAPSHOT_SUFFIX = void 0;
37
+ exports.planSqliteRestore = planSqliteRestore;
38
+ exports.applySqliteRestore = applySqliteRestore;
39
+ exports.missingPromisedSnapshots = missingPromisedSnapshots;
1
40
  /**
2
41
  * The SQLite half of the boot-time restore (D693). Runs in the launcher,
3
42
  * BEFORE any runner exists — on databases nobody has open, which is the one
@@ -25,20 +64,20 @@
25
64
  * suffix is spelled here and pinned to `DATABASE_SNAPSHOT_SUFFIX` by
26
65
  * `pending-restore-sqlite.spec.ts`.
27
66
  */
28
- import * as fs from 'node:fs';
29
- import * as path from 'node:path';
67
+ const fs = __importStar(require("node:fs"));
68
+ const path = __importStar(require("node:path"));
30
69
  /** Mirrors `DATABASE_SNAPSHOT_SUFFIX` in `@camstack/types` (spec-pinned). */
31
- export const SQLITE_SNAPSHOT_SUFFIX = '.backup-snapshot';
70
+ exports.SQLITE_SNAPSHOT_SUFFIX = '.backup-snapshot';
32
71
  const SIDECARS = ['-wal', '-shm', '-journal'];
33
72
  const DATABASE_SUFFIXES = ['.db', '.sqlite', '.sqlite3'];
34
73
  /** Decide, from the paths an extraction wrote, what the target needs. */
35
- export function planSqliteRestore(extracted) {
74
+ function planSqliteRestore(extracted) {
36
75
  const written = new Set(extracted);
37
76
  const promote = [];
38
77
  const dropSidecars = new Map();
39
78
  for (const rel of written) {
40
- if (rel.endsWith(SQLITE_SNAPSHOT_SUFFIX)) {
41
- const database = rel.slice(0, -SQLITE_SNAPSHOT_SUFFIX.length);
79
+ if (rel.endsWith(exports.SQLITE_SNAPSHOT_SUFFIX)) {
80
+ const database = rel.slice(0, -exports.SQLITE_SNAPSHOT_SUFFIX.length);
42
81
  promote.push(rel);
43
82
  // Whatever sits beside the target belongs to the database being replaced.
44
83
  dropSidecars.set(database, [...SIDECARS]);
@@ -66,7 +105,7 @@ function fsyncDirectory(dir) {
66
105
  * and each touched directory is fsynced before the caller clears its marker —
67
106
  * a power cut after "Restore complete" must not bring the stale WAL back.
68
107
  */
69
- export function applySqliteRestore(dataDir, plan, log, syncDirectory = fsyncDirectory) {
108
+ function applySqliteRestore(dataDir, plan, log, syncDirectory = fsyncDirectory) {
70
109
  const touched = new Set();
71
110
  for (const [database, sidecars] of plan.dropSidecars) {
72
111
  for (const sidecar of sidecars) {
@@ -79,7 +118,7 @@ export function applySqliteRestore(dataDir, plan, log, syncDirectory = fsyncDire
79
118
  }
80
119
  }
81
120
  for (const snapshot of plan.promote) {
82
- const database = snapshot.slice(0, -SQLITE_SNAPSHOT_SUFFIX.length);
121
+ const database = snapshot.slice(0, -exports.SQLITE_SNAPSHOT_SUFFIX.length);
83
122
  fs.renameSync(path.join(dataDir, snapshot), path.join(dataDir, database));
84
123
  touched.add(path.dirname(path.join(dataDir, database)));
85
124
  log(`[launcher] Restore: promoted the owner snapshot ${snapshot} → ${database}`);
@@ -95,7 +134,7 @@ export function applySqliteRestore(dataDir, plan, log, syncDirectory = fsyncDire
95
134
  }
96
135
  }
97
136
  }
98
- export function missingPromisedSnapshots(promised, extracted, inScope) {
137
+ function missingPromisedSnapshots(promised, extracted, inScope) {
99
138
  const written = new Set(extracted);
100
139
  const missing = [];
101
140
  const outOfScope = [];
package/dist/starter.js CHANGED
@@ -1,3 +1,38 @@
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 });
1
36
  /**
2
37
  * STARTER — the tiny, immutable, dependency-free entry baked into the hub
3
38
  * image. Everything above it (launcher, main, framework, addons) is runtime-
@@ -14,15 +49,15 @@
14
49
  *
15
50
  * Console usage is intentional: the starter runs before any logging exists.
16
51
  */
17
- import * as path from 'node:path';
18
- import { HUB_ROOT_SPEC, runNodeStarter } from './server-root/index.js';
52
+ const path = __importStar(require("node:path"));
53
+ const index_js_1 = require("./server-root/index.js");
19
54
  function start() {
20
55
  const seedPackageDir = path.resolve(__dirname, '..');
21
56
  if (process.env['CAMSTACK_SEED_SERVER_DIR'] === undefined) {
22
57
  process.env['CAMSTACK_SEED_SERVER_DIR'] = seedPackageDir;
23
58
  }
24
- runNodeStarter({
25
- spec: HUB_ROOT_SPEC,
59
+ (0, index_js_1.runNodeStarter)({
60
+ spec: index_js_1.HUB_ROOT_SPEC,
26
61
  envNames: {
27
62
  bootMode: 'CAMSTACK_SERVER_BOOT_MODE',
28
63
  activeRoot: 'CAMSTACK_SERVER_ACTIVE_ROOT',
@@ -1,5 +1,41 @@
1
- import * as fs from 'node:fs';
2
- import * as path from 'node:path';
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.createLazyUiServing = createLazyUiServing;
37
+ const fs = __importStar(require("node:fs"));
38
+ const path = __importStar(require("node:path"));
3
39
  const DEFAULT_ATTEMPT_GAP_MS = 2_000;
4
40
  const DEFAULT_REQUEST_WAIT_MS = 4_000;
5
41
  /** Wait for `work`, but never longer than `ms`: a hung provider RPC must not hang every request. */
@@ -24,7 +60,7 @@ async function waitAtMost(work, ms) {
24
60
  * provider (addon update/restart) or a vanished index re-resolves, so the
25
61
  * served directory follows the provider. No timers, no retry loop.
26
62
  */
27
- export function createLazyUiServing(options) {
63
+ function createLazyUiServing(options) {
28
64
  const gapMs = options.minAttemptGapMs ?? DEFAULT_ATTEMPT_GAP_MS;
29
65
  const waitMs = options.requestWaitMs ?? DEFAULT_REQUEST_WAIT_MS;
30
66
  const now = options.now ?? Date.now;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.594",
3
+ "version": "1.2.596",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "files": [
@@ -38,19 +38,19 @@
38
38
  ]
39
39
  },
40
40
  "dependencies": {
41
- "@camstack/addon-admin-ui": "1.2.436",
42
- "@camstack/addon-agent-ui": "1.2.243",
41
+ "@camstack/addon-admin-ui": "1.2.437",
42
+ "@camstack/addon-agent-ui": "1.2.244",
43
43
  "@camstack/addon-auth": "1.2.149",
44
44
  "@camstack/addon-decoder-nodeav": "1.2.123",
45
45
  "@camstack/addon-notifiers": "1.2.601",
46
46
  "@camstack/addon-pipeline": "1.2.601",
47
47
  "@camstack/addon-pipeline-orchestrator": "1.2.601",
48
48
  "@camstack/addon-post-analysis": "1.2.601",
49
- "@camstack/develop": "0.1.12",
49
+ "@camstack/develop": "0.1.13",
50
50
  "@camstack/sdk": "1.2.133",
51
- "@camstack/system": "1.2.445",
52
- "@camstack/types": "1.2.381",
53
- "@camstack/ui-library": "1.2.299",
51
+ "@camstack/system": "1.2.446",
52
+ "@camstack/types": "1.2.382",
53
+ "@camstack/ui-library": "1.2.300",
54
54
  "@fastify/compress": "^9.0.0",
55
55
  "@fastify/cookie": "^11.0.2",
56
56
  "@fastify/cors": "^11.2.0",