adp-openclaw 0.0.66 → 0.0.67
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 +18 -3
package/package.json
CHANGED
package/src/monitor.ts
CHANGED
|
@@ -390,7 +390,7 @@ async function connectAndHandle(params: ConnectParams): Promise<void> {
|
|
|
390
390
|
|
|
391
391
|
// Build delivery target for cron jobs
|
|
392
392
|
// Format: adp-openclaw:{userId} for direct delivery via this channel
|
|
393
|
-
const cronDeliveryTarget =
|
|
393
|
+
const cronDeliveryTarget = `${userIdentifier}`;
|
|
394
394
|
const nowMs = Date.now();
|
|
395
395
|
|
|
396
396
|
// Build BodyForAgent with context info for cron jobs (like QQBot does)
|
|
@@ -791,8 +791,23 @@ async function connectAndHandle(params: ConnectParams): Promise<void> {
|
|
|
791
791
|
|
|
792
792
|
let result: ChatHistoryResponse;
|
|
793
793
|
|
|
794
|
-
if
|
|
795
|
-
|
|
794
|
+
// Check if sessionKey is in old format: agent:main:direct:{id}
|
|
795
|
+
// We need to extract the id and merge old + new format histories
|
|
796
|
+
const oldFormatMatch = historyPayload.sessionKey?.match(/^agent:main:direct:(.+)$/);
|
|
797
|
+
|
|
798
|
+
if (oldFormatMatch) {
|
|
799
|
+
// Old format sessionKey detected, need to merge with new format
|
|
800
|
+
// Old: agent:main:direct:{conversationId}
|
|
801
|
+
// New: agent:main:adp-openclaw:direct:{conversationId}
|
|
802
|
+
const extractedId = oldFormatMatch[1];
|
|
803
|
+
log?.info(`[adp-openclaw] Old format sessionKey detected, extracting id: ${extractedId}`);
|
|
804
|
+
log?.info(`[adp-openclaw] Merging old and new session histories for id: ${extractedId}`);
|
|
805
|
+
result = await getMergedChatHistory(extractedId, {
|
|
806
|
+
limit,
|
|
807
|
+
log,
|
|
808
|
+
});
|
|
809
|
+
} else if (historyPayload.sessionKey) {
|
|
810
|
+
// Non-old-format sessionKey, use directly
|
|
796
811
|
log?.info(`[adp-openclaw] Using provided sessionKey: ${historyPayload.sessionKey}`);
|
|
797
812
|
result = await getChatHistory(historyPayload.sessionKey, {
|
|
798
813
|
limit,
|