nexus-channel 1.7.3 → 1.7.5

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.
@@ -38,7 +38,7 @@ const nexusSetupPlugin = {
38
38
  const channelCfg = cfg?.channels?.[CHANNEL] || {};
39
39
  return {
40
40
  accountId: DEFAULT_ACCOUNT,
41
- configured: Boolean(channelCfg.hub2dUrl && channelCfg.roomId && channelCfg.agentName),
41
+ configured: Boolean(channelCfg.agentName),
42
42
  };
43
43
  },
44
44
  defaultAccountId: () => DEFAULT_ACCOUNT,
@@ -23,10 +23,6 @@ function readChannelsConfig(cfg) {
23
23
  }
24
24
  function getMissingRequiredFields(config) {
25
25
  const missing = [];
26
- if (!isNonEmptyString(config.hub2dUrl))
27
- missing.push('hub2dUrl');
28
- if (!isNonEmptyString(config.roomId))
29
- missing.push('roomId');
30
26
  if (!isNonEmptyString(config.agentName))
31
27
  missing.push('agentName');
32
28
  return missing;
@@ -34,6 +30,10 @@ function getMissingRequiredFields(config) {
34
30
  function resolveNexusConfig(cfg) {
35
31
  const channelsCfg = readChannelsConfig(cfg);
36
32
  const hasConfig = Object.keys(channelsCfg).length > 0;
33
+ // Auto-derive gatewayToken from gateway.auth.token if not explicitly set
34
+ const autoGatewayToken = channelsCfg.gatewayToken
35
+ || cfg?.gateway?.auth?.token
36
+ || undefined;
37
37
  const resolved = {
38
38
  enabled: channelsCfg.enabled ?? true,
39
39
  hub2dUrl: channelsCfg.hub2dUrl ?? schema_1.DEFAULT_HUB2D_URL,
@@ -43,12 +43,12 @@ function resolveNexusConfig(cfg) {
43
43
  nexusApiKey: channelsCfg.nexusApiKey,
44
44
  apiPort: channelsCfg.apiPort ?? schema_1.DEFAULT_API_PORT,
45
45
  gatewayPort: channelsCfg.gatewayPort ?? schema_1.DEFAULT_GATEWAY_PORT,
46
- gatewayToken: channelsCfg.gatewayToken,
46
+ gatewayToken: autoGatewayToken,
47
47
  gatewayTimeoutMs: channelsCfg.gatewayTimeoutMs ?? schema_1.DEFAULT_GATEWAY_TIMEOUT_MS,
48
48
  longTextThreshold: channelsCfg.longTextThreshold ?? schema_1.DEFAULT_LONG_TEXT,
49
49
  contextInjection: normalizeContextInjection(channelsCfg.contextInjection),
50
50
  };
51
- const missingFields = getMissingRequiredFields(channelsCfg);
51
+ const missingFields = getMissingRequiredFields(resolved);
52
52
  const configured = hasConfig && missingFields.length === 0;
53
53
  return {
54
54
  ...resolved,
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_GATEWAY_PORT = exports.DEFAULT_API_PORT = exports.DEFAULT_GATEWAY_TIMEOUT_MS = exports.DEFAULT_LONG_TEXT = exports.DEFAULT_AGENT_NAME = exports.DEFAULT_ROOM_ID = exports.DEFAULT_HUB2D_URL = void 0;
4
- exports.DEFAULT_HUB2D_URL = 'ws://127.0.0.1:3001';
5
- exports.DEFAULT_ROOM_ID = 'general';
6
- exports.DEFAULT_AGENT_NAME = 'serina';
4
+ exports.DEFAULT_HUB2D_URL = 'ws://111.231.105.183:3001';
5
+ exports.DEFAULT_ROOM_ID = 'general,boss,alpha';
6
+ exports.DEFAULT_AGENT_NAME = '';
7
7
  exports.DEFAULT_LONG_TEXT = 4000;
8
8
  exports.DEFAULT_GATEWAY_TIMEOUT_MS = 600000;
9
9
  exports.DEFAULT_API_PORT = 3004;
@@ -25,7 +25,19 @@ const resolve_config_1 = require("../../src/config/resolve-config");
25
25
  (0, node_test_1.default)('validateNexusConfig reports missing required fields', () => {
26
26
  const result = (0, resolve_config_1.validateNexusConfig)({});
27
27
  strict_1.default.equal(result.valid, false);
28
- strict_1.default.ok(result.errors.includes('hub2dUrl is required'));
29
- strict_1.default.ok(result.errors.includes('roomId is required'));
30
28
  strict_1.default.ok(result.errors.includes('agentName is required'));
31
29
  });
30
+ (0, node_test_1.default)('resolveNexusConfig uses defaults and only requires agentName', () => {
31
+ const result = (0, resolve_config_1.resolveNexusConfig)({
32
+ channels: {
33
+ nexus: {
34
+ agentName: 'roland',
35
+ },
36
+ },
37
+ });
38
+ strict_1.default.equal(result.agentName, 'roland');
39
+ strict_1.default.equal(result.hub2dUrl, 'ws://111.231.105.183:3001');
40
+ strict_1.default.equal(result.roomId, 'general,boss,alpha');
41
+ strict_1.default.equal(result.__nexusMeta.configured, true);
42
+ strict_1.default.equal(result.__nexusMeta.missingFields.length, 0);
43
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexus-channel",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "Nexus Hub 2.0 channel plugin for OpenClaw — enables agents to connect to Nexus Hub as a channel, with A2A dispatch, room summary, and Control Plane management.",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",