@virtue-ai/gateway-connect 0.3.1 → 0.3.2

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 CHANGED
@@ -26,12 +26,6 @@ openclaw models auth paste-token --provider openai
26
26
  npx @virtue-ai/gateway-connect --gateway-url https://virtueai-agent-gtw-xxxx.ngrok.io
27
27
  ```
28
28
 
29
- To use a specific model:
30
-
31
- ```bash
32
- npx @virtue-ai/gateway-connect --gateway-url https://virtueai-agent-gtw-xxxx.ngrok.io --model openai/gpt-4o
33
- ```
34
-
35
29
  This will:
36
30
 
37
31
  1. Open your browser for OAuth login
@@ -52,7 +46,7 @@ Interactive TUI mode:
52
46
 
53
47
  ```bash
54
48
  # Terminal 1: start the OpenClaw gateway
55
- openclaw gateway
49
+ openclaw gateway --allow-unconfigured
56
50
 
57
51
  # Terminal 2: open the TUI
58
52
  openclaw tui
@@ -69,7 +63,7 @@ openclaw gateway stop
69
63
  In TUI mode, use slash commands to switch models on the fly:
70
64
 
71
65
  ```
72
- /model openai/gpt-4o
66
+ /model openai/gpt-5.2
73
67
  /model anthropic/claude-opus-4-6
74
68
  /models # opens model picker
75
69
  ```
@@ -72,6 +72,19 @@ function truncate(s, max = 2000) {
72
72
  return s.length > max ? s.slice(0, max) + "..." : s;
73
73
  }
74
74
 
75
+ /**
76
+ * Strip OpenClaw's sender metadata prefix from the raw prompt.
77
+ * The prompt arrives as:
78
+ * Sender (untrusted metadata):\\n{json}\\n\\n[timestamp] actual message
79
+ * We want just "actual message".
80
+ */
81
+ function stripSenderMetadata(prompt) {
82
+ if (!prompt || typeof prompt !== "string") return prompt;
83
+ // Match the "Sender (untrusted metadata):" block + JSON + timestamp prefix
84
+ const match = prompt.match(/^Sender \\(untrusted metadata\\):[\\s\\S]*?\\n\\n(?:\\[.*?\\]\\s*)?(.*)$/s);
85
+ return match ? match[1].trim() : prompt.trim();
86
+ }
87
+
75
88
  const plugin = {
76
89
  id: "${PLUGIN_ID}",
77
90
  name: "VirtueAI Trajectory",
@@ -133,34 +146,40 @@ const plugin = {
133
146
  }
134
147
  }
135
148
 
136
- // Hook: user prompt sent to LLM
137
149
  api.on("llm_input", (event) => {
138
- if (event.prompt) {
139
- sendStep("user", event.prompt);
150
+ const cleaned = stripSenderMetadata(event.prompt);
151
+ api.logger.info("[virtueai-trajectory] llm_input fired, prompt=" + (cleaned ?? "").slice(0, 80));
152
+ if (cleaned) {
153
+ sendStep("user", cleaned);
140
154
  }
141
155
  });
142
156
 
143
- // Hook: LLM response received
144
157
  api.on("llm_output", (event) => {
158
+ api.logger.info("[virtueai-trajectory] llm_output fired, assistantTexts.length=" + (event.assistantTexts?.length ?? "undefined") + ", keys=" + Object.keys(event).join(","));
145
159
  const text = (event.assistantTexts ?? []).join("\\n").trim();
146
160
  if (text) {
161
+ api.logger.info("[virtueai-trajectory] llm_output sending agent text, len=" + text.length);
147
162
  sendStep("agent", text);
163
+ } else {
164
+ api.logger.warn("[virtueai-trajectory] llm_output fired but assistantTexts empty");
148
165
  }
149
166
  });
150
167
 
151
- // Hook: tool call completed
152
168
  api.on("after_tool_call", (event) => {
153
- const params = event.params
169
+ api.logger.info("[virtueai-trajectory] after_tool_call fired, tool=" + event.toolName);
170
+ const toolParams = event.params
154
171
  ? Object.entries(event.params)
155
172
  .map(([k, v]) => k + "=" + JSON.stringify(v))
156
173
  .join(", ")
157
174
  : "";
158
- const callStr = event.toolName + "(" + params + ")";
175
+ const callStr = event.toolName + "(" + toolParams + ")";
159
176
  const resultStr = event.result != null ? truncate(event.result, 500) : (event.error ?? "no result");
160
177
  sendStep("agent", callStr + " → " + resultStr);
161
178
  });
162
179
 
163
- api.logger.info("[virtueai-trajectory] Plugin registered, sending to " + config.gatewayUrl);
180
+ api.on("agent_end", (event) => {
181
+ api.logger.info("[virtueai-trajectory] agent_end fired, success=" + event.success + ", durationMs=" + event.durationMs);
182
+ });
164
183
  },
165
184
  };
166
185
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virtue-ai/gateway-connect",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "One-command setup to connect OpenClaw to VirtueAI MCP gateway",
5
5
  "type": "module",
6
6
  "files": [