adp-openclaw 0.0.65 → 0.0.66
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/monitor.ts +21 -0
package/package.json
CHANGED
package/src/monitor.ts
CHANGED
|
@@ -388,8 +388,29 @@ async function connectAndHandle(params: ConnectParams): Promise<void> {
|
|
|
388
388
|
envelope: envelopeOptions,
|
|
389
389
|
});
|
|
390
390
|
|
|
391
|
+
// Build delivery target for cron jobs
|
|
392
|
+
// Format: adp-openclaw:{userId} for direct delivery via this channel
|
|
393
|
+
const cronDeliveryTarget = `adp-openclaw:${userIdentifier}`;
|
|
394
|
+
const nowMs = Date.now();
|
|
395
|
+
|
|
396
|
+
// Build BodyForAgent with context info for cron jobs (like QQBot does)
|
|
397
|
+
// This tells AI how to set up cron job delivery parameters
|
|
398
|
+
const contextInfo = `你正在通过 ADP-OpenClaw 与用户对话。
|
|
399
|
+
|
|
400
|
+
【会话上下文】
|
|
401
|
+
- 用户: ${inMsg.user?.username || inMsg.from} (${userIdentifier})
|
|
402
|
+
- 场景: 私聊
|
|
403
|
+
- 当前时间戳(ms): ${nowMs}
|
|
404
|
+
- 定时提醒投递地址: channel=adp-openclaw, to=${cronDeliveryTarget}`;
|
|
405
|
+
|
|
406
|
+
// If message is a command (starts with /), don't inject context
|
|
407
|
+
const agentBody = inMsg.text.startsWith("/")
|
|
408
|
+
? inMsg.text
|
|
409
|
+
: `${contextInfo}\n\n${inMsg.text}`;
|
|
410
|
+
|
|
391
411
|
const ctx = runtime.channel.reply.finalizeInboundContext({
|
|
392
412
|
Body: formattedBody,
|
|
413
|
+
BodyForAgent: agentBody, // AI sees this context with cron delivery info
|
|
393
414
|
RawBody: inMsg.text,
|
|
394
415
|
CommandBody: inMsg.text,
|
|
395
416
|
// User identity: format as "adp-openclaw:{tenantId}:{userId}" for multi-tenant support
|