@camstack/server 1.1.0 → 1.1.1

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.
@@ -128,6 +128,7 @@ function buildCapabilityRouters(services) {
128
128
  audioAnalyzer: (0, generated_cap_routers_1.createCapRouter_audioAnalyzer)((_ctx) => (0, cap_mount_helpers_js_1.requireSingleton)(services.capabilityRegistry, 'audio-analyzer'), (capName, nodeId) => services.moleculer.createCapabilityProxy(capName, nodeId)),
129
129
  audioCodec: (0, generated_cap_routers_1.createCapRouter_audioCodec)((_ctx) => (0, cap_mount_helpers_js_1.requireSingleton)(services.capabilityRegistry, 'audio-codec'), (capName, nodeId) => services.moleculer.createCapabilityProxy(capName, nodeId)),
130
130
  decoder: (0, generated_cap_routers_1.createCapRouter_decoder)((_ctx) => (0, cap_mount_helpers_js_1.requireSingleton)(services.capabilityRegistry, 'decoder'), (capName, nodeId) => services.moleculer.createCapabilityProxy(capName, nodeId)),
131
+ modelConvert: (0, generated_cap_routers_1.createCapRouter_modelConvert)((_ctx) => (0, cap_mount_helpers_js_1.requireSingleton)(services.capabilityRegistry, 'model-convert'), (capName, nodeId) => services.moleculer.createCapabilityProxy(capName, nodeId)),
131
132
  platformProbe: (0, generated_cap_routers_1.createCapRouter_platformProbe)((_ctx) => (0, cap_mount_helpers_js_1.requireSingleton)(services.capabilityRegistry, 'platform-probe'), (capName, nodeId) => services.moleculer.createCapabilityProxy(capName, nodeId)),
132
133
  // ── Cap overrides: hub-only, no remote fallback ─────────────────
133
134
  // The cap is intentionally single-node; agents are not directly
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.AgentRegistryService = void 0;
37
37
  const node_crypto_1 = require("node:crypto");
38
38
  const os = __importStar(require("node:os"));
39
+ const system_1 = require("@camstack/system");
39
40
  const types_1 = require("@camstack/types");
40
41
  /** Per-call timeout for `$agent.*` RPC during reconciliation. */
41
42
  const AGENT_RECONCILE_RPC_TIMEOUT_MS = 8_000;
@@ -241,7 +242,14 @@ class AgentRegistryService {
241
242
  }
242
243
  try {
243
244
  const broker = this.broker;
244
- const statusRaw = await broker.call('$agent.status', {}, {
245
+ // The reconcile fires the moment `$hub.registerNode` acks, which can race
246
+ // ahead of Moleculer's service-discovery INFO packet for the agent — a
247
+ // bare call then fails with "Service '$agent.status' is not found". Wrap
248
+ // it so a discovery miss waits for the `$agent` service (the framework's
249
+ // waitForServices primitive) and retries once, instead of giving up and
250
+ // leaving the agent unreconciled until the next connect. (No timers/backoff
251
+ // — that's banned for node readiness; this is the sanctioned primitive.)
252
+ const statusRaw = await (0, system_1.callWithServiceDiscovery)(broker, '$agent', '$agent.status', {}, {
245
253
  nodeID: agentId,
246
254
  timeout: AGENT_RECONCILE_RPC_TIMEOUT_MS,
247
255
  });
package/dist/main.js CHANGED
@@ -62,6 +62,7 @@ const stream_probe_service_1 = require("./core/streaming/stream-probe.service");
62
62
  const feature_service_1 = require("./core/feature/feature.service");
63
63
  const agent_registry_service_1 = require("./core/agent/agent-registry.service");
64
64
  const moleculer_service_1 = require("./core/moleculer/moleculer.service");
65
+ const model_distributor_js_1 = require("./api/model-distributor.js");
65
66
  const addon_registry_service_1 = require("./core/addon/addon-registry.service");
66
67
  const addon_package_service_1 = require("./core/addon/addon-package.service");
67
68
  const repl_engine_service_1 = require("./core/repl/repl-engine.service");
@@ -293,6 +294,13 @@ async function bootstrap() {
293
294
  // so Moleculer re-advertises the service list to the network)
294
295
  const moleculer = app.get(moleculer_service_1.MoleculerService);
295
296
  moleculer.registerLogReceiver();
297
+ // Hub-internal `model-distributor` provider — pushes a model format that is
298
+ // resident on the hub `/data/models` to an agent's `/data/models` (Model
299
+ // Studio P2). Registered in the CapabilityRegistry (not just the tRPC
300
+ // router) so forked addons (addon-model-studio) can reach it via `ctx.api`,
301
+ // not only external HTTP clients. Needs the broker + the deploy-stage
302
+ // registry, which an addon can't access.
303
+ capabilityRegistry.registerProvider('model-distributor', '$hub', (0, model_distributor_js_1.buildModelDistributorProvider)(moleculer, loggingService));
296
304
  // ── Health routes (hub self + agent forwarding) ──────────────────
297
305
  // Registered after app.init() so the AgentRegistryService is wired and
298
306
  // the Moleculer broker is ready to forward `$agent.health` calls.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",