openclaw-zulip 0.1.0
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/LICENSE +21 -0
- package/README.md +129 -0
- package/dist/actions.d.ts +3 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +149 -0
- package/dist/actions.js.map +1 -0
- package/dist/agent-prompt.d.ts +3 -0
- package/dist/agent-prompt.d.ts.map +1 -0
- package/dist/agent-prompt.js +21 -0
- package/dist/agent-prompt.js.map +1 -0
- package/dist/allowlist.d.ts +3 -0
- package/dist/allowlist.d.ts.map +1 -0
- package/dist/allowlist.js +50 -0
- package/dist/allowlist.js.map +1 -0
- package/dist/bindings.d.ts +24 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +281 -0
- package/dist/bindings.js.map +1 -0
- package/dist/commands.d.ts +3 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +7 -0
- package/dist/commands.js.map +1 -0
- package/dist/config-schema.d.ts +2 -0
- package/dist/config-schema.d.ts.map +1 -0
- package/dist/config-schema.js +34 -0
- package/dist/config-schema.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +53 -0
- package/dist/config.js.map +1 -0
- package/dist/directory.d.ts +3 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +68 -0
- package/dist/directory.js.map +1 -0
- package/dist/gateway.d.ts +4 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +324 -0
- package/dist/gateway.js.map +1 -0
- package/dist/groups.d.ts +3 -0
- package/dist/groups.d.ts.map +1 -0
- package/dist/groups.js +28 -0
- package/dist/groups.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/messaging.d.ts +3 -0
- package/dist/messaging.d.ts.map +1 -0
- package/dist/messaging.js +47 -0
- package/dist/messaging.js.map +1 -0
- package/dist/outbound.d.ts +24 -0
- package/dist/outbound.d.ts.map +1 -0
- package/dist/outbound.js +114 -0
- package/dist/outbound.js.map +1 -0
- package/dist/plugin.d.ts +5 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +66 -0
- package/dist/plugin.js.map +1 -0
- package/dist/resolver.d.ts +3 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +39 -0
- package/dist/resolver.js.map +1 -0
- package/dist/security.d.ts +4 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +15 -0
- package/dist/security.js.map +1 -0
- package/dist/setup.d.ts +2 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +25 -0
- package/dist/setup.js.map +1 -0
- package/dist/status.d.ts +14 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +74 -0
- package/dist/status.js.map +1 -0
- package/dist/threading.d.ts +3 -0
- package/dist/threading.d.ts.map +1 -0
- package/dist/threading.js +25 -0
- package/dist/threading.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/zulip-client.d.ts +115 -0
- package/dist/zulip-client.d.ts.map +1 -0
- package/dist/zulip-client.js +232 -0
- package/dist/zulip-client.js.map +1 -0
- package/openclaw.plugin.json +33 -0
- package/package.json +53 -0
package/dist/gateway.js
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { createChannelReplyPipeline, dispatchInboundReplyWithBase } from "openclaw/plugin-sdk/irc";
|
|
2
|
+
import { registerSessionBindingAdapter, unregisterSessionBindingAdapter, } from "openclaw/plugin-sdk/conversation-runtime";
|
|
3
|
+
import { resolveSenderCommandAuthorization, } from "openclaw/plugin-sdk/command-auth";
|
|
4
|
+
import { getZulipSection } from "./types.js";
|
|
5
|
+
import { ZulipClient } from "./zulip-client.js";
|
|
6
|
+
import { createZulipSessionBindingAdapter, clearZulipBindingStore, touchZulipBindingByConversation, } from "./bindings.js";
|
|
7
|
+
const CHANNEL_ID = "zulip";
|
|
8
|
+
export const zulipGatewayAdapter = {
|
|
9
|
+
async startAccount(ctx) {
|
|
10
|
+
const { account, abortSignal, log } = ctx;
|
|
11
|
+
const client = new ZulipClient({
|
|
12
|
+
serverUrl: account.serverUrl,
|
|
13
|
+
email: account.email,
|
|
14
|
+
apiKey: account.apiKey,
|
|
15
|
+
});
|
|
16
|
+
// Register session binding adapter for ACP topic bindings
|
|
17
|
+
const bindingAdapter = createZulipSessionBindingAdapter(account.accountId);
|
|
18
|
+
registerSessionBindingAdapter(bindingAdapter);
|
|
19
|
+
// Identify ourselves so we can filter our own messages
|
|
20
|
+
const self = await client.getOwnUser();
|
|
21
|
+
log?.info(`Connected as ${self.full_name} (${self.email}, id=${self.user_id})`);
|
|
22
|
+
// Register event queue
|
|
23
|
+
const queue = await client.registerEventQueue({
|
|
24
|
+
eventTypes: ["message"],
|
|
25
|
+
allPublicStreams: account.mode === "bot",
|
|
26
|
+
});
|
|
27
|
+
log?.info(`Event queue registered: ${queue.queue_id}`);
|
|
28
|
+
ctx.setStatus({
|
|
29
|
+
accountId: account.accountId,
|
|
30
|
+
enabled: true,
|
|
31
|
+
configured: true,
|
|
32
|
+
running: true,
|
|
33
|
+
connected: true,
|
|
34
|
+
lastConnectedAt: Date.now(),
|
|
35
|
+
});
|
|
36
|
+
let lastEventId = queue.last_event_id;
|
|
37
|
+
// Poll loop
|
|
38
|
+
while (!abortSignal.aborted) {
|
|
39
|
+
let events;
|
|
40
|
+
try {
|
|
41
|
+
events = await client.getEvents({
|
|
42
|
+
queueId: queue.queue_id,
|
|
43
|
+
lastEventId,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
if (abortSignal.aborted)
|
|
48
|
+
break;
|
|
49
|
+
log?.error(`Event poll error: ${err}`);
|
|
50
|
+
// Back off before retry
|
|
51
|
+
await new Promise((r) => setTimeout(r, 5000));
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
for (const event of events) {
|
|
55
|
+
if (abortSignal.aborted)
|
|
56
|
+
break;
|
|
57
|
+
lastEventId = event.id;
|
|
58
|
+
if (event.type === "heartbeat")
|
|
59
|
+
continue;
|
|
60
|
+
if (event.type !== "message" || !event.message)
|
|
61
|
+
continue;
|
|
62
|
+
const msg = event.message;
|
|
63
|
+
// Skip our own messages
|
|
64
|
+
if (msg.sender_id === self.user_id)
|
|
65
|
+
continue;
|
|
66
|
+
try {
|
|
67
|
+
await handleInboundMessage(ctx, client, msg);
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
log?.error(`Error handling message ${msg.id}: ${err}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Cleanup — deregister queue and binding adapter
|
|
75
|
+
try {
|
|
76
|
+
await client.deleteEventQueue(queue.queue_id);
|
|
77
|
+
log?.info("Event queue deregistered.");
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// Queue may already be expired
|
|
81
|
+
}
|
|
82
|
+
unregisterSessionBindingAdapter({ channel: CHANNEL_ID, accountId: account.accountId, adapter: bindingAdapter });
|
|
83
|
+
clearZulipBindingStore(account.accountId);
|
|
84
|
+
ctx.setStatus({
|
|
85
|
+
accountId: account.accountId,
|
|
86
|
+
enabled: true,
|
|
87
|
+
configured: true,
|
|
88
|
+
running: false,
|
|
89
|
+
connected: false,
|
|
90
|
+
lastStopAt: Date.now(),
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
async stopAccount(ctx) {
|
|
94
|
+
ctx.log?.info(`Stopping account ${ctx.account.accountId}`);
|
|
95
|
+
// The abort signal in startAccount will break the poll loop
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
function resolveAckReactions(cfg) {
|
|
99
|
+
const section = getZulipSection(cfg);
|
|
100
|
+
const reactions = section?.reactions;
|
|
101
|
+
if (!reactions || reactions.enabled === false)
|
|
102
|
+
return { enabled: false };
|
|
103
|
+
return {
|
|
104
|
+
enabled: true,
|
|
105
|
+
onStart: reactions.onStart ?? undefined,
|
|
106
|
+
onSuccess: reactions.onSuccess ?? undefined,
|
|
107
|
+
onError: reactions.onError ?? undefined,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
// Inbound message handling
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
async function handleInboundMessage(ctx, client, msg) {
|
|
114
|
+
const { cfg, account, log } = ctx;
|
|
115
|
+
const isGroup = msg.type === "stream";
|
|
116
|
+
const streamId = msg.stream_id;
|
|
117
|
+
const topic = msg.subject;
|
|
118
|
+
// Build peer info
|
|
119
|
+
let peerId;
|
|
120
|
+
let chatType;
|
|
121
|
+
if (isGroup && streamId != null) {
|
|
122
|
+
peerId = topic ? `${streamId}/${topic}` : String(streamId);
|
|
123
|
+
chatType = "group";
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
peerId = String(msg.sender_id);
|
|
127
|
+
chatType = "direct";
|
|
128
|
+
}
|
|
129
|
+
// Touch any active binding for this conversation so idle timeout resets
|
|
130
|
+
touchZulipBindingByConversation(account.accountId, peerId);
|
|
131
|
+
// Resolve route via channelRuntime
|
|
132
|
+
if (!ctx.channelRuntime) {
|
|
133
|
+
log?.warn("channelRuntime not available — cannot dispatch inbound message");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const route = ctx.channelRuntime.routing.resolveAgentRoute({
|
|
137
|
+
cfg,
|
|
138
|
+
channel: CHANNEL_ID,
|
|
139
|
+
accountId: account.accountId,
|
|
140
|
+
peer: { kind: chatType, id: peerId },
|
|
141
|
+
parentPeer: isGroup && streamId != null && topic
|
|
142
|
+
? { kind: "group", id: String(streamId) }
|
|
143
|
+
: undefined,
|
|
144
|
+
});
|
|
145
|
+
const storePath = ctx.channelRuntime.session.resolveStorePath(undefined, {
|
|
146
|
+
agentId: route.agentId,
|
|
147
|
+
});
|
|
148
|
+
// Build context payload
|
|
149
|
+
const senderName = msg.sender_full_name;
|
|
150
|
+
const senderId = String(msg.sender_id);
|
|
151
|
+
const senderEmail = msg.sender_email;
|
|
152
|
+
const to = isGroup && streamId != null
|
|
153
|
+
? String(streamId)
|
|
154
|
+
: senderId;
|
|
155
|
+
const groupChannel = isGroup && typeof msg.display_recipient === "string"
|
|
156
|
+
? `#${msg.display_recipient}`
|
|
157
|
+
: undefined;
|
|
158
|
+
// Resolve command authorization from allowlists
|
|
159
|
+
const { commandAuthorized } = await resolveSenderCommandAuthorization({
|
|
160
|
+
cfg,
|
|
161
|
+
rawBody: msg.content,
|
|
162
|
+
isGroup,
|
|
163
|
+
dmPolicy: account.dmPolicy,
|
|
164
|
+
configuredAllowFrom: account.allowFrom.map(String),
|
|
165
|
+
senderId: senderEmail,
|
|
166
|
+
isSenderAllowed: (sid, allowFrom) => allowFrom.includes(sid) || allowFrom.includes(String(msg.sender_id)) || allowFrom.includes("*"),
|
|
167
|
+
readAllowFromStore: () => ctx.channelRuntime.pairing.readAllowFromStore({
|
|
168
|
+
channel: CHANNEL_ID,
|
|
169
|
+
accountId: account.accountId,
|
|
170
|
+
}),
|
|
171
|
+
shouldComputeCommandAuthorized: ctx.channelRuntime.commands.shouldComputeCommandAuthorized,
|
|
172
|
+
resolveCommandAuthorizedFromAuthorizers: ctx.channelRuntime.commands.resolveCommandAuthorizedFromAuthorizers,
|
|
173
|
+
});
|
|
174
|
+
const ctxPayload = ctx.channelRuntime.reply.finalizeInboundContext({
|
|
175
|
+
Body: msg.content,
|
|
176
|
+
From: senderEmail,
|
|
177
|
+
To: to,
|
|
178
|
+
SessionKey: route.sessionKey,
|
|
179
|
+
AccountId: account.accountId,
|
|
180
|
+
MessageSid: String(msg.id),
|
|
181
|
+
ChatType: chatType,
|
|
182
|
+
SenderName: senderName,
|
|
183
|
+
SenderId: senderEmail,
|
|
184
|
+
SenderUsername: senderEmail,
|
|
185
|
+
Timestamp: msg.timestamp * 1000,
|
|
186
|
+
Provider: CHANNEL_ID,
|
|
187
|
+
Surface: CHANNEL_ID,
|
|
188
|
+
OriginatingChannel: CHANNEL_ID,
|
|
189
|
+
OriginatingTo: to,
|
|
190
|
+
GroupChannel: groupChannel,
|
|
191
|
+
ThreadLabel: topic,
|
|
192
|
+
MessageThreadId: topic,
|
|
193
|
+
CommandAuthorized: commandAuthorized ?? false,
|
|
194
|
+
});
|
|
195
|
+
// ----- Typing indicators -----
|
|
196
|
+
const pipeline = createChannelReplyPipeline({
|
|
197
|
+
cfg,
|
|
198
|
+
agentId: route.agentId,
|
|
199
|
+
channel: CHANNEL_ID,
|
|
200
|
+
accountId: account.accountId,
|
|
201
|
+
typing: {
|
|
202
|
+
start: async () => {
|
|
203
|
+
if (isGroup && streamId != null && topic) {
|
|
204
|
+
await client.sendTypingNotification({
|
|
205
|
+
op: "start",
|
|
206
|
+
type: "stream",
|
|
207
|
+
streamId,
|
|
208
|
+
topic,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
await client.sendTypingNotification({
|
|
213
|
+
op: "start",
|
|
214
|
+
type: "direct",
|
|
215
|
+
to: [Number(to)],
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
stop: async () => {
|
|
220
|
+
if (isGroup && streamId != null && topic) {
|
|
221
|
+
await client.sendTypingNotification({
|
|
222
|
+
op: "stop",
|
|
223
|
+
type: "stream",
|
|
224
|
+
streamId,
|
|
225
|
+
topic,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
await client.sendTypingNotification({
|
|
230
|
+
op: "stop",
|
|
231
|
+
type: "direct",
|
|
232
|
+
to: [Number(to)],
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
onStartError: (err) => log?.debug?.(`Typing start error: ${err}`),
|
|
237
|
+
onStopError: (err) => log?.debug?.(`Typing stop error: ${err}`),
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
// ----- Ack reactions -----
|
|
241
|
+
const ackCfg = resolveAckReactions(cfg);
|
|
242
|
+
let ackStartApplied = false;
|
|
243
|
+
if (ackCfg.enabled && ackCfg.onStart) {
|
|
244
|
+
try {
|
|
245
|
+
await client.addReaction(msg.id, ackCfg.onStart);
|
|
246
|
+
ackStartApplied = true;
|
|
247
|
+
}
|
|
248
|
+
catch (err) {
|
|
249
|
+
log?.debug?.(`Ack reaction (onStart) failed: ${err}`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
let dispatchOk = true;
|
|
253
|
+
// Dispatch reply
|
|
254
|
+
await dispatchInboundReplyWithBase({
|
|
255
|
+
cfg,
|
|
256
|
+
channel: CHANNEL_ID,
|
|
257
|
+
accountId: account.accountId,
|
|
258
|
+
route,
|
|
259
|
+
storePath,
|
|
260
|
+
ctxPayload,
|
|
261
|
+
core: {
|
|
262
|
+
channel: {
|
|
263
|
+
session: {
|
|
264
|
+
recordInboundSession: ctx.channelRuntime.session.recordInboundSession,
|
|
265
|
+
},
|
|
266
|
+
reply: {
|
|
267
|
+
dispatchReplyWithBufferedBlockDispatcher: ctx.channelRuntime.reply.dispatchReplyWithBufferedBlockDispatcher,
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
replyOptions: {
|
|
272
|
+
onReplyStart: pipeline.typingCallbacks?.onReplyStart,
|
|
273
|
+
onTypingCleanup: pipeline.typingCallbacks?.onCleanup,
|
|
274
|
+
},
|
|
275
|
+
deliver: async (payload) => {
|
|
276
|
+
const text = payload.text ?? "";
|
|
277
|
+
if (!text.trim() && !payload.mediaUrl && !payload.mediaUrls?.length)
|
|
278
|
+
return;
|
|
279
|
+
const threadId = topic;
|
|
280
|
+
const targetTo = to;
|
|
281
|
+
if (isGroup && streamId != null && threadId) {
|
|
282
|
+
await client.sendMessage({
|
|
283
|
+
type: "stream",
|
|
284
|
+
to: String(streamId),
|
|
285
|
+
topic: threadId,
|
|
286
|
+
content: text,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
await client.sendMessage({
|
|
291
|
+
type: "direct",
|
|
292
|
+
to: [Number(targetTo)],
|
|
293
|
+
content: text,
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
onRecordError: (err) => log?.error(`Session record error: ${err}`),
|
|
298
|
+
onDispatchError: (err) => {
|
|
299
|
+
dispatchOk = false;
|
|
300
|
+
log?.error(`Dispatch error: ${err}`);
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
// ----- Finalize ack reactions -----
|
|
304
|
+
if (ackCfg.enabled) {
|
|
305
|
+
if (ackStartApplied && ackCfg.onStart) {
|
|
306
|
+
try {
|
|
307
|
+
await client.removeReaction(msg.id, ackCfg.onStart);
|
|
308
|
+
}
|
|
309
|
+
catch (err) {
|
|
310
|
+
log?.debug?.(`Ack reaction removal failed: ${err}`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
const terminalEmoji = dispatchOk ? ackCfg.onSuccess : ackCfg.onError;
|
|
314
|
+
if (terminalEmoji) {
|
|
315
|
+
try {
|
|
316
|
+
await client.addReaction(msg.id, terminalEmoji);
|
|
317
|
+
}
|
|
318
|
+
catch (err) {
|
|
319
|
+
log?.debug?.(`Ack terminal reaction failed: ${err}`);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACnG,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,GAChC,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAE1C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C;gBACH,MAAM,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;YAClD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,GAAG,EAAE,KAAK,EAAE,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/groups.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../src/groups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAQ9D,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAuBnE,CAAC"}
|
package/dist/groups.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { resolveZulipAccount } from "./config.js";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Groups adapter — per-stream policies
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
export const zulipGroupsAdapter = {
|
|
6
|
+
resolveRequireMention({ cfg, accountId, groupId }) {
|
|
7
|
+
const account = resolveZulipAccount(cfg, accountId);
|
|
8
|
+
if (!groupId)
|
|
9
|
+
return undefined;
|
|
10
|
+
// Check per-stream config for requireMention
|
|
11
|
+
for (const [, streamConfig] of Object.entries(account.streams)) {
|
|
12
|
+
if (streamConfig.requireMention)
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
// Stream-specific lookup by name requires matching groupId to a stream name
|
|
16
|
+
// groupId is the stream ID string — we can't resolve name without an API call,
|
|
17
|
+
// so we rely on the streams config being keyed by name in the account config
|
|
18
|
+
const streamConfig = account.streams[groupId];
|
|
19
|
+
if (streamConfig?.requireMention !== undefined)
|
|
20
|
+
return streamConfig.requireMention;
|
|
21
|
+
return undefined;
|
|
22
|
+
},
|
|
23
|
+
resolveGroupIntroHint({ cfg, accountId }) {
|
|
24
|
+
const account = resolveZulipAccount(cfg, accountId);
|
|
25
|
+
return `This is a Zulip ${account.mode === "user" ? "user" : "bot"} account. Messages in streams require a topic.`;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=groups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groups.js","sourceRoot":"","sources":["../src/groups.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E;AAE9E,MAAM,CAAC,MAAM,kBAAkB,GAAyC;IACtE,qBAAqB,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE;QAC/C,MAAM,OAAO,GAAG,mBAAmB,CAAC,GAAiB,EAAE,SAAS,CAAC,CAAC;QAClE,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAE/B,6CAA6C;QAC7C,KAAK,MAAM,CAAC,EAAE,YAAY,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/D,IAAI,YAAY,CAAC,cAAc;gBAAE,OAAO,IAAI,CAAC;QAC/C,CAAC;QAED,4EAA4E;QAC5E,+EAA+E;QAC/E,6EAA6E;QAC7E,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,YAAY,EAAE,cAAc,KAAK,SAAS;YAAE,OAAO,YAAY,CAAC,cAAc,CAAC;QAEnF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,qBAAqB,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE;QACtC,MAAM,OAAO,GAAG,mBAAmB,CAAC,GAAiB,EAAE,SAAS,CAAC,CAAC;QAClE,OAAO,mBAAmB,OAAO,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,gDAAgD,CAAC;IACrH,CAAC;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
configSchema: import("openclaw/plugin-sdk/core").OpenClawPluginConfigSchema;
|
|
6
|
+
register: (api: import("openclaw/plugin-sdk/core").OpenClawPluginApi) => void;
|
|
7
|
+
channelPlugin: import("openclaw/plugin-sdk/core").ChannelPlugin<import("./types.js").ZulipResolvedAccount, import("./status.js").ZulipProbe>;
|
|
8
|
+
setChannelRuntime?: (runtime: import("openclaw/plugin-sdk/core").PluginRuntime) => void;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAGA,wBAKG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineChannelPluginEntry } from "openclaw/plugin-sdk/core";
|
|
2
|
+
import { zulipPlugin } from "./plugin.js";
|
|
3
|
+
export default defineChannelPluginEntry({
|
|
4
|
+
id: "zulip",
|
|
5
|
+
name: "Zulip",
|
|
6
|
+
description: "OpenClaw channel plugin for Zulip — streams, topics, DMs, and ACP topic bindings.",
|
|
7
|
+
plugin: zulipPlugin,
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,eAAe,wBAAwB,CAAC;IACtC,EAAE,EAAE,OAAO;IACX,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,mFAAmF;IAChG,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../src/messaging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAiDzE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const zulipMessagingAdapter = {
|
|
2
|
+
resolveSessionConversation({ rawId }) {
|
|
3
|
+
// rawId formats:
|
|
4
|
+
// group/channel: "<stream_id>" or "<stream_id>/<topic>"
|
|
5
|
+
const slashIdx = rawId.indexOf("/");
|
|
6
|
+
if (slashIdx === -1) {
|
|
7
|
+
return { id: rawId };
|
|
8
|
+
}
|
|
9
|
+
const streamPart = rawId.slice(0, slashIdx);
|
|
10
|
+
const topicPart = rawId.slice(slashIdx + 1);
|
|
11
|
+
return {
|
|
12
|
+
id: rawId,
|
|
13
|
+
threadId: topicPart,
|
|
14
|
+
baseConversationId: streamPart,
|
|
15
|
+
parentConversationCandidates: [streamPart],
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
resolveSessionTarget({ id }) {
|
|
19
|
+
return id;
|
|
20
|
+
},
|
|
21
|
+
parseExplicitTarget({ raw }) {
|
|
22
|
+
// Formats: "stream:<stream_id>/<topic>" or "dm:<user_id>" or "user:<user_id_or_email>"
|
|
23
|
+
if (raw.startsWith("dm:")) {
|
|
24
|
+
return { to: raw.slice(3), chatType: "direct" };
|
|
25
|
+
}
|
|
26
|
+
if (raw.startsWith("user:")) {
|
|
27
|
+
return { to: raw.slice(5), chatType: "direct" };
|
|
28
|
+
}
|
|
29
|
+
if (raw.startsWith("stream:")) {
|
|
30
|
+
const rest = raw.slice(7);
|
|
31
|
+
// Support both "stream:name/topic" and "stream:name:topic" separators
|
|
32
|
+
const slashIdx = rest.indexOf("/");
|
|
33
|
+
const colonIdx = rest.indexOf(":");
|
|
34
|
+
const sepIdx = slashIdx !== -1 ? slashIdx : colonIdx;
|
|
35
|
+
if (sepIdx === -1) {
|
|
36
|
+
return { to: rest, chatType: "group" };
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
to: rest.slice(0, sepIdx),
|
|
40
|
+
threadId: rest.slice(sepIdx + 1),
|
|
41
|
+
chatType: "group",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=messaging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messaging.js","sourceRoot":"","sources":["../src/messaging.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAA4C;IAC5E,0BAA0B,CAAC,EAAE,KAAK,EAAE;QAClC,iBAAiB;QACjB,6DAA6D;QAC7D,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACpC,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE,CAAC;YACpB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;QACvB,CAAC;QAED,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;QAE5C,OAAO;YACL,EAAE,EAAE,KAAK;YACT,QAAQ,EAAE,SAAS;YACnB,kBAAkB,EAAE,UAAU;YAC9B,4BAA4B,EAAE,CAAC,UAAU,CAAC;SAC3C,CAAC;IACJ,CAAC;IAED,oBAAoB,CAAC,EAAE,EAAE,EAAE;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,mBAAmB,CAAC,EAAE,GAAG,E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
import { ZulipClient } from "./zulip-client.js";
|
|
3
|
+
export declare function buildClient(cfg: OpenClawConfig, accountId?: string | null): ZulipClient;
|
|
4
|
+
/**
|
|
5
|
+
* Parse the outbound `to` field into a resolved target.
|
|
6
|
+
*
|
|
7
|
+
* The SDK may deliver targets in several formats:
|
|
8
|
+
* - Numeric string: "8" (Zulip user ID for DMs, or stream ID for streams)
|
|
9
|
+
* - "user:<email_or_id>" — DM target (SDK convention)
|
|
10
|
+
* - "dm:<user_id>" — DM target (plugin convention)
|
|
11
|
+
* - "stream:<stream_id>/<topic>" — stream target (plugin convention)
|
|
12
|
+
* - Plain stream name or ID — stream target (when threadId is set)
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveOutboundTarget(to: string, threadId?: string | number | null): {
|
|
15
|
+
type: "direct";
|
|
16
|
+
to: number[] | string[];
|
|
17
|
+
topic?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
type: "stream";
|
|
20
|
+
to: string;
|
|
21
|
+
topic: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const zulipOutboundAdapter: NonNullable<ChannelPlugin["outbound"]>;
|
|
24
|
+
//# sourceMappingURL=outbound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbound.d.ts","sourceRoot":"","sources":["../src/outbound.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhD,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,CAavF;AAuBD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,MAAM,EACV,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAChC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAoBhH;AAiBD,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAwCvE,CAAC"}
|
package/dist/outbound.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ZulipClient } from "./zulip-client.js";
|
|
2
|
+
import { resolveZulipAccount } from "./config.js";
|
|
3
|
+
const clientCache = new Map();
|
|
4
|
+
export function buildClient(cfg, accountId) {
|
|
5
|
+
const account = resolveZulipAccount(cfg, accountId);
|
|
6
|
+
const cacheKey = `${account.serverUrl}:${account.email}`;
|
|
7
|
+
let client = clientCache.get(cacheKey);
|
|
8
|
+
if (!client) {
|
|
9
|
+
client = new ZulipClient({
|
|
10
|
+
serverUrl: account.serverUrl,
|
|
11
|
+
email: account.email,
|
|
12
|
+
apiKey: account.apiKey,
|
|
13
|
+
});
|
|
14
|
+
clientCache.set(cacheKey, client);
|
|
15
|
+
}
|
|
16
|
+
return client;
|
|
17
|
+
}
|
|
18
|
+
const ZULIP_TEXT_CHUNK_LIMIT = 10_000;
|
|
19
|
+
function chunkText(text, limit) {
|
|
20
|
+
if (text.length <= limit)
|
|
21
|
+
return [text];
|
|
22
|
+
const chunks = [];
|
|
23
|
+
let remaining = text;
|
|
24
|
+
while (remaining.length > 0) {
|
|
25
|
+
if (remaining.length <= limit) {
|
|
26
|
+
chunks.push(remaining);
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
// Try to break at a newline boundary near the limit
|
|
30
|
+
const slice = remaining.slice(0, limit);
|
|
31
|
+
const lastNewline = slice.lastIndexOf("\n");
|
|
32
|
+
const breakAt = lastNewline > limit * 0.5 ? lastNewline + 1 : limit;
|
|
33
|
+
chunks.push(remaining.slice(0, breakAt));
|
|
34
|
+
remaining = remaining.slice(breakAt);
|
|
35
|
+
}
|
|
36
|
+
return chunks;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parse the outbound `to` field into a resolved target.
|
|
40
|
+
*
|
|
41
|
+
* The SDK may deliver targets in several formats:
|
|
42
|
+
* - Numeric string: "8" (Zulip user ID for DMs, or stream ID for streams)
|
|
43
|
+
* - "user:<email_or_id>" — DM target (SDK convention)
|
|
44
|
+
* - "dm:<user_id>" — DM target (plugin convention)
|
|
45
|
+
* - "stream:<stream_id>/<topic>" — stream target (plugin convention)
|
|
46
|
+
* - Plain stream name or ID — stream target (when threadId is set)
|
|
47
|
+
*/
|
|
48
|
+
export function resolveOutboundTarget(to, threadId) {
|
|
49
|
+
// Explicit DM prefixes always win
|
|
50
|
+
if (to.startsWith("user:") || to.startsWith("dm:")) {
|
|
51
|
+
const recipient = to.startsWith("user:") ? to.slice(5) : to.slice(3);
|
|
52
|
+
const asNum = Number(recipient);
|
|
53
|
+
return {
|
|
54
|
+
type: "direct",
|
|
55
|
+
to: Number.isFinite(asNum) && String(asNum) === recipient
|
|
56
|
+
? [asNum]
|
|
57
|
+
: [recipient],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// No threadId → DM
|
|
61
|
+
if (!threadId) {
|
|
62
|
+
return { type: "direct", to: [Number(to)] };
|
|
63
|
+
}
|
|
64
|
+
// Stream message
|
|
65
|
+
return { type: "stream", to, topic: String(threadId) };
|
|
66
|
+
}
|
|
67
|
+
async function sendToZulip(client, ctx) {
|
|
68
|
+
const target = resolveOutboundTarget(ctx.to, ctx.threadId);
|
|
69
|
+
const res = await client.sendMessage({
|
|
70
|
+
type: target.type,
|
|
71
|
+
to: target.to,
|
|
72
|
+
topic: target.type === "stream" ? target.topic : undefined,
|
|
73
|
+
content: ctx.text,
|
|
74
|
+
});
|
|
75
|
+
return { channel: "zulip", messageId: String(res.id) };
|
|
76
|
+
}
|
|
77
|
+
export const zulipOutboundAdapter = {
|
|
78
|
+
deliveryMode: "direct",
|
|
79
|
+
textChunkLimit: ZULIP_TEXT_CHUNK_LIMIT,
|
|
80
|
+
chunkerMode: "markdown",
|
|
81
|
+
async sendText(ctx) {
|
|
82
|
+
const client = buildClient(ctx.cfg, ctx.accountId);
|
|
83
|
+
return sendToZulip(client, ctx);
|
|
84
|
+
},
|
|
85
|
+
async sendFormattedText(ctx) {
|
|
86
|
+
const client = buildClient(ctx.cfg, ctx.accountId);
|
|
87
|
+
const chunks = chunkText(ctx.text, ZULIP_TEXT_CHUNK_LIMIT);
|
|
88
|
+
const results = [];
|
|
89
|
+
for (const chunk of chunks) {
|
|
90
|
+
const result = await sendToZulip(client, { ...ctx, text: chunk });
|
|
91
|
+
results.push(result);
|
|
92
|
+
if (ctx.abortSignal?.aborted)
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
return results;
|
|
96
|
+
},
|
|
97
|
+
async sendMedia(ctx) {
|
|
98
|
+
const client = buildClient(ctx.cfg, ctx.accountId);
|
|
99
|
+
let content = ctx.text || "";
|
|
100
|
+
if (ctx.mediaUrl && ctx.mediaReadFile) {
|
|
101
|
+
const buffer = await ctx.mediaReadFile(ctx.mediaUrl);
|
|
102
|
+
const filename = ctx.mediaUrl.split("/").pop() ?? "file";
|
|
103
|
+
const upload = await client.uploadFile(filename, buffer);
|
|
104
|
+
// Zulip inline image/file syntax: [filename](url)
|
|
105
|
+
const mediaLine = `[${filename}](${upload.uri})`;
|
|
106
|
+
content = content ? `${mediaLine}\n${content}` : mediaLine;
|
|
107
|
+
}
|
|
108
|
+
else if (ctx.mediaUrl) {
|
|
109
|
+
content = content ? `${ctx.mediaUrl}\n${content}` : ctx.mediaUrl;
|
|
110
|
+
}
|
|
111
|
+
return sendToZulip(client, { ...ctx, text: content });
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=outbound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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AC,GAAG,CAAC,QAAQ,CAAC;QACnE,CAAC;QAED,OAAO,WAAW,CAAC,MAAM,EAAE,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACxD,CAAC;CACF,CAAC"}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ChannelPlugin } from "openclaw/plugin-sdk/core";
|
|
2
|
+
import type { ZulipResolvedAccount } from "./types.js";
|
|
3
|
+
import type { ZulipProbe } from "./status.js";
|
|
4
|
+
export declare const zulipPlugin: ChannelPlugin<ZulipResolvedAccount, ZulipProbe>;
|
|
5
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAmB9C,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,oBAAoB,EAAE,UAAU,CA8CtE,CAAC"}
|