@camstack/agent 1.1.21 → 1.1.23

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/cli.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __cr } from 'node:module'; const require = globalThis.require ?? __cr(import.meta.url);
3
3
  import {
4
4
  startAgent
5
- } from "./chunk-4X5XKWDM.mjs";
5
+ } from "./chunk-NOCHJ6DR.mjs";
6
6
 
7
7
  // src/cli.ts
8
8
  import { existsSync } from "fs";
package/dist/index.js CHANGED
@@ -216,6 +216,7 @@ var deploySwapLogger = {
216
216
  child: () => deploySwapLogger,
217
217
  withTags: () => deploySwapLogger
218
218
  };
219
+ var AGENT_PROCESS_RESTART_TIMEOUT_MS = 3e4;
219
220
  function getLocalIps() {
220
221
  const interfaces = os2.networkInterfaces();
221
222
  const ips = [];
@@ -609,9 +610,21 @@ function createAgentService(deps) {
609
610
  },
610
611
  restart: {
611
612
  handler: async (ctx) => {
612
- const { params } = ctx;
613
+ const { params, broker } = ctx;
613
614
  const { addonId } = params;
614
- return { success: true, addonId, action: "restart-queued" };
615
+ const result = await broker.call(
616
+ "$process.restart",
617
+ { name: addonId },
618
+ { nodeID: broker.nodeID, timeout: AGENT_PROCESS_RESTART_TIMEOUT_MS }
619
+ );
620
+ if (!result.success) {
621
+ throw new import_moleculer.Errors.MoleculerError(
622
+ `$agent.restart: process restart failed for "${addonId}": ${result.reason ?? "unknown"}`,
623
+ 500,
624
+ "AGENT_RESTART_FAILED"
625
+ );
626
+ }
627
+ return { success: true, addonId, pid: result.pid };
615
628
  }
616
629
  },
617
630
  /**
@@ -1104,6 +1117,9 @@ function registerAgentCapDispatch(registrar, agentUdsRegistry, inProcessLookup,
1104
1117
  // src/agent-bootstrap.ts
1105
1118
  var import_system4 = require("@camstack/system");
1106
1119
  var agentLogManager = new import_system4.LogManager(5e3);
1120
+ var DATA_NODEID_CAPS = new Set(
1121
+ import_types3.ALL_CAPABILITY_DEFINITIONS.filter((c) => c.nodeIdMode === "data").map((c) => c.name)
1122
+ );
1107
1123
  async function startAgent(configPath) {
1108
1124
  const config = loadAgentConfig(configPath);
1109
1125
  const hubUrlWasExplicit = process.env["CAMSTACK_HUB_URL"] !== void 0;
@@ -1355,6 +1371,11 @@ async function startAgent(configPath) {
1355
1371
  // fallback. Getter: `agentUdsRegistry` is assigned later in this scope,
1356
1372
  // after the handler is constructed.
1357
1373
  getLocalDispatcher: () => agentUdsRegistry ?? null,
1374
+ // `nodeIdMode: 'data'` signal: these caps carry `nodeId` as provider
1375
+ // DATA (the hub singleton dispatches internally), never a routing pin —
1376
+ // suppressing the pin lets the call forward unpinned to the hub's
1377
+ // singleton resolution, with `args.nodeId` intact for the provider.
1378
+ isDataNodeIdCap: (capName) => DATA_NODEID_CAPS.has(capName),
1358
1379
  // AGENT → HUB forward: a cap no agent-local child owns is routed to the
1359
1380
  // hub's `$hub-cap-fwd.forward`, which runs it through the hub's own
1360
1381
  // routing. Only the hub registers `$hub-cap-fwd`, so the undirected
@@ -1429,7 +1450,6 @@ async function startAgent(configPath) {
1429
1450
  };
1430
1451
  registerAgentCapDispatch(broker, agentUdsRegistry, agentInProcessLookup, consoleLogger);
1431
1452
  (0, import_system3.registerEventBusService)(broker);
1432
- broker.createService((0, import_system3.createHwAccelService)((0, import_system3.createKernelHwAccel)()));
1433
1453
  await broker.start();
1434
1454
  let hubUrlFromRegistry;
1435
1455
  const reconcileHubUrlFromRegistry = () => {