@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.
- package/dist/addon-root-inventory.js +50 -11
- package/dist/agent/addon-scan.js +44 -6
- package/dist/agent/agent-addon-runtime.js +8 -3
- package/dist/agent/agent-addon-updates.js +52 -12
- package/dist/agent/agent-cap-dispatch-service.js +5 -3
- package/dist/agent/agent-config.js +42 -7
- package/dist/agent/agent-deploy-swap.js +41 -5
- package/dist/agent/agent-group-runner.js +47 -8
- package/dist/agent/agent-http-auth.js +22 -10
- package/dist/agent/agent-http.js +113 -64
- package/dist/agent/agent-hub-addon-update.js +16 -10
- package/dist/agent/agent-hub-registration.js +7 -4
- package/dist/agent/agent-infra-capabilities.js +9 -5
- package/dist/agent/agent-json-file.js +42 -5
- package/dist/agent/agent-mesh-gate.js +8 -5
- package/dist/agent/agent-node-certificates.js +28 -25
- package/dist/agent/agent-pairing-local.js +47 -10
- package/dist/agent/agent-pairing-routes.js +20 -16
- package/dist/agent/agent-pairing-store.js +58 -18
- package/dist/agent/agent-reconnect.js +4 -1
- package/dist/agent/agent-service.js +71 -35
- package/dist/agent/agent-sniffing-listener.js +48 -11
- package/dist/agent/agent-undeploy.js +41 -5
- package/dist/agent/agent-update-routes.js +19 -14
- package/dist/agent/agent-update-service.js +80 -38
- package/dist/agent/apply-model-distribution.js +4 -1
- package/dist/agent/apply-stage-dev-uploads.js +9 -6
- package/dist/agent/derive-hub-url.js +8 -3
- package/dist/agent/fetch-bundle-from-hub.js +9 -6
- package/dist/agent/hubs-found.js +43 -6
- package/dist/agent/infra-boot-guard.js +4 -1
- package/dist/agent/infra-boot-plan.js +6 -2
- package/dist/agent/main.js +183 -148
- package/dist/agent/register-agent-cap-dispatch.js +6 -3
- package/dist/agent/serial-queue.js +7 -2
- package/dist/agent-status-page.js +4 -1
- package/dist/api/addon-upload.js +61 -22
- package/dist/api/agent-addon-delivery.js +11 -6
- package/dist/api/auth-whoami.js +4 -1
- package/dist/api/backup-download-pump.js +9 -5
- package/dist/api/backup-download.js +10 -7
- package/dist/api/core/addon-settings.router.js +19 -16
- package/dist/api/core/agent-pairing.router.js +79 -76
- package/dist/api/core/agents.router.js +24 -21
- package/dist/api/core/auth-admin-tokens.procedures.js +52 -48
- package/dist/api/core/auth-device-cert.procedures.js +67 -62
- package/dist/api/core/auth-limits.js +25 -16
- package/dist/api/core/auth-reauth.procedures.js +37 -32
- package/dist/api/core/auth-revoke-credentials.procedures.js +26 -22
- package/dist/api/core/auth-sessions.procedures.js +56 -52
- package/dist/api/core/auth.router.js +304 -300
- package/dist/api/core/cap-providers.js +121 -74
- package/dist/api/core/capabilities.router.js +37 -34
- package/dist/api/core/capability-preference-writes.js +17 -10
- package/dist/api/core/certificates.router.js +109 -106
- package/dist/api/core/cluster-nodes.router.js +18 -15
- package/dist/api/core/collection-preference.js +6 -2
- package/dist/api/core/event-bus-proxy.router.js +37 -34
- package/dist/api/core/failure-contributions.js +8 -4
- package/dist/api/core/hwaccel.router.js +20 -17
- package/dist/api/core/integration-secrets.js +12 -8
- package/dist/api/core/lifecycle-job-runner.js +49 -13
- package/dist/api/core/live-events.router.js +32 -29
- package/dist/api/core/load-contributions.js +8 -4
- package/dist/api/core/logging-settings.js +43 -30
- package/dist/api/core/logs.router.js +43 -40
- package/dist/api/core/notifications.router.js +18 -15
- package/dist/api/core/public-event-filter.js +8 -4
- package/dist/api/core/repl.router.js +21 -18
- package/dist/api/core/request-census-settings.js +16 -11
- package/dist/api/core/server-management.provider.js +4 -1
- package/dist/api/core/server-name.js +17 -9
- package/dist/api/core/site-location.js +24 -16
- package/dist/api/core/stream-probe.router.js +24 -21
- package/dist/api/core/system-events.router.js +26 -23
- package/dist/api/cors/cors-policy.js +29 -20
- package/dist/api/cors/register-cors-policy.js +14 -9
- package/dist/api/deploy-stage-registry.js +10 -6
- package/dist/api/dev-uploads-bundle.js +50 -12
- package/dist/api/health/adaptive-probe.routes.js +13 -9
- package/dist/api/health/health.routes.js +13 -8
- package/dist/api/hub-cluster-url.js +9 -3
- package/dist/api/model-distributor.js +50 -12
- package/dist/api/oauth2/consent-page.js +13 -10
- package/dist/api/oauth2/oauth2-routes.js +25 -17
- package/dist/api/oauth2/private-host.js +4 -1
- package/dist/api/server-upload-propagate.js +51 -15
- package/dist/api/server-upload.js +50 -13
- package/dist/api/sse-no-compression.js +4 -1
- package/dist/api/static/frame-policy.js +9 -4
- package/dist/api/static/precompressed-asset.js +57 -15
- package/dist/api/static/spa-mount.js +47 -8
- package/dist/api/static/spa-static.js +12 -5
- package/dist/api/tarball-manifest.js +44 -7
- package/dist/api/trpc/cap-mount-helpers.js +12 -7
- package/dist/api/trpc/cap-route-error-formatter.js +13 -10
- package/dist/api/trpc/cap-router-runtime.js +51 -40
- package/dist/api/trpc/client-ip.js +20 -9
- package/dist/api/trpc/core-cap-bridge.js +42 -32
- package/dist/api/trpc/device-collection-dispatch.js +27 -23
- package/dist/api/trpc/device-config-secret-redaction.js +40 -24
- package/dist/api/trpc/generated-cap-mounts.js +225 -219
- package/dist/api/trpc/generated-cap-routers.js +5167 -4852
- package/dist/api/trpc/http-request-census-hook.js +11 -8
- package/dist/api/trpc/http-request-census.js +41 -34
- package/dist/api/trpc/http-request-census.singleton.js +8 -4
- package/dist/api/trpc/localized-schema-paths.js +4 -1
- package/dist/api/trpc/principal-visibility.js +22 -14
- package/dist/api/trpc/remote-addon-update-grant.js +4 -1
- package/dist/api/trpc/scope-access.js +15 -10
- package/dist/api/trpc/server-provided-caps.js +7 -3
- package/dist/api/trpc/share-view-access.js +14 -6
- package/dist/api/trpc/trpc-error-device-tags.js +6 -3
- package/dist/api/trpc/trpc-error-principal.js +6 -2
- package/dist/api/trpc/trpc.context.js +25 -20
- package/dist/api/trpc/trpc.middleware.js +46 -38
- package/dist/api/trpc/trpc.router.js +99 -58
- package/dist/api/trpc/user-error.js +8 -5
- package/dist/api/trpc/ws-request-census.js +24 -17
- package/dist/api/trpc/ws-slow-consumer-guard.js +16 -11
- package/dist/api/upload-auth.js +9 -5
- package/dist/auth/addon-route-jwt-gate.js +7 -4
- package/dist/auth/addon-route-share-gate.js +12 -7
- package/dist/auth/app-confirm-page.js +22 -17
- package/dist/auth/app-confirm-routes.js +31 -26
- package/dist/auth/app-confirmations.js +44 -7
- package/dist/auth/app-page-shell.js +30 -17
- package/dist/auth/app-page-strings.js +17 -11
- package/dist/auth/app-passkey-page.js +21 -16
- package/dist/auth/app-passkey-routes.js +41 -37
- package/dist/auth/app-refused-route.js +18 -13
- package/dist/auth/auth-network-policy.js +15 -11
- package/dist/auth/auth-provider-gate.js +9 -4
- package/dist/auth/auth-rate-limit.js +7 -3
- package/dist/auth/client-address.js +9 -6
- package/dist/auth/device-enroll-proofs.js +43 -6
- package/dist/auth/external-link-intents.js +7 -3
- package/dist/auth/hub-sessions.js +12 -6
- package/dist/auth/native-link-completions.js +11 -7
- package/dist/auth/native-return.js +13 -9
- package/dist/auth/passkey-provider.js +32 -26
- package/dist/auth/second-factors.js +10 -6
- package/dist/auth/session-connections.js +12 -6
- package/dist/auth/session-cookie.js +23 -12
- package/dist/auth/session-lifetimes.js +12 -8
- package/dist/auth/session-mint.js +11 -4
- package/dist/auth/sso-finish-app.js +16 -13
- package/dist/auth/sso-finish-deps.js +27 -21
- package/dist/auth/sso-finish.js +38 -28
- package/dist/auth/sso-routes.js +25 -22
- package/dist/auth/used-bridge-ids.js +5 -1
- package/dist/boot/boot-config.js +55 -16
- package/dist/boot/init-sequence.js +4 -1
- package/dist/boot/integration-id-backfill.js +8 -3
- package/dist/boot/platform-keychain-key.js +42 -5
- package/dist/boot/post-boot.service.js +18 -14
- package/dist/boot/reconcile-lifecycle-jobs.js +6 -3
- package/dist/boot/retired-public-url-env.js +8 -4
- package/dist/bootstrap-packages.js +4 -1
- package/dist/closure-node-modules.js +38 -2
- package/dist/core/addon/addon-call-gateway.js +5 -1
- package/dist/core/addon/addon-package.service.js +123 -83
- package/dist/core/addon/addon-process-view.js +6 -2
- package/dist/core/addon/addon-realign-plan.js +4 -1
- package/dist/core/addon/addon-registry.service.js +187 -146
- package/dist/core/addon/addon-row-manifest.js +4 -1
- package/dist/core/addon/addon-search.service.js +7 -3
- package/dist/core/addon/addon-settings-provider.js +3 -1
- package/dist/core/addon/addon-uninstall.js +11 -4
- package/dist/core/addon/addon.tokens.js +5 -2
- package/dist/core/addon/device-meta-mirror.js +13 -8
- package/dist/core/addon/forked-custom-actions.js +11 -6
- package/dist/core/addon/integration-visibility.js +6 -3
- package/dist/core/addon/materialize-route-path.js +4 -1
- package/dist/core/addon/package-dir-utils.js +45 -8
- package/dist/core/addon/prune-misplaced-addons.js +43 -5
- package/dist/core/addon/runner-convergence.js +4 -1
- package/dist/core/addon/runner-serialization.js +4 -1
- package/dist/core/addon/runner-spawn-fanout.js +8 -3
- package/dist/core/addon/settings-door-wiring.js +8 -5
- package/dist/core/addon/single-flight-refresh.js +4 -1
- package/dist/core/addon-bridge/addon-bridge.service.js +44 -7
- package/dist/core/addon-pages/addon-pages.service.js +40 -3
- package/dist/core/addon-widgets/addon-widgets.service.js +42 -4
- package/dist/core/agent/agent-addon-backfill.js +17 -9
- package/dist/core/agent/agent-delivery-ledger.js +7 -3
- package/dist/core/agent/agent-liveness-event.js +6 -2
- package/dist/core/agent/agent-pairing-http.js +45 -41
- package/dist/core/agent/agent-registry.service.js +89 -50
- package/dist/core/agent/cluster-node-history-mirror.js +7 -3
- package/dist/core/agent/cluster-node-history-store.js +35 -31
- package/dist/core/agent/hub-agent-pairing.js +5 -1
- package/dist/core/agent/node-certificates-client.js +6 -3
- package/dist/core/agent/node-directory.js +4 -1
- package/dist/core/app-links/well-known-app-links.js +6 -2
- package/dist/core/auth/auth.service.js +8 -3
- package/dist/core/auth/handoff-code.service.js +49 -11
- package/dist/core/auth/record-kinds.js +19 -16
- package/dist/core/auth/share-token.service.js +79 -42
- package/dist/core/capability/capability.service.js +5 -1
- package/dist/core/config/config.schema.js +6 -1
- package/dist/core/config/config.service.js +6 -2
- package/dist/core/events/event-bus.service.js +7 -3
- package/dist/core/feature/feature.service.js +6 -2
- package/dist/core/lifecycle/lifecycle-runner.singleton.js +10 -5
- package/dist/core/lifecycle/lifecycle-state-machine.js +5 -1
- package/dist/core/logging/log-ring-buffer.js +5 -1
- package/dist/core/logging/logging.service.js +9 -5
- package/dist/core/logging/scoped-logger.js +5 -1
- package/dist/core/moleculer/agent-readiness-pull.js +4 -1
- package/dist/core/moleculer/agent-registration-request.js +7 -3
- package/dist/core/moleculer/cap-call-fn.js +7 -4
- package/dist/core/moleculer/cap-route-authority.js +8 -3
- package/dist/core/moleculer/hub-mesh-guard.js +9 -5
- package/dist/core/moleculer/moleculer.service.js +86 -79
- package/dist/core/network/network-quality.service.js +6 -2
- package/dist/core/notification/notification-wrapper.service.js +7 -3
- package/dist/core/notification/toast-wrapper.service.js +7 -3
- package/dist/core/provider/provider.tokens.js +4 -1
- package/dist/core/repl/repl-engine.service.js +8 -4
- package/dist/core/runner-health/runner-boot-check.js +15 -7
- package/dist/core/runner-health/update-preflight.js +14 -9
- package/dist/core/server-update/server-update.service.js +49 -12
- package/dist/core/server-update/system-apply-closure-patches.js +42 -6
- package/dist/core/server-update/system-ensure-prebuilds.js +6 -3
- package/dist/core/server-update/system-exec-npm.js +5 -2
- package/dist/core/storage/fs-storage-backend.js +5 -1
- package/dist/core/storage/storage-location-manager.js +5 -1
- package/dist/core/storage/storage.service.js +6 -2
- package/dist/core/streaming/ffmpeg-stream-info.js +8 -3
- package/dist/core/streaming/stream-probe.service.js +16 -12
- package/dist/core/streaming/ttl-cache.js +5 -1
- package/dist/core/topology/topology-emitter.service.js +23 -19
- package/dist/core/update-availability-emitter.js +7 -3
- package/dist/core/update-availability-store.js +45 -8
- package/dist/core/updates/agent-installed-packages.js +9 -5
- package/dist/core/updates/restart-marker.js +8 -3
- package/dist/core/updates/update-check-scheduler.js +18 -13
- package/dist/core/updates/wrapper-update-checker.js +7 -3
- package/dist/first-boot-addon-plan.js +6 -2
- package/dist/framework-nodepath.js +38 -2
- package/dist/i18n/request-lang.js +11 -7
- package/dist/launcher.js +65 -30
- package/dist/lifecycle-journal-path.js +38 -2
- package/dist/main.js +324 -286
- package/dist/manual-boot.js +156 -117
- package/dist/node-role.js +4 -1
- package/dist/package-inventory.js +48 -7
- package/dist/pending-restore.js +43 -7
- package/dist/single-copy-cleanup-runner.js +45 -9
- package/dist/single-copy-cleanup.js +15 -7
- package/dist/sqlite-restore.js +48 -9
- package/dist/starter.js +39 -4
- package/dist/ui-serving/lazy-ui-serving.js +39 -3
- package/package.json +7 -7
|
@@ -1,12 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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.AgentRegistryService = exports.AGENT_BACKFILL_RPC_TIMEOUT_MS = void 0;
|
|
37
|
+
exports.toNodeLiveness = toNodeLiveness;
|
|
38
|
+
exports.toDescriptor = toDescriptor;
|
|
39
|
+
const node_crypto_1 = require("node:crypto");
|
|
40
|
+
const os = __importStar(require("node:os"));
|
|
41
|
+
const system_1 = require("@camstack/system");
|
|
42
|
+
const types_1 = require("@camstack/types");
|
|
43
|
+
const agent_addon_backfill_1 = require("./agent-addon-backfill");
|
|
44
|
+
const agent_delivery_ledger_1 = require("./agent-delivery-ledger");
|
|
45
|
+
const agent_liveness_event_1 = require("./agent-liveness-event");
|
|
46
|
+
const cluster_node_history_mirror_1 = require("./cluster-node-history-mirror");
|
|
47
|
+
const node_directory_1 = require("./node-directory");
|
|
10
48
|
/** Turn a forget outcome into the sentence the operator reads. */
|
|
11
49
|
function describeForgetOutcome(nodeId, history, registryRemoved, stillListed) {
|
|
12
50
|
const parts = [];
|
|
@@ -34,7 +72,7 @@ const AGENT_RECONCILE_RPC_TIMEOUT_MS = 8_000;
|
|
|
34
72
|
* and a timeout here aborts the call even though the deploy already landed.
|
|
35
73
|
* Matches the `addons.updatePackage` agent path.
|
|
36
74
|
*/
|
|
37
|
-
|
|
75
|
+
exports.AGENT_BACKFILL_RPC_TIMEOUT_MS = 300_000;
|
|
38
76
|
/**
|
|
39
77
|
* Package name of the system/infrastructure builtins. Addons shipped in
|
|
40
78
|
* `@camstack/system` (filesystem-storage, storage-orchestrator,
|
|
@@ -89,7 +127,7 @@ function rosterFromAddons(addons) {
|
|
|
89
127
|
* Child runner ids (`hub/foo`, `agent/bar`) are processes, not cluster
|
|
90
128
|
* nodes — excluded, same rule as `listNodes()` / `classifyNode`.
|
|
91
129
|
*/
|
|
92
|
-
|
|
130
|
+
function toNodeLiveness(nodes) {
|
|
93
131
|
return (nodes
|
|
94
132
|
// A Moleculer registry can transiently hold a malformed entry with no id
|
|
95
133
|
// (seen live 2026-07-16 after agent churn): guard it or every consumer of
|
|
@@ -103,7 +141,7 @@ export function toNodeLiveness(nodes) {
|
|
|
103
141
|
* cpuModel `undefined`→`null`, addonIds from the reported `agentAddons`) so an
|
|
104
142
|
* offline row rendered from history is indistinguishable from the live shape.
|
|
105
143
|
*/
|
|
106
|
-
|
|
144
|
+
function toDescriptor(entry) {
|
|
107
145
|
return {
|
|
108
146
|
id: entry.info.id,
|
|
109
147
|
name: entry.info.name,
|
|
@@ -137,7 +175,7 @@ function toSubProcess(p) {
|
|
|
137
175
|
groupId: p.groupId ?? null,
|
|
138
176
|
};
|
|
139
177
|
}
|
|
140
|
-
|
|
178
|
+
class AgentRegistryService {
|
|
141
179
|
eventBus;
|
|
142
180
|
moleculer;
|
|
143
181
|
capabilityService;
|
|
@@ -183,14 +221,14 @@ export class AgentRegistryService {
|
|
|
183
221
|
* Bounded per-`(node, package)` delivery breaker — see
|
|
184
222
|
* `agent-addon-backfill.ts`. Process-scoped, holds no intent.
|
|
185
223
|
*/
|
|
186
|
-
backfillTracker = new BackfillAttemptTracker();
|
|
224
|
+
backfillTracker = new agent_addon_backfill_1.BackfillAttemptTracker();
|
|
187
225
|
/**
|
|
188
226
|
* "Is the hub writing addons to this node right now?" — the gate that stops
|
|
189
227
|
* the back-fill reacting to a roster gap the hub itself opened. Public so the
|
|
190
228
|
* delivery path (`deliverAddonToAgent`) can mark its own window; see
|
|
191
229
|
* `agent-delivery-ledger.ts` for why a delivery makes the roster lie.
|
|
192
230
|
*/
|
|
193
|
-
deliveryLedger = new AgentDeliveryLedger();
|
|
231
|
+
deliveryLedger = new agent_delivery_ledger_1.AgentDeliveryLedger();
|
|
194
232
|
/**
|
|
195
233
|
* Nodes with a reconcile in flight. The pass is triggered from two places
|
|
196
234
|
* (the `registerNode` ack and the hub-boot sweep) and a reconnect can fire
|
|
@@ -210,7 +248,7 @@ export class AgentRegistryService {
|
|
|
210
248
|
/** Wire the durable offline-node history store (A1). */
|
|
211
249
|
setClusterNodeHistoryStore(store) {
|
|
212
250
|
this.historyStore = store;
|
|
213
|
-
this.historyMirror = new ClusterNodeHistoryMirror(() => store.tryGetAll());
|
|
251
|
+
this.historyMirror = new cluster_node_history_mirror_1.ClusterNodeHistoryMirror(() => store.tryGetAll());
|
|
214
252
|
}
|
|
215
253
|
/** Wire the scoped logger (boot order — see the field). */
|
|
216
254
|
setLogger(logger) {
|
|
@@ -258,10 +296,10 @@ export class AgentRegistryService {
|
|
|
258
296
|
await this.historyStore?.prunePackages(nodeId, [packageName]);
|
|
259
297
|
for (const addonId of addonIds) {
|
|
260
298
|
this.eventBus.emit({
|
|
261
|
-
id: randomUUID(),
|
|
299
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
262
300
|
timestamp: new Date(),
|
|
263
301
|
source: { type: 'core', id: 'agent-registry' },
|
|
264
|
-
category: EventCategory.AddonUninstalled,
|
|
302
|
+
category: types_1.EventCategory.AddonUninstalled,
|
|
265
303
|
data: { addonId, agentId: nodeId, packageName, reason: 'operator uninstall' },
|
|
266
304
|
});
|
|
267
305
|
}
|
|
@@ -342,7 +380,7 @@ export class AgentRegistryService {
|
|
|
342
380
|
this.backfillTracker.forget(nodeId);
|
|
343
381
|
this.deliveryLedger.forget(nodeId);
|
|
344
382
|
// The names the hub certified to this node are free again (a forgotten node cannot hold them).
|
|
345
|
-
await getProcessAgentHttpsNames()
|
|
383
|
+
await (0, system_1.getProcessAgentHttpsNames)()
|
|
346
384
|
?.release(nodeId)
|
|
347
385
|
.catch((err) => this.logger?.warn("forget cluster node: could not release the node's certified names", {
|
|
348
386
|
tags: { nodeId },
|
|
@@ -361,10 +399,10 @@ export class AgentRegistryService {
|
|
|
361
399
|
// `AgentUnregistered` and re-emits immediately.
|
|
362
400
|
if (historyRemoved || registryRemoved) {
|
|
363
401
|
this.eventBus.emit({
|
|
364
|
-
id: randomUUID(),
|
|
402
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
365
403
|
timestamp: new Date(),
|
|
366
404
|
source: { type: 'core', id: 'agent-registry' },
|
|
367
|
-
category: EventCategory.AgentUnregistered,
|
|
405
|
+
category: types_1.EventCategory.AgentUnregistered,
|
|
368
406
|
data: { agentId: nodeId },
|
|
369
407
|
});
|
|
370
408
|
}
|
|
@@ -439,19 +477,19 @@ export class AgentRegistryService {
|
|
|
439
477
|
console.log(`[agent-registry] Agent connected: ${node.id}`);
|
|
440
478
|
const nodeName = this.knownNodeName(node.id);
|
|
441
479
|
this.eventBus.emit({
|
|
442
|
-
id: randomUUID(),
|
|
480
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
443
481
|
timestamp: new Date(),
|
|
444
482
|
source: { type: 'core', id: 'agent-registry' },
|
|
445
|
-
category: EventCategory.AgentOnline,
|
|
483
|
+
category: types_1.EventCategory.AgentOnline,
|
|
446
484
|
data: { agentId: node.id, ...(nodeName !== undefined ? { nodeName } : {}) },
|
|
447
485
|
});
|
|
448
486
|
}
|
|
449
487
|
else {
|
|
450
488
|
this.eventBus.emit({
|
|
451
|
-
id: randomUUID(),
|
|
489
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
452
490
|
timestamp: new Date(),
|
|
453
491
|
source: { type: 'core', id: 'agent-registry' },
|
|
454
|
-
category: EventCategory.WorkerOnline,
|
|
492
|
+
category: types_1.EventCategory.WorkerOnline,
|
|
455
493
|
data: { workerId: node.id },
|
|
456
494
|
});
|
|
457
495
|
}
|
|
@@ -467,19 +505,19 @@ export class AgentRegistryService {
|
|
|
467
505
|
// node was never snapshotted while online.
|
|
468
506
|
void this.historyStore?.touch(node.id);
|
|
469
507
|
this.eventBus.emit({
|
|
470
|
-
id: randomUUID(),
|
|
508
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
471
509
|
timestamp: new Date(),
|
|
472
510
|
source: { type: 'core', id: 'agent-registry' },
|
|
473
|
-
category: EventCategory.AgentOffline,
|
|
474
|
-
data: agentOfflineData(node.id, unexpected, this.knownNodeName(node.id)),
|
|
511
|
+
category: types_1.EventCategory.AgentOffline,
|
|
512
|
+
data: (0, agent_liveness_event_1.agentOfflineData)(node.id, unexpected, this.knownNodeName(node.id)),
|
|
475
513
|
});
|
|
476
514
|
}
|
|
477
515
|
else {
|
|
478
516
|
this.eventBus.emit({
|
|
479
|
-
id: randomUUID(),
|
|
517
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
480
518
|
timestamp: new Date(),
|
|
481
519
|
source: { type: 'core', id: 'agent-registry' },
|
|
482
|
-
category: EventCategory.WorkerOffline,
|
|
520
|
+
category: types_1.EventCategory.WorkerOffline,
|
|
483
521
|
data: { workerId: node.id },
|
|
484
522
|
});
|
|
485
523
|
}
|
|
@@ -496,19 +534,19 @@ export class AgentRegistryService {
|
|
|
496
534
|
continue;
|
|
497
535
|
if (kind === 'agent') {
|
|
498
536
|
this.eventBus.emit({
|
|
499
|
-
id: randomUUID(),
|
|
537
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
500
538
|
timestamp: new Date(),
|
|
501
539
|
source: { type: 'core', id: 'agent-registry' },
|
|
502
|
-
category: EventCategory.AgentOnline,
|
|
540
|
+
category: types_1.EventCategory.AgentOnline,
|
|
503
541
|
data: { agentId: id },
|
|
504
542
|
});
|
|
505
543
|
}
|
|
506
544
|
else {
|
|
507
545
|
this.eventBus.emit({
|
|
508
|
-
id: randomUUID(),
|
|
546
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
509
547
|
timestamp: new Date(),
|
|
510
548
|
source: { type: 'core', id: 'agent-registry' },
|
|
511
|
-
category: EventCategory.WorkerOnline,
|
|
549
|
+
category: types_1.EventCategory.WorkerOnline,
|
|
512
550
|
data: { workerId: id },
|
|
513
551
|
});
|
|
514
552
|
}
|
|
@@ -520,7 +558,7 @@ export class AgentRegistryService {
|
|
|
520
558
|
}
|
|
521
559
|
/** The durable history's display name for a node, when it knows a real one. */
|
|
522
560
|
knownNodeName(nodeId) {
|
|
523
|
-
return nodeDisplayName(nodeId, this.historyMirror?.peek() ?? null);
|
|
561
|
+
return (0, agent_liveness_event_1.nodeDisplayName)(nodeId, this.historyMirror?.peek() ?? null);
|
|
524
562
|
}
|
|
525
563
|
// ---- Placement reconciliation ----
|
|
526
564
|
/**
|
|
@@ -617,7 +655,7 @@ export class AgentRegistryService {
|
|
|
617
655
|
// waitForServices primitive) and retries once, instead of giving up and
|
|
618
656
|
// leaving the agent unreconciled until the next connect. (No timers/backoff
|
|
619
657
|
// — that's banned for node readiness; this is the sanctioned primitive.)
|
|
620
|
-
const statusRaw = await callWithServiceDiscovery(broker, '$agent', '$agent.status', {}, {
|
|
658
|
+
const statusRaw = await (0, system_1.callWithServiceDiscovery)(broker, '$agent', '$agent.status', {}, {
|
|
621
659
|
nodeID: agentId,
|
|
622
660
|
timeout: AGENT_RECONCILE_RPC_TIMEOUT_MS,
|
|
623
661
|
});
|
|
@@ -642,7 +680,7 @@ export class AgentRegistryService {
|
|
|
642
680
|
if (typeof declId !== 'string')
|
|
643
681
|
continue;
|
|
644
682
|
const decl = row.declaration ?? row.manifest;
|
|
645
|
-
hubPlacements.set(declId, resolveAddonPlacement(decl));
|
|
683
|
+
hubPlacements.set(declId, (0, types_1.resolveAddonPlacement)(decl));
|
|
646
684
|
const packageName = row.manifest.packageName;
|
|
647
685
|
if (typeof packageName === 'string' && packageName.length > 0) {
|
|
648
686
|
hubPackages.add(packageName);
|
|
@@ -705,10 +743,10 @@ export class AgentRegistryService {
|
|
|
705
743
|
undeployedPackages.add(packageName);
|
|
706
744
|
}
|
|
707
745
|
this.eventBus.emit({
|
|
708
|
-
id: randomUUID(),
|
|
746
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
709
747
|
timestamp: new Date(),
|
|
710
748
|
source: { type: 'core', id: 'agent-registry' },
|
|
711
|
-
category: EventCategory.AddonUninstalled,
|
|
749
|
+
category: types_1.EventCategory.AddonUninstalled,
|
|
712
750
|
data: { addonId: addon.id, agentId, reason },
|
|
713
751
|
});
|
|
714
752
|
}
|
|
@@ -750,7 +788,7 @@ export class AgentRegistryService {
|
|
|
750
788
|
if (!seam)
|
|
751
789
|
return;
|
|
752
790
|
const recorded = await store.getPackages(agentId);
|
|
753
|
-
const planned = computeBackfillPlan({
|
|
791
|
+
const planned = (0, agent_addon_backfill_1.computeBackfillPlan)({
|
|
754
792
|
recorded,
|
|
755
793
|
live,
|
|
756
794
|
bootstrap: AGENT_BOOTSTRAP_PACKAGES,
|
|
@@ -770,7 +808,7 @@ export class AgentRegistryService {
|
|
|
770
808
|
}
|
|
771
809
|
// GATE 1 — the trigger allowlist. A pass that must not install says so and
|
|
772
810
|
// stops; silence here would read as "nothing was missing".
|
|
773
|
-
if (!triggerMayDeliver(trigger)) {
|
|
811
|
+
if (!(0, agent_addon_backfill_1.triggerMayDeliver)(trigger)) {
|
|
774
812
|
console.log(`[agent-registry] Back-fill ${agentId}: SKIPPED — trigger "${trigger}" may not deliver ` +
|
|
775
813
|
`(${planned.targets.length} package(s) would have been installed)`);
|
|
776
814
|
return;
|
|
@@ -800,7 +838,7 @@ export class AgentRegistryService {
|
|
|
800
838
|
const closeWindow = this.deliveryLedger.begin(agentId, plan.targets.map((t) => t.name).join(', ') || 'back-fill');
|
|
801
839
|
let outcome;
|
|
802
840
|
try {
|
|
803
|
-
outcome = await executeBackfill(seam, agentId, plan, this.backfillTracker);
|
|
841
|
+
outcome = await (0, agent_addon_backfill_1.executeBackfill)(seam, agentId, plan, this.backfillTracker);
|
|
804
842
|
}
|
|
805
843
|
finally {
|
|
806
844
|
closeWindow();
|
|
@@ -811,10 +849,10 @@ export class AgentRegistryService {
|
|
|
811
849
|
.join(', ')} — trigger=${trigger}, node reported ${plan.liveCount} package(s) and its ` +
|
|
812
850
|
`declared roster has ${recorded.length}`);
|
|
813
851
|
this.eventBus.emit({
|
|
814
|
-
id: randomUUID(),
|
|
852
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
815
853
|
timestamp: new Date(),
|
|
816
854
|
source: { type: 'core', id: 'agent-registry' },
|
|
817
|
-
category: EventCategory.AddonInstalled,
|
|
855
|
+
category: types_1.EventCategory.AddonInstalled,
|
|
818
856
|
data: {
|
|
819
857
|
agentId,
|
|
820
858
|
packages: outcome.delivered.map((d) => `${d.name}@${d.version}`),
|
|
@@ -826,7 +864,7 @@ export class AgentRegistryService {
|
|
|
826
864
|
for (const failure of outcome.failed) {
|
|
827
865
|
console.error(`[agent-registry] Back-fill ${agentId}: FAILED to deliver ${failure.name}@${failure.version} — ${failure.error}` +
|
|
828
866
|
(failure.retired
|
|
829
|
-
? ` (retired after ${MAX_BACKFILL_ATTEMPTS} attempts; this node is running WITHOUT that package)`
|
|
867
|
+
? ` (retired after ${agent_addon_backfill_1.MAX_BACKFILL_ATTEMPTS} attempts; this node is running WITHOUT that package)`
|
|
830
868
|
: ''));
|
|
831
869
|
}
|
|
832
870
|
for (const name of outcome.skipped) {
|
|
@@ -861,7 +899,7 @@ export class AgentRegistryService {
|
|
|
861
899
|
console.warn(`[agent-registry] Back-fill ${agentId}: SKIPPED — the confirmation read carried no addon list`);
|
|
862
900
|
return null;
|
|
863
901
|
}
|
|
864
|
-
const { plan: confirmed, contradicted } = confirmBackfillPlan(plan, rosterFromAddons(secondAddons));
|
|
902
|
+
const { plan: confirmed, contradicted } = (0, agent_addon_backfill_1.confirmBackfillPlan)(plan, rosterFromAddons(secondAddons));
|
|
865
903
|
if (contradicted.length > 0) {
|
|
866
904
|
console.warn(`[agent-registry] Back-fill ${agentId}: two roster reads DISAGREE — ` +
|
|
867
905
|
`${contradicted.map((t) => t.name).join(', ')} reported absent then present. ` +
|
|
@@ -927,7 +965,7 @@ export class AgentRegistryService {
|
|
|
927
965
|
*/
|
|
928
966
|
async listNodeDirectory() {
|
|
929
967
|
const history = this.historyMirror ? await this.historyMirror.current() : null;
|
|
930
|
-
return toNodeDirectory(this.listNodeLiveness(), history);
|
|
968
|
+
return (0, node_directory_1.toNodeDirectory)(this.listNodeLiveness(), history);
|
|
931
969
|
}
|
|
932
970
|
async listNodes() {
|
|
933
971
|
const registry = this.nodeCatalogRegistry();
|
|
@@ -1126,7 +1164,7 @@ export class AgentRegistryService {
|
|
|
1126
1164
|
cpuCores: cpus.length,
|
|
1127
1165
|
memoryMB: Math.round(os.totalmem() / 1024 / 1024),
|
|
1128
1166
|
cpuModel: cpus[0]?.model,
|
|
1129
|
-
pythonRuntimes: localSupportedPythonRuntimes(),
|
|
1167
|
+
pythonRuntimes: (0, system_1.localSupportedPythonRuntimes)(),
|
|
1130
1168
|
},
|
|
1131
1169
|
status: {
|
|
1132
1170
|
activeCameras: 0,
|
|
@@ -1167,11 +1205,12 @@ export class AgentRegistryService {
|
|
|
1167
1205
|
const promoted = { ...backup, priority: 'primary' };
|
|
1168
1206
|
this.assignments.set(primaryKey, promoted);
|
|
1169
1207
|
this.eventBus.emit({
|
|
1170
|
-
id: randomUUID(),
|
|
1208
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
1171
1209
|
timestamp: new Date(),
|
|
1172
1210
|
source: { type: 'core', id: 'agent-registry' },
|
|
1173
|
-
category: EventCategory.AgentBackupActivated,
|
|
1211
|
+
category: types_1.EventCategory.AgentBackupActivated,
|
|
1174
1212
|
data: { cameraId, role, agentId: promoted.agentId },
|
|
1175
1213
|
});
|
|
1176
1214
|
}
|
|
1177
1215
|
}
|
|
1216
|
+
exports.AgentRegistryService = AgentRegistryService;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClusterNodeHistoryMirror = exports.HISTORY_MIRROR_MAX_AGE_MS = void 0;
|
|
1
4
|
/** Two topology heartbeats: a mirror older than this was not being fed. */
|
|
2
|
-
|
|
3
|
-
|
|
5
|
+
exports.HISTORY_MIRROR_MAX_AGE_MS = 60_000;
|
|
6
|
+
class ClusterNodeHistoryMirror {
|
|
4
7
|
read;
|
|
5
8
|
now;
|
|
6
9
|
maxAgeMs;
|
|
@@ -8,7 +11,7 @@ export class ClusterNodeHistoryMirror {
|
|
|
8
11
|
inFlight = null;
|
|
9
12
|
/** Bumped by `invalidate()`: a read started before it must not land. */
|
|
10
13
|
generation = 0;
|
|
11
|
-
constructor(read, now = Date.now, maxAgeMs = HISTORY_MIRROR_MAX_AGE_MS) {
|
|
14
|
+
constructor(read, now = Date.now, maxAgeMs = exports.HISTORY_MIRROR_MAX_AGE_MS) {
|
|
12
15
|
this.read = read;
|
|
13
16
|
this.now = now;
|
|
14
17
|
this.maxAgeMs = maxAgeMs;
|
|
@@ -54,3 +57,4 @@ export class ClusterNodeHistoryMirror {
|
|
|
54
57
|
this.inFlight = null;
|
|
55
58
|
}
|
|
56
59
|
}
|
|
60
|
+
exports.ClusterNodeHistoryMirror = ClusterNodeHistoryMirror;
|
|
@@ -1,27 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClusterNodeHistoryStore = void 0;
|
|
4
|
+
const system_1 = require("@camstack/system");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const types_1 = require("@camstack/types");
|
|
7
|
+
const DescriptorSchema = zod_1.z.object({
|
|
8
|
+
id: zod_1.z.string(),
|
|
9
|
+
name: zod_1.z.string(),
|
|
10
|
+
hostname: zod_1.z.string(),
|
|
11
|
+
platform: zod_1.z.string(),
|
|
12
|
+
arch: zod_1.z.string(),
|
|
13
|
+
cpuModel: zod_1.z.string().nullable(),
|
|
14
|
+
cpuCores: zod_1.z.number(),
|
|
15
|
+
memoryMB: zod_1.z.number(),
|
|
16
|
+
engines: zod_1.z.array(zod_1.z.string()).readonly(),
|
|
17
|
+
isHub: zod_1.z.boolean(),
|
|
18
|
+
localIps: zod_1.z.array(zod_1.z.string()).readonly(),
|
|
19
|
+
addonIds: zod_1.z.array(zod_1.z.string()).readonly(),
|
|
20
|
+
packages: zod_1.z
|
|
21
|
+
.array(zod_1.z.object({ name: zod_1.z.string(), version: zod_1.z.string().nullable() }))
|
|
19
22
|
.readonly()
|
|
20
23
|
.optional(),
|
|
21
24
|
});
|
|
22
25
|
/** Shape of a `settings-store.query` record's `data` for this collection. */
|
|
23
|
-
const RowDataSchema = z.object({
|
|
24
|
-
lastActive: z.number(),
|
|
26
|
+
const RowDataSchema = zod_1.z.object({
|
|
27
|
+
lastActive: zod_1.z.number(),
|
|
25
28
|
descriptor: DescriptorSchema,
|
|
26
29
|
});
|
|
27
30
|
/**
|
|
@@ -77,7 +80,7 @@ function samePackages(a, b) {
|
|
|
77
80
|
return a === b;
|
|
78
81
|
return (a.length === b.length && a.every((p, i) => p.name === b[i]?.name && p.version === b[i]?.version));
|
|
79
82
|
}
|
|
80
|
-
|
|
83
|
+
class ClusterNodeHistoryStore {
|
|
81
84
|
resolveSettingsStore;
|
|
82
85
|
logger;
|
|
83
86
|
declared = false;
|
|
@@ -118,7 +121,7 @@ export class ClusterNodeHistoryStore {
|
|
|
118
121
|
}
|
|
119
122
|
catch (err) {
|
|
120
123
|
this.logger.warn('declareCollection failed (best-effort)', {
|
|
121
|
-
meta: { error: errMsg(err) },
|
|
124
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
122
125
|
});
|
|
123
126
|
return null;
|
|
124
127
|
}
|
|
@@ -159,7 +162,7 @@ export class ClusterNodeHistoryStore {
|
|
|
159
162
|
catch (err) {
|
|
160
163
|
this.logger.warn('snapshot upsert failed (best-effort)', {
|
|
161
164
|
tags: { nodeId: descriptor.id },
|
|
162
|
-
meta: { error: errMsg(err) },
|
|
165
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
163
166
|
});
|
|
164
167
|
}
|
|
165
168
|
}
|
|
@@ -201,7 +204,7 @@ export class ClusterNodeHistoryStore {
|
|
|
201
204
|
async writeStored(nodeId, lastActive, descriptor) {
|
|
202
205
|
const kind = this.resolveKind();
|
|
203
206
|
if (kind !== null) {
|
|
204
|
-
const body = ClusterNodeHistoryBodySchema.safeParse({ descriptor });
|
|
207
|
+
const body = system_1.ClusterNodeHistoryBodySchema.safeParse({ descriptor });
|
|
205
208
|
if (!body.success)
|
|
206
209
|
return;
|
|
207
210
|
await kind.put({ id: nodeId, at: lastActive, data: body.data });
|
|
@@ -248,7 +251,7 @@ export class ClusterNodeHistoryStore {
|
|
|
248
251
|
catch (err) {
|
|
249
252
|
this.logger.warn('getPackages failed (best-effort)', {
|
|
250
253
|
tags: { nodeId },
|
|
251
|
-
meta: { error: errMsg(err) },
|
|
254
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
252
255
|
});
|
|
253
256
|
return [];
|
|
254
257
|
}
|
|
@@ -283,7 +286,7 @@ export class ClusterNodeHistoryStore {
|
|
|
283
286
|
catch (err) {
|
|
284
287
|
this.logger.warn('recordPackages failed (best-effort)', {
|
|
285
288
|
tags: { nodeId },
|
|
286
|
-
meta: { error: errMsg(err) },
|
|
289
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
287
290
|
});
|
|
288
291
|
}
|
|
289
292
|
}
|
|
@@ -321,7 +324,7 @@ export class ClusterNodeHistoryStore {
|
|
|
321
324
|
catch (err) {
|
|
322
325
|
this.logger.warn('prunePackages failed (best-effort)', {
|
|
323
326
|
tags: { nodeId },
|
|
324
|
-
meta: { error: errMsg(err) },
|
|
327
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
325
328
|
});
|
|
326
329
|
}
|
|
327
330
|
}
|
|
@@ -356,7 +359,7 @@ export class ClusterNodeHistoryStore {
|
|
|
356
359
|
catch (err) {
|
|
357
360
|
this.logger.warn('touch failed (best-effort)', {
|
|
358
361
|
tags: { nodeId },
|
|
359
|
-
meta: { error: errMsg(err) },
|
|
362
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
360
363
|
});
|
|
361
364
|
}
|
|
362
365
|
}
|
|
@@ -379,7 +382,7 @@ export class ClusterNodeHistoryStore {
|
|
|
379
382
|
const kind = this.resolveKind();
|
|
380
383
|
const result = [];
|
|
381
384
|
const rows = kind !== null
|
|
382
|
-
? (await readAllRows(kind)).map((row) => ({
|
|
385
|
+
? (await (0, system_1.readAllRows)(kind)).map((row) => ({
|
|
383
386
|
id: row.id,
|
|
384
387
|
data: { lastActive: row.at ?? 0, descriptor: row.data.descriptor },
|
|
385
388
|
}))
|
|
@@ -400,7 +403,7 @@ export class ClusterNodeHistoryStore {
|
|
|
400
403
|
return result;
|
|
401
404
|
}
|
|
402
405
|
catch (err) {
|
|
403
|
-
this.logger.warn('history read failed (best-effort)', { meta: { error: errMsg(err) } });
|
|
406
|
+
this.logger.warn('history read failed (best-effort)', { meta: { error: (0, types_1.errMsg)(err) } });
|
|
404
407
|
return null;
|
|
405
408
|
}
|
|
406
409
|
}
|
|
@@ -438,9 +441,10 @@ export class ClusterNodeHistoryStore {
|
|
|
438
441
|
catch (err) {
|
|
439
442
|
this.logger.warn('forget failed (best-effort)', {
|
|
440
443
|
tags: { nodeId },
|
|
441
|
-
meta: { error: errMsg(err) },
|
|
444
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
442
445
|
});
|
|
443
446
|
return 'failed';
|
|
444
447
|
}
|
|
445
448
|
}
|
|
446
449
|
}
|
|
450
|
+
exports.ClusterNodeHistoryStore = ClusterNodeHistoryStore;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HubAgentPairing = void 0;
|
|
1
4
|
/** A browse takes seconds; a list asked within this window reuses the last scan. */
|
|
2
5
|
const SCAN_REUSE_MS = 4_000;
|
|
3
6
|
/** A typed address is remembered this long without being heard again. */
|
|
4
7
|
const ADDRESS_MEMORY_MS = 30 * 60_000;
|
|
5
8
|
const DEFAULT_PORT = 4444;
|
|
6
|
-
|
|
9
|
+
class HubAgentPairing {
|
|
7
10
|
deps;
|
|
8
11
|
scanned = null;
|
|
9
12
|
scanning = null;
|
|
@@ -117,3 +120,4 @@ export class HubAgentPairing {
|
|
|
117
120
|
};
|
|
118
121
|
}
|
|
119
122
|
}
|
|
123
|
+
exports.HubAgentPairing = HubAgentPairing;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNodeCertificatesClient = createNodeCertificatesClient;
|
|
1
4
|
/**
|
|
2
5
|
* The hub's typed handle on a node's `node-certificates` capability (D856).
|
|
3
6
|
*
|
|
@@ -6,8 +9,8 @@
|
|
|
6
9
|
* offline, capability not declared by an old agent) or a malformed answer becomes
|
|
7
10
|
* a plain error naming the node - never a cast.
|
|
8
11
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
const types_1 = require("@camstack/types");
|
|
13
|
+
function createNodeCertificatesClient(moleculer, nodeId) {
|
|
11
14
|
const proxy = moleculer?.createCapabilityProxy('node-certificates', nodeId) ?? null;
|
|
12
15
|
if (proxy === null)
|
|
13
16
|
return null;
|
|
@@ -22,7 +25,7 @@ export function createNodeCertificatesClient(moleculer, nodeId) {
|
|
|
22
25
|
}
|
|
23
26
|
return parsed.data;
|
|
24
27
|
};
|
|
25
|
-
const m = nodeCertificatesCapability.methods;
|
|
28
|
+
const m = types_1.nodeCertificatesCapability.methods;
|
|
26
29
|
return {
|
|
27
30
|
getCertificates: () => call('getCertificates', m.getCertificates.output, {}),
|
|
28
31
|
prepareMeshRenewal: () => call('prepareMeshRenewal', m.prepareMeshRenewal.output, {}),
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toNodeDirectory = toNodeDirectory;
|
|
1
4
|
/**
|
|
2
5
|
* The cheap node list (D637): live liveness plus the durable history, merged.
|
|
3
6
|
*
|
|
@@ -8,7 +11,7 @@
|
|
|
8
11
|
* - `history === null` = unreadable, so the answer is INCOMPLETE and a picker
|
|
9
12
|
* must not call a missing id removed (D315).
|
|
10
13
|
*/
|
|
11
|
-
|
|
14
|
+
function toNodeDirectory(live, history) {
|
|
12
15
|
const rows = history ?? [];
|
|
13
16
|
const names = new Map(rows.map((row) => [row.id, row.name]));
|
|
14
17
|
const hubs = new Set(rows.filter((row) => row.isHub).map((row) => row.id));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* well-known-app-links — the two files a Universal/App Link needs the DOMAIN
|
|
3
4
|
* to vouch for.
|
|
@@ -18,13 +19,16 @@
|
|
|
18
19
|
* ACCEPTED and produces a valid file that fails auto-verification (the OS
|
|
19
20
|
* shows a disambiguation dialog): same trade-off the Zentik file ships with.
|
|
20
21
|
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.buildAppLinkFiles = buildAppLinkFiles;
|
|
24
|
+
exports.parseCertFingerprints = parseCertFingerprints;
|
|
21
25
|
/** Apple team + bundle ids, mirrored from the viewer's app.config.ts. */
|
|
22
26
|
const APPLE_TEAM_ID = 'C3F24V5NS5';
|
|
23
27
|
const BUNDLE_ID = 'com.apocaliss92.camstack';
|
|
24
28
|
const BUNDLE_ID_DEV = 'com.apocaliss92.camstack.dev';
|
|
25
29
|
/** The only path family the app claims on this domain. */
|
|
26
30
|
const VIEWER_COMPONENT = '/viewer/camstack/*';
|
|
27
|
-
|
|
31
|
+
function buildAppLinkFiles(androidCertSha256) {
|
|
28
32
|
const appIds = [`${APPLE_TEAM_ID}.${BUNDLE_ID}`, `${APPLE_TEAM_ID}.${BUNDLE_ID_DEV}`];
|
|
29
33
|
return {
|
|
30
34
|
appleAppSiteAssociation: {
|
|
@@ -52,7 +56,7 @@ export function buildAppLinkFiles(androidCertSha256) {
|
|
|
52
56
|
};
|
|
53
57
|
}
|
|
54
58
|
/** Parse the comma-separated env form; junk and empties dropped. */
|
|
55
|
-
|
|
59
|
+
function parseCertFingerprints(raw) {
|
|
56
60
|
if (raw === undefined)
|
|
57
61
|
return [];
|
|
58
62
|
return raw
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthService = exports.SessionRevokedError = void 0;
|
|
4
|
+
const system_1 = require("@camstack/system");
|
|
2
5
|
/**
|
|
3
6
|
* A session-grade token whose server-side session is gone (logged out,
|
|
4
7
|
* revoked, expired) or cannot be checked right now. Every caller of
|
|
5
8
|
* `verifyToken` already treats a throw as "not authenticated".
|
|
6
9
|
*/
|
|
7
|
-
|
|
10
|
+
class SessionRevokedError extends Error {
|
|
8
11
|
reason;
|
|
9
12
|
constructor(reason) {
|
|
10
13
|
super(`Session is no longer valid (${reason})`);
|
|
@@ -12,13 +15,14 @@ export class SessionRevokedError extends Error {
|
|
|
12
15
|
this.name = 'SessionRevokedError';
|
|
13
16
|
}
|
|
14
17
|
}
|
|
18
|
+
exports.SessionRevokedError = SessionRevokedError;
|
|
15
19
|
/** A v2 session token: string `userId`, boolean `isAdmin`, no `kind` (not a bridge/challenge). */
|
|
16
20
|
function isSessionGrade(payload) {
|
|
17
21
|
return (Reflect.get(payload, 'kind') === undefined &&
|
|
18
22
|
typeof payload.userId === 'string' &&
|
|
19
23
|
typeof payload.isAdmin === 'boolean');
|
|
20
24
|
}
|
|
21
|
-
|
|
25
|
+
class AuthService extends system_1.AuthManager {
|
|
22
26
|
sessionCheck = null;
|
|
23
27
|
/**
|
|
24
28
|
* Wire the login-session check (`hub-sessions.ts`). From then on EVERY
|
|
@@ -49,3 +53,4 @@ export class AuthService extends AuthManager {
|
|
|
49
53
|
return payload;
|
|
50
54
|
}
|
|
51
55
|
}
|
|
56
|
+
exports.AuthService = AuthService;
|