@umimoney/clawdbot-relay-plugin 0.1.6 → 0.1.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/dist/clawdbot.plugin.json +1 -1
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +21 -4
- package/dist/index.mjs +20 -4
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://clawdbot.dev/schemas/plugin.json",
|
|
3
3
|
"id": "umi-relay",
|
|
4
4
|
"name": "UMI Relay",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.7",
|
|
6
6
|
"description": "Connect to UMI relay server for real-time chat visibility in UMI web UI",
|
|
7
7
|
"type": "channel",
|
|
8
8
|
"main": "index.js",
|
package/dist/index.d.mts
CHANGED
|
@@ -104,14 +104,17 @@ interface ClawdbotContext {
|
|
|
104
104
|
}) => void;
|
|
105
105
|
registerSend: (channel: string, handler: (response: any) => void) => void;
|
|
106
106
|
}
|
|
107
|
+
/** Plugin ID - must match manifest */
|
|
108
|
+
declare const id = "umi-relay";
|
|
107
109
|
/**
|
|
108
110
|
* Activate the UMI Relay plugin (Clawdbot standard export)
|
|
111
|
+
* Note: Clawdbot ignores async, so we fire-and-forget the connection
|
|
109
112
|
*/
|
|
110
|
-
declare function activate(ctx: ClawdbotContext, config
|
|
113
|
+
declare function activate(ctx: ClawdbotContext, config?: RelayConfig): void;
|
|
111
114
|
/**
|
|
112
115
|
* Deactivate the UMI Relay plugin
|
|
113
116
|
*/
|
|
114
117
|
declare function deactivate(): void;
|
|
115
118
|
declare const register: typeof activate;
|
|
116
119
|
|
|
117
|
-
export { type ClawdbotContext, type MessageHandler, type RelayConfig, type RelayMessage, type StateUpdate, UmiRelayClient, activate, deactivate, register };
|
|
120
|
+
export { type ClawdbotContext, type MessageHandler, type RelayConfig, type RelayMessage, type StateUpdate, UmiRelayClient, activate, deactivate, id, register };
|
package/dist/index.d.ts
CHANGED
|
@@ -104,14 +104,17 @@ interface ClawdbotContext {
|
|
|
104
104
|
}) => void;
|
|
105
105
|
registerSend: (channel: string, handler: (response: any) => void) => void;
|
|
106
106
|
}
|
|
107
|
+
/** Plugin ID - must match manifest */
|
|
108
|
+
declare const id = "umi-relay";
|
|
107
109
|
/**
|
|
108
110
|
* Activate the UMI Relay plugin (Clawdbot standard export)
|
|
111
|
+
* Note: Clawdbot ignores async, so we fire-and-forget the connection
|
|
109
112
|
*/
|
|
110
|
-
declare function activate(ctx: ClawdbotContext, config
|
|
113
|
+
declare function activate(ctx: ClawdbotContext, config?: RelayConfig): void;
|
|
111
114
|
/**
|
|
112
115
|
* Deactivate the UMI Relay plugin
|
|
113
116
|
*/
|
|
114
117
|
declare function deactivate(): void;
|
|
115
118
|
declare const register: typeof activate;
|
|
116
119
|
|
|
117
|
-
export { type ClawdbotContext, type MessageHandler, type RelayConfig, type RelayMessage, type StateUpdate, UmiRelayClient, activate, deactivate, register };
|
|
120
|
+
export { type ClawdbotContext, type MessageHandler, type RelayConfig, type RelayMessage, type StateUpdate, UmiRelayClient, activate, deactivate, id, register };
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
UmiRelayClient: () => UmiRelayClient,
|
|
34
34
|
activate: () => activate,
|
|
35
35
|
deactivate: () => deactivate,
|
|
36
|
+
id: () => id,
|
|
36
37
|
register: () => register
|
|
37
38
|
});
|
|
38
39
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -273,8 +274,20 @@ var UmiRelayClient = class {
|
|
|
273
274
|
}
|
|
274
275
|
};
|
|
275
276
|
var relayClient = null;
|
|
276
|
-
|
|
277
|
-
|
|
277
|
+
var id = "umi-relay";
|
|
278
|
+
function activate(ctx, config) {
|
|
279
|
+
const resolvedConfig = {
|
|
280
|
+
apiKey: config?.apiKey || process.env.UMI_API_KEY || "",
|
|
281
|
+
relayUrl: config?.relayUrl || "wss://ws.umi.app/ws/relay",
|
|
282
|
+
agentVersion: config?.agentVersion || "1.0.0",
|
|
283
|
+
capabilities: config?.capabilities || ["chat"],
|
|
284
|
+
autoReconnect: config?.autoReconnect ?? true
|
|
285
|
+
};
|
|
286
|
+
if (!resolvedConfig.apiKey) {
|
|
287
|
+
console.error("[UmiRelay] No API key provided. Set UMI_API_KEY or pass apiKey in config.");
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
relayClient = new UmiRelayClient(resolvedConfig);
|
|
278
291
|
relayClient.onMessage((message) => {
|
|
279
292
|
if (message.type === "platform:message") {
|
|
280
293
|
ctx.injectMessage({
|
|
@@ -292,8 +305,11 @@ async function activate(ctx, config) {
|
|
|
292
305
|
relayClient.sendMessage(response.text || response.content, response.metadata);
|
|
293
306
|
}
|
|
294
307
|
});
|
|
295
|
-
|
|
296
|
-
|
|
308
|
+
relayClient.connect().then(() => {
|
|
309
|
+
console.log("[UmiRelay] Plugin activated and connected");
|
|
310
|
+
}).catch((error) => {
|
|
311
|
+
console.error("[UmiRelay] Failed to connect:", error);
|
|
312
|
+
});
|
|
297
313
|
}
|
|
298
314
|
function deactivate() {
|
|
299
315
|
if (relayClient) {
|
|
@@ -308,5 +324,6 @@ var register = activate;
|
|
|
308
324
|
UmiRelayClient,
|
|
309
325
|
activate,
|
|
310
326
|
deactivate,
|
|
327
|
+
id,
|
|
311
328
|
register
|
|
312
329
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -236,8 +236,20 @@ var UmiRelayClient = class {
|
|
|
236
236
|
}
|
|
237
237
|
};
|
|
238
238
|
var relayClient = null;
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
var id = "umi-relay";
|
|
240
|
+
function activate(ctx, config) {
|
|
241
|
+
const resolvedConfig = {
|
|
242
|
+
apiKey: config?.apiKey || process.env.UMI_API_KEY || "",
|
|
243
|
+
relayUrl: config?.relayUrl || "wss://ws.umi.app/ws/relay",
|
|
244
|
+
agentVersion: config?.agentVersion || "1.0.0",
|
|
245
|
+
capabilities: config?.capabilities || ["chat"],
|
|
246
|
+
autoReconnect: config?.autoReconnect ?? true
|
|
247
|
+
};
|
|
248
|
+
if (!resolvedConfig.apiKey) {
|
|
249
|
+
console.error("[UmiRelay] No API key provided. Set UMI_API_KEY or pass apiKey in config.");
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
relayClient = new UmiRelayClient(resolvedConfig);
|
|
241
253
|
relayClient.onMessage((message) => {
|
|
242
254
|
if (message.type === "platform:message") {
|
|
243
255
|
ctx.injectMessage({
|
|
@@ -255,8 +267,11 @@ async function activate(ctx, config) {
|
|
|
255
267
|
relayClient.sendMessage(response.text || response.content, response.metadata);
|
|
256
268
|
}
|
|
257
269
|
});
|
|
258
|
-
|
|
259
|
-
|
|
270
|
+
relayClient.connect().then(() => {
|
|
271
|
+
console.log("[UmiRelay] Plugin activated and connected");
|
|
272
|
+
}).catch((error) => {
|
|
273
|
+
console.error("[UmiRelay] Failed to connect:", error);
|
|
274
|
+
});
|
|
260
275
|
}
|
|
261
276
|
function deactivate() {
|
|
262
277
|
if (relayClient) {
|
|
@@ -270,5 +285,6 @@ export {
|
|
|
270
285
|
UmiRelayClient,
|
|
271
286
|
activate,
|
|
272
287
|
deactivate,
|
|
288
|
+
id,
|
|
273
289
|
register
|
|
274
290
|
};
|