@virtue-ai/gateway-connect 0.3.0 → 0.3.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.
package/dist/index.js CHANGED
@@ -34,6 +34,8 @@ const OPENCLAW_CONFIG_PATH = path.join(OPENCLAW_DIR, 'openclaw.json');
34
34
  const TOOLS_PLUGIN_ID = 'virtueai-mcp-tools';
35
35
  const TOOLS_PLUGIN_DIR = path.join(OPENCLAW_DIR, 'extensions', TOOLS_PLUGIN_ID);
36
36
  const DEFAULT_GATEWAY_URL = 'https://virtueai-agent-gtw-l3phon63.ngrok.io';
37
+ const DEFAULT_API_URL = 'https://agentgateway1.virtueai.io';
38
+ const DEFAULT_GATEWAY_ID = 'gtw_L3pHOn63';
37
39
  // ---------------------------------------------------------------------------
38
40
  // Helpers
39
41
  // ---------------------------------------------------------------------------
@@ -340,11 +342,13 @@ ${toolRegistrations.join('\n')}
340
342
  // ---------------------------------------------------------------------------
341
343
  // Step 3: Write config & patch openclaw.json
342
344
  // ---------------------------------------------------------------------------
343
- function writeGatewayConfig(gatewayUrl, accessToken, guardUuid) {
345
+ function writeGatewayConfig(gatewayUrl, accessToken, guardUuid, apiUrl, gatewayId) {
344
346
  fs.mkdirSync(OPENCLAW_DIR, { recursive: true });
345
347
  const config = {
346
348
  trajectory: {
347
349
  gatewayUrl,
350
+ apiUrl: apiUrl || DEFAULT_API_URL,
351
+ gatewayId: gatewayId || DEFAULT_GATEWAY_ID,
348
352
  guardUuid: guardUuid || process.env.VIRTUEAI_GUARD_UUID || '',
349
353
  },
350
354
  _auth: {
@@ -435,7 +439,9 @@ Usage:
435
439
  npx @virtue-ai/gateway-connect [options]
436
440
 
437
441
  Options:
438
- --gateway-url <url> Gateway URL (default: ${DEFAULT_GATEWAY_URL})
442
+ --gateway-url <url> MCP gateway URL (default: ${DEFAULT_GATEWAY_URL})
443
+ --api-url <url> Prompt-guard API URL (default: ${DEFAULT_API_URL})
444
+ --gateway-id <id> Gateway ID for trajectory (default: ${DEFAULT_GATEWAY_ID})
439
445
  --model <model> Model to use (e.g. openai/gpt-4o, anthropic/claude-sonnet-4-5)
440
446
  --guard-uuid <uuid> Guard UUID for trajectory recording (or set VIRTUEAI_GUARD_UUID)
441
447
  --help Show this help message
@@ -456,6 +462,8 @@ Supported models:
456
462
  let gatewayUrl = getArg('gateway-url') || DEFAULT_GATEWAY_URL;
457
463
  const model = getArg('model');
458
464
  const guardUuid = getArg('guard-uuid') || process.env.VIRTUEAI_GUARD_UUID;
465
+ const apiUrl = getArg('api-url') || DEFAULT_API_URL;
466
+ const gatewayId = getArg('gateway-id') || DEFAULT_GATEWAY_ID;
459
467
  gatewayUrl = gatewayUrl.replace(/\/mcp\/?$/, '').toLowerCase();
460
468
  console.log('\n VirtueAI Gateway Connect\n');
461
469
  console.log(` Gateway: ${gatewayUrl}`);
@@ -472,7 +480,7 @@ Supported models:
472
480
  }
473
481
  generateMcpToolsPlugin(gatewayUrl, accessToken, tools);
474
482
  // Step 3: Write gateway config (for trajectory plugin)
475
- writeGatewayConfig(gatewayUrl, accessToken, guardUuid);
483
+ writeGatewayConfig(gatewayUrl, accessToken, guardUuid, apiUrl, gatewayId);
476
484
  // Step 4: Patch openclaw.json (enable tools plugin + set model)
477
485
  patchOpenClawConfig(model);
478
486
  // Step 5: Install trajectory plugin
@@ -49,6 +49,8 @@ function loadConfig() {
49
49
  const cfg = JSON.parse(raw);
50
50
 
51
51
  const gatewayUrl = cfg._auth?.gatewayUrl ?? cfg.trajectory?.gatewayUrl ?? "";
52
+ const apiUrl = cfg.trajectory?.apiUrl ?? gatewayUrl;
53
+ const gatewayId = cfg.trajectory?.gatewayId ?? "";
52
54
  const token = cfg._auth?.accessToken ?? "";
53
55
 
54
56
  const guardUuid =
@@ -56,8 +58,8 @@ function loadConfig() {
56
58
  process.env.VIRTUEAI_GUARD_UUID ||
57
59
  DEFAULT_GUARD_UUID;
58
60
 
59
- if (!gatewayUrl || !token) return null;
60
- return { gatewayUrl, token, guardUuid };
61
+ if (!apiUrl || !token) return null;
62
+ return { gatewayUrl, apiUrl, gatewayId, token, guardUuid };
61
63
  } catch {
62
64
  return null;
63
65
  }
@@ -84,7 +86,7 @@ const plugin = {
84
86
 
85
87
  let gatewaySessionId = null;
86
88
  let endpointDisabled = false;
87
- const endpoint = config.gatewayUrl + "/api/prompt-guard/topic_guard";
89
+ const endpoint = config.apiUrl + "/api/prompt-guard/topic_guard";
88
90
 
89
91
  api.logger.info("[virtueai-trajectory] Plugin registered, sending to " + config.gatewayUrl);
90
92
 
@@ -94,6 +96,7 @@ const plugin = {
94
96
  const body = {
95
97
  user_prompt: truncate(content),
96
98
  guard_uuid: config.guardUuid,
99
+ gateway_id: config.gatewayId,
97
100
  role,
98
101
  };
99
102
  if (gatewaySessionId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virtue-ai/gateway-connect",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "One-command setup to connect OpenClaw to VirtueAI MCP gateway",
5
5
  "type": "module",
6
6
  "files": [