openclaw-channel-dmwork 0.5.2 → 0.5.4
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/package.json +1 -1
- package/src/actions.ts +6 -0
- package/src/api-fetch.ts +4 -2
package/package.json
CHANGED
package/src/actions.ts
CHANGED
|
@@ -222,6 +222,10 @@ async function handleRead(params: {
|
|
|
222
222
|
const rawLimit = Number(args.limit) || 20;
|
|
223
223
|
const limit = Math.min(Math.max(rawLimit, 1), 100);
|
|
224
224
|
|
|
225
|
+
// after/before map to start_message_seq/end_message_seq (message sequence numbers)
|
|
226
|
+
const after = args.after != null ? Number(args.after) : undefined;
|
|
227
|
+
const before = args.before != null ? Number(args.before) : undefined;
|
|
228
|
+
|
|
225
229
|
const { channelId, channelType } = parseTarget(target, currentChannelId, getKnownGroupIds());
|
|
226
230
|
|
|
227
231
|
const messages = await getChannelMessages({
|
|
@@ -230,6 +234,8 @@ async function handleRead(params: {
|
|
|
230
234
|
channelId,
|
|
231
235
|
channelType,
|
|
232
236
|
limit,
|
|
237
|
+
...(after != null && !isNaN(after) ? { startMessageSeq: after } : {}),
|
|
238
|
+
...(before != null && !isNaN(before) ? { endMessageSeq: before } : {}),
|
|
233
239
|
log: log
|
|
234
240
|
? {
|
|
235
241
|
info: (...a: unknown[]) => log.info?.(String(a[0])),
|
package/src/api-fetch.ts
CHANGED
|
@@ -400,6 +400,8 @@ export async function getChannelMessages(params: {
|
|
|
400
400
|
channelId: string;
|
|
401
401
|
channelType: ChannelType;
|
|
402
402
|
limit?: number;
|
|
403
|
+
startMessageSeq?: number;
|
|
404
|
+
endMessageSeq?: number;
|
|
403
405
|
signal?: AbortSignal;
|
|
404
406
|
log?: { info?: (msg: string) => void; error?: (msg: string) => void };
|
|
405
407
|
}): Promise<Array<{ from_uid: string; content: string; timestamp: number; type?: number; url?: string; name?: string }>> {
|
|
@@ -416,8 +418,8 @@ export async function getChannelMessages(params: {
|
|
|
416
418
|
channel_id: params.channelId,
|
|
417
419
|
channel_type: params.channelType,
|
|
418
420
|
limit,
|
|
419
|
-
start_message_seq: 0,
|
|
420
|
-
end_message_seq: 0,
|
|
421
|
+
start_message_seq: params.startMessageSeq ?? 0,
|
|
422
|
+
end_message_seq: params.endMessageSeq ?? 0,
|
|
421
423
|
pull_mode: 1, // 1 = pull up (newer messages)
|
|
422
424
|
}),
|
|
423
425
|
signal: params.signal,
|