omnivibe-openclaw-plugin 0.1.1 → 0.1.3
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/bridge.js +12 -6
- package/dist/channel.js +12 -1
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/dist/bridge.js
CHANGED
|
@@ -31,9 +31,13 @@ export class SSEBridge {
|
|
|
31
31
|
async listen() {
|
|
32
32
|
for await (const event of this.client.stream("/v1/stream")) {
|
|
33
33
|
this.reconnectDelay = 1000;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
try {
|
|
35
|
+
// SSE endpoint wraps all events as default "message" event with
|
|
36
|
+
// the actual event type inside the JSON payload:
|
|
37
|
+
// { "event_type": "channel.message_sent", "data": { channel_id, message } }
|
|
38
|
+
const outer = JSON.parse(event.data);
|
|
39
|
+
if (outer.event_type === "channel.message_sent") {
|
|
40
|
+
const data = outer.data;
|
|
37
41
|
if (!/^[a-f0-9]{24}$/.test(data.channel_id))
|
|
38
42
|
continue;
|
|
39
43
|
if (data.message.sender.id === this.selfAgentId)
|
|
@@ -41,9 +45,9 @@ export class SSEBridge {
|
|
|
41
45
|
const envelope = this.toEnvelope(data.channel_id, data.message);
|
|
42
46
|
await this.handler(envelope);
|
|
43
47
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
console.error(`[omnivibe] SSE handler error: ${err.message}`);
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
}
|
|
@@ -53,6 +57,8 @@ export class SSEBridge {
|
|
|
53
57
|
sender: {
|
|
54
58
|
id: msg.sender.id,
|
|
55
59
|
name: msg.sender.anon_alias || msg.sender.display_name,
|
|
60
|
+
type: msg.sender.type,
|
|
61
|
+
handle: msg.sender.handle,
|
|
56
62
|
avatarUrl: msg.sender.avatar_url,
|
|
57
63
|
},
|
|
58
64
|
target: { kind: "group", id: `omnivibe:${channelId}` },
|
package/dist/channel.js
CHANGED
|
@@ -14,7 +14,13 @@ async function dispatchOmniVibeInbound(params) {
|
|
|
14
14
|
}
|
|
15
15
|
const { cfg, accountId, envelope } = params;
|
|
16
16
|
const senderId = envelope.sender.id;
|
|
17
|
-
|
|
17
|
+
// Build a rich sender label so the agent knows who is talking:
|
|
18
|
+
// e.g. "Perry (@perry, owner)" or "Alex (@clawd-alex, agent)"
|
|
19
|
+
const baseName = envelope.sender.name || senderId;
|
|
20
|
+
const handlePart = envelope.sender.handle ? `@${envelope.sender.handle}` : null;
|
|
21
|
+
const typePart = envelope.sender.type || null;
|
|
22
|
+
const suffix = [handlePart, typePart].filter(Boolean).join(", ");
|
|
23
|
+
const senderName = suffix ? `${baseName} (${suffix})` : baseName;
|
|
18
24
|
const channelId = typeof envelope.target?.id === "string"
|
|
19
25
|
? envelope.target.id.replace(/^omnivibe:/, "")
|
|
20
26
|
: "";
|
|
@@ -61,6 +67,11 @@ async function dispatchOmniVibeInbound(params) {
|
|
|
61
67
|
OriginatingTo: `omnivibe:${accountId}`,
|
|
62
68
|
ConversationLabel: chatType === "group" ? channelId : senderName,
|
|
63
69
|
});
|
|
70
|
+
// Send typing indicator before agent starts processing so the user
|
|
71
|
+
// knows the agent received their message and is working on it
|
|
72
|
+
const typingAccount = resolveOmniVibeAccount({ cfg, accountId });
|
|
73
|
+
const typingClient = new ApiClient(typingAccount.apiKey, typingAccount.baseUrl);
|
|
74
|
+
typingClient.post(`/v1/channels/${channelId}/typing`).catch(() => { });
|
|
64
75
|
await core.channel.reply.dispatchReplyWithBufferedBlockDispatcher({
|
|
65
76
|
ctx: ctxPayload,
|
|
66
77
|
cfg,
|
package/dist/types.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface InboundEnvelope {
|
|
|
11
11
|
id: string;
|
|
12
12
|
name: string;
|
|
13
13
|
avatarUrl?: string;
|
|
14
|
+
type?: "agent" | "owner";
|
|
15
|
+
handle?: string | null;
|
|
14
16
|
};
|
|
15
17
|
target: {
|
|
16
18
|
kind: "dm" | "group" | "channel";
|
|
@@ -72,6 +74,7 @@ export interface OmniVibeMessage {
|
|
|
72
74
|
sender: {
|
|
73
75
|
type: "agent" | "owner";
|
|
74
76
|
id: string;
|
|
77
|
+
handle?: string | null;
|
|
75
78
|
display_name: string;
|
|
76
79
|
avatar_url?: string;
|
|
77
80
|
anon_alias?: string;
|