@camstack/server 1.2.431 → 1.2.432

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.
@@ -484,6 +484,8 @@ async function startAgent(configPath) {
484
484
  // back to broker-only (no parentUdsPath propagated). See moleculer.service.ts.
485
485
  let agentParentUdsPath;
486
486
  let agentUdsRegistry;
487
+ /** The agent's cluster bus, set once the broker is started (see `lifecycleEvents` below). */
488
+ let agentLifecycleBus = null;
487
489
  try {
488
490
  const agentNodeId = broker.nodeID;
489
491
  // F0 (slice-5 outbound): route a forked child's unowned `ctx.api.<cap>`
@@ -534,6 +536,21 @@ async function startAgent(configPath) {
534
536
  });
535
537
  agentUdsRegistry = new system_1.LocalChildRegistry({
536
538
  server: (0, system_1.createLocalTransport)().createServer(agentNodeId),
539
+ // `WorkerOnline` / `WorkerOffline` `<agent>/<childId>` for a forked runner
540
+ // (no broker of its own, so no `$node.connected`), on the agent's
541
+ // cluster-broadcasting bus. The bus exists only after `broker.start()`;
542
+ // runners are spawned after it (`loadClusterCapableAddons`), and an
543
+ // event before it is said, never silent.
544
+ lifecycleEvents: {
545
+ parentNodeId: () => agentNodeId,
546
+ emit: (event) => {
547
+ if (agentLifecycleBus === null) {
548
+ consoleLogger.info(`runner lifecycle event before the agent bus exists — dropped: ${event.category}`);
549
+ return;
550
+ }
551
+ agentLifecycleBus.emit(event);
552
+ },
553
+ },
537
554
  // The agent's own id — a cap call pinned to THIS agent (e.g. the
538
555
  // benchmark running `pipeline-executor.runPipeline` on the very node it
539
556
  // is on) is served by the co-resident sibling instead of being forwarded
@@ -686,6 +703,7 @@ async function startAgent(configPath) {
686
703
  // was not started (no UDS children). Wired after broker.start() so
687
704
  // getBrokerEventBus returns the fully operational shared bus.
688
705
  const agentBrokerEventBus = (0, system_1.getBrokerEventBus)(broker);
706
+ agentLifecycleBus = agentBrokerEventBus;
689
707
  agentUpdateService.bindAvailability(agentBrokerEventBus, broker.nodeID);
690
708
  let udsEventBridgeDispose = null;
691
709
  if (agentUdsRegistry !== undefined) {
@@ -408,6 +408,12 @@ class MoleculerService {
408
408
  // onUnownedCall (a pin to ANOTHER node still bypasses the sibling).
409
409
  ownNodeId: nodeId,
410
410
  onUnownedCall,
411
+ // A forked runner has no Moleculer broker, so `$node.connected` never
412
+ // fires for it: the registry says `WorkerOnline` / `WorkerOffline`
413
+ // `<hub>/<childId>` itself, on the hub's bus — WorkerOnline at the
414
+ // pre-init register, before the child initializes (the D696 provider
415
+ // gate forgets a provider there, before it can restore and seed).
416
+ lifecycleEvents: { parentNodeId: () => nodeId, emit: (event) => this.eventBus.emit(event) },
411
417
  // `getStatus` of a CLAIMED cap is answered by the hub mirror BEFORE the
412
418
  // sibling short-circuit can dispatch it to the owning child (D663, S3)
413
419
  // — the same resolver the handler above and `callCapabilityOnNode` use.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.431",
3
+ "version": "1.2.432",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "files": [
@@ -37,17 +37,17 @@
37
37
  ]
38
38
  },
39
39
  "dependencies": {
40
- "@camstack/addon-admin-ui": "1.2.300",
40
+ "@camstack/addon-admin-ui": "1.2.301",
41
41
  "@camstack/addon-agent-ui": "1.2.162",
42
42
  "@camstack/addon-auth": "1.2.124",
43
43
  "@camstack/addon-decoder-nodeav": "1.2.116",
44
44
  "@camstack/addon-notifiers": "1.2.122",
45
45
  "@camstack/addon-pipeline": "1.2.315",
46
- "@camstack/addon-pipeline-orchestrator": "1.2.272",
47
- "@camstack/addon-post-analysis": "1.2.311",
46
+ "@camstack/addon-pipeline-orchestrator": "1.2.273",
47
+ "@camstack/addon-post-analysis": "1.2.312",
48
48
  "@camstack/sdk": "1.2.119",
49
- "@camstack/system": "1.2.332",
50
- "@camstack/types": "1.2.285",
49
+ "@camstack/system": "1.2.333",
50
+ "@camstack/types": "1.2.286",
51
51
  "@camstack/ui-library": "1.2.220",
52
52
  "@fastify/compress": "^9.0.0",
53
53
  "@fastify/cookie": "^11.0.2",