@mobcode/openclaw-plugin 0.1.6 → 0.1.7
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/openclaw-session-reader.js +1 -1
- package/src/state-store.js +10 -1
package/package.json
CHANGED
|
@@ -60,7 +60,7 @@ async function readSessionMessagesThroughChatHistory(config, sessionKey, logger)
|
|
|
60
60
|
});
|
|
61
61
|
const messages = payload?.messages;
|
|
62
62
|
logger?.info?.(
|
|
63
|
-
`[mobcode-history] chat.history response session=${normalizedSessionKey} sessionId=${String(payload?.sessionId ?? "").trim() || "-"} messages=${Array.isArray(messages) ? messages.length : 0}`,
|
|
63
|
+
`[mobcode-history] chat.history response session=${normalizedSessionKey} sessionId=${String(payload?.sessionId ?? "").trim() || "-"} thinkingLevel=${String(payload?.thinkingLevel ?? "").trim() || "-"} fastMode=${String(payload?.fastMode ?? "").trim() || "-"} verboseLevel=${String(payload?.verboseLevel ?? "").trim() || "-"} messages=${Array.isArray(messages) ? messages.length : 0}`,
|
|
64
64
|
);
|
|
65
65
|
return Array.isArray(messages) ? messages : [];
|
|
66
66
|
}
|
package/src/state-store.js
CHANGED
|
@@ -814,8 +814,11 @@ export class MobcodeStateStore {
|
|
|
814
814
|
const alreadyBackfilled =
|
|
815
815
|
typeof existing?.last_backfill_at === "string" && existing.last_backfill_at.trim().length > 0;
|
|
816
816
|
if (alreadyBackfilled) {
|
|
817
|
+
const messageCountRow = this._db()
|
|
818
|
+
.prepare(`SELECT COUNT(*) AS count FROM messages WHERE session_key=?`)
|
|
819
|
+
.get(normalizedSessionKey);
|
|
817
820
|
this.logger?.info?.(
|
|
818
|
-
`[mobcode-store] ensureSessionIndexed skip session=${normalizedSessionKey} reason=already_backfilled`,
|
|
821
|
+
`[mobcode-store] ensureSessionIndexed skip session=${normalizedSessionKey} reason=already_backfilled lastBackfillAt=${existing?.last_backfill_at ?? "-"} messageRows=${Number(messageCountRow?.count ?? 0)}`,
|
|
819
822
|
);
|
|
820
823
|
return;
|
|
821
824
|
}
|
|
@@ -993,6 +996,9 @@ export class MobcodeStateStore {
|
|
|
993
996
|
ORDER BY id ASC`,
|
|
994
997
|
)
|
|
995
998
|
.all(normalizedSessionKey);
|
|
999
|
+
this.logger?.info?.(
|
|
1000
|
+
`[mobcode-store] pageTranscriptMessages session=${normalizedSessionKey} rows=${rows.length}`,
|
|
1001
|
+
);
|
|
996
1002
|
return rows.map((row) => {
|
|
997
1003
|
const message = fromJson(row.raw_json, {});
|
|
998
1004
|
if (message && typeof message === "object" && !Array.isArray(message) && !message.id) {
|
|
@@ -1009,6 +1015,9 @@ export class MobcodeStateStore {
|
|
|
1009
1015
|
typeof beforeId === "number" && Number.isFinite(beforeId) ? beforeId : null;
|
|
1010
1016
|
const transcriptMessages = await this.pageTranscriptMessages(normalizedSessionKey);
|
|
1011
1017
|
const projected = projectConversationMessages(transcriptMessages, normalizedSessionKey);
|
|
1018
|
+
this.logger?.info?.(
|
|
1019
|
+
`[mobcode-store] pageSessionMessages session=${normalizedSessionKey} transcriptMessages=${transcriptMessages.length} projectedMessages=${projected.length} limit=${normalizedLimit} beforeId=${normalizedBeforeId ?? "-"}`
|
|
1020
|
+
);
|
|
1012
1021
|
const endExclusive = normalizedBeforeId == null
|
|
1013
1022
|
? projected.length
|
|
1014
1023
|
: Math.max(0, Math.min(projected.length, normalizedBeforeId - 1));
|