@virtue-ai/gateway-connect 0.3.5 → 0.3.7
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/README.md +1 -1
- package/dist/index.js +4 -4
- package/dist/trajectory-plugin.js +12 -7
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -351,7 +351,7 @@ function writeGatewayConfig(gatewayUrl, accessToken, guardUuid, apiUrl, gatewayI
|
|
|
351
351
|
const config = {
|
|
352
352
|
trajectory: {
|
|
353
353
|
gatewayUrl,
|
|
354
|
-
apiUrl: apiUrl ||
|
|
354
|
+
apiUrl: apiUrl || '',
|
|
355
355
|
gatewayId: gatewayId || DEFAULT_GATEWAY_ID,
|
|
356
356
|
guardUuid: guardUuid || process.env.VIRTUEAI_GUARD_UUID || '',
|
|
357
357
|
},
|
|
@@ -466,8 +466,8 @@ Supported models:
|
|
|
466
466
|
let gatewayUrl = getArg('gateway-url') || DEFAULT_GATEWAY_URL;
|
|
467
467
|
const model = getArg('model');
|
|
468
468
|
const guardUuid = getArg('guard-uuid') || process.env.VIRTUEAI_GUARD_UUID;
|
|
469
|
-
const apiUrl = getArg('api-url') ||
|
|
470
|
-
const gatewayId = getArg('gateway-id') ||
|
|
469
|
+
const apiUrl = getArg('api-url') || '';
|
|
470
|
+
const gatewayId = getArg('gateway-id') || '';
|
|
471
471
|
gatewayUrl = gatewayUrl.replace(/\/mcp\/?$/, '').toLowerCase();
|
|
472
472
|
console.log('\n VirtueAI Gateway Connect\n');
|
|
473
473
|
console.log(` Gateway: ${gatewayUrl}`);
|
|
@@ -505,7 +505,7 @@ Supported models:
|
|
|
505
505
|
${TOOLS_PLUGIN_DIR}
|
|
506
506
|
|
|
507
507
|
Start using it:
|
|
508
|
-
openclaw agent --local --message "What tools do you have?"
|
|
508
|
+
openclaw agent --local --agent main --message "What tools do you have?"
|
|
509
509
|
|
|
510
510
|
To use a different model:
|
|
511
511
|
npx @virtue-ai/gateway-connect --gateway-url ${gatewayUrl} --model openai/gpt-4o
|
|
@@ -50,7 +50,7 @@ function loadConfig() {
|
|
|
50
50
|
const cfg = JSON.parse(raw);
|
|
51
51
|
|
|
52
52
|
const gatewayUrl = cfg._auth?.gatewayUrl ?? cfg.trajectory?.gatewayUrl ?? "";
|
|
53
|
-
const apiUrl = cfg.trajectory?.apiUrl ??
|
|
53
|
+
const apiUrl = cfg.trajectory?.apiUrl ?? "";
|
|
54
54
|
const gatewayId = cfg.trajectory?.gatewayId ?? "";
|
|
55
55
|
const token = cfg._auth?.accessToken ?? "";
|
|
56
56
|
|
|
@@ -59,8 +59,13 @@ function loadConfig() {
|
|
|
59
59
|
process.env.VIRTUEAI_GUARD_UUID ||
|
|
60
60
|
DEFAULT_GUARD_UUID;
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
// If explicit apiUrl is set, use old path; otherwise derive from gatewayUrl
|
|
63
|
+
const trajectoryEndpoint = apiUrl
|
|
64
|
+
? apiUrl + "/api/prompt-guard/topic_guard"
|
|
65
|
+
: gatewayUrl + "/prompt-guard/topic_guard";
|
|
66
|
+
|
|
67
|
+
if (!gatewayUrl || !token) return null;
|
|
68
|
+
return { gatewayUrl, gatewayId, token, guardUuid, trajectoryEndpoint };
|
|
64
69
|
} catch {
|
|
65
70
|
return null;
|
|
66
71
|
}
|
|
@@ -100,7 +105,7 @@ const plugin = {
|
|
|
100
105
|
|
|
101
106
|
let gatewaySessionId = null;
|
|
102
107
|
let endpointDisabled = false;
|
|
103
|
-
const endpoint = config.
|
|
108
|
+
const endpoint = config.trajectoryEndpoint;
|
|
104
109
|
const localSessionId = "local_" + Date.now().toString(36);
|
|
105
110
|
|
|
106
111
|
try { mkdirSync(TRAJECTORY_LOG_DIR, { recursive: true }); } catch {}
|
|
@@ -113,7 +118,7 @@ const plugin = {
|
|
|
113
118
|
} catch {}
|
|
114
119
|
}
|
|
115
120
|
|
|
116
|
-
api.logger.info("[virtueai-trajectory] Plugin registered,
|
|
121
|
+
api.logger.info("[virtueai-trajectory] Plugin registered, endpoint: " + endpoint);
|
|
117
122
|
|
|
118
123
|
async function sendStep(role, content) {
|
|
119
124
|
if (endpointDisabled) return;
|
|
@@ -138,9 +143,9 @@ const plugin = {
|
|
|
138
143
|
body: JSON.stringify(body),
|
|
139
144
|
});
|
|
140
145
|
|
|
141
|
-
if (res.status === 404) {
|
|
146
|
+
if (res.status === 404 || res.status === 401 || res.status === 403) {
|
|
142
147
|
endpointDisabled = true;
|
|
143
|
-
api.logger.warn("[virtueai-trajectory]
|
|
148
|
+
api.logger.warn("[virtueai-trajectory] HTTP " + res.status + " — trajectory recording disabled");
|
|
144
149
|
return;
|
|
145
150
|
}
|
|
146
151
|
if (!res.ok) {
|