gopherhole_openclaw_a2a 0.3.8 → 0.3.10

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.
@@ -16,6 +16,11 @@ export declare class A2AConnectionManager {
16
16
  start(): Promise<void>;
17
17
  private connectToGopherHole;
18
18
  private handleIncomingMessage;
19
+ /**
20
+ * Handle system messages from GopherHole Hub
21
+ * These include spending alerts, account alerts, notices, maintenance, etc.
22
+ */
23
+ private handleSystemMessage;
19
24
  stop(): Promise<void>;
20
25
  /**
21
26
  * Send a message to another agent via GopherHole and wait for response
@@ -92,6 +92,10 @@ export class A2AConnectionManager {
92
92
  this.gopherhole.on('message', (message) => {
93
93
  this.handleIncomingMessage(message);
94
94
  });
95
+ // Handle system messages (rate limits, budget alerts, announcements)
96
+ this.gopherhole.on('system', (message) => {
97
+ this.handleSystemMessage(message);
98
+ });
95
99
  // Connect
96
100
  try {
97
101
  await this.gopherhole.connect();
@@ -131,6 +135,40 @@ export class A2AConnectionManager {
131
135
  console.error('[a2a] Error handling incoming message:', err);
132
136
  });
133
137
  }
138
+ /**
139
+ * Handle system messages from GopherHole Hub
140
+ * These include spending alerts, account alerts, notices, maintenance, etc.
141
+ */
142
+ handleSystemMessage(message) {
143
+ const kind = message.metadata?.kind;
144
+ const text = message.payload.parts.find(p => p.kind === 'text')?.text || '';
145
+ const data = message.metadata?.data;
146
+ // Log all system messages
147
+ console.log(`[a2a] System message (${kind || 'unknown'}): ${text}`);
148
+ // Handle specific message kinds
149
+ switch (kind) {
150
+ case 'spending_alert':
151
+ console.warn(`[a2a] 💰 Spending alert: ${text}`);
152
+ if (data) {
153
+ console.warn(`[a2a] Spending data:`, JSON.stringify(data));
154
+ }
155
+ break;
156
+ case 'account_alert':
157
+ console.warn(`[a2a] ⚠️ Account alert: ${text}`);
158
+ break;
159
+ case 'system_notice':
160
+ console.log(`[a2a] 📢 System notice: ${text}`);
161
+ break;
162
+ case 'maintenance':
163
+ console.warn(`[a2a] 🔧 Maintenance notice: ${text}`);
164
+ break;
165
+ default:
166
+ // Log but don't warn for unknown types
167
+ if (kind) {
168
+ console.log(`[a2a] System message "${kind}": ${text}`);
169
+ }
170
+ }
171
+ }
134
172
  async stop() {
135
173
  if (this.gopherhole) {
136
174
  this.gopherhole.disconnect();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gopherhole_openclaw_a2a",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "GopherHole A2A plugin for OpenClaw - connect your AI agent to the GopherHole network",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "homepage": "https://gopherhole.ai",
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@gopherhole/sdk": "^0.2.4",
34
+ "@gopherhole/sdk": "^0.3.0",
35
35
  "uuid": "^10.0.0"
36
36
  },
37
37
  "devDependencies": {
package/src/connection.ts CHANGED
@@ -113,6 +113,11 @@ export class A2AConnectionManager {
113
113
  this.handleIncomingMessage(message);
114
114
  });
115
115
 
116
+ // Handle system messages (rate limits, budget alerts, announcements)
117
+ this.gopherhole.on('system', (message) => {
118
+ this.handleSystemMessage(message);
119
+ });
120
+
116
121
  // Connect
117
122
  try {
118
123
  await this.gopherhole.connect();
@@ -157,6 +162,47 @@ export class A2AConnectionManager {
157
162
  });
158
163
  }
159
164
 
165
+ /**
166
+ * Handle system messages from GopherHole Hub
167
+ * These include spending alerts, account alerts, notices, maintenance, etc.
168
+ */
169
+ private handleSystemMessage(message: Message): void {
170
+ const kind = message.metadata?.kind;
171
+ const text = message.payload.parts.find(p => p.kind === 'text')?.text || '';
172
+ const data = message.metadata?.data;
173
+
174
+ // Log all system messages
175
+ console.log(`[a2a] System message (${kind || 'unknown'}): ${text}`);
176
+
177
+ // Handle specific message kinds
178
+ switch (kind) {
179
+ case 'spending_alert':
180
+ console.warn(`[a2a] 💰 Spending alert: ${text}`);
181
+ if (data) {
182
+ console.warn(`[a2a] Spending data:`, JSON.stringify(data));
183
+ }
184
+ break;
185
+
186
+ case 'account_alert':
187
+ console.warn(`[a2a] ⚠️ Account alert: ${text}`);
188
+ break;
189
+
190
+ case 'system_notice':
191
+ console.log(`[a2a] 📢 System notice: ${text}`);
192
+ break;
193
+
194
+ case 'maintenance':
195
+ console.warn(`[a2a] 🔧 Maintenance notice: ${text}`);
196
+ break;
197
+
198
+ default:
199
+ // Log but don't warn for unknown types
200
+ if (kind) {
201
+ console.log(`[a2a] System message "${kind}": ${text}`);
202
+ }
203
+ }
204
+ }
205
+
160
206
  async stop(): Promise<void> {
161
207
  if (this.gopherhole) {
162
208
  this.gopherhole.disconnect();